diff options
Diffstat (limited to 'gcc/ada/doc')
18 files changed, 2943 insertions, 1588 deletions
diff --git a/gcc/ada/doc/gnat_rm.rst b/gcc/ada/doc/gnat_rm.rst index e52f2a63..27551ca 100644 --- a/gcc/ada/doc/gnat_rm.rst +++ b/gcc/ada/doc/gnat_rm.rst @@ -54,7 +54,7 @@ GNAT Reference Manual gnat_rm/interfacing_to_other_languages gnat_rm/specialized_needs_annexes gnat_rm/implementation_of_specific_ada_features - gnat_rm/implementation_of_ada_2012_features + gnat_rm/implementation_of_ada_2022_features gnat_rm/gnat_language_extensions gnat_rm/security_hardening_features gnat_rm/obsolescent_features diff --git a/gcc/ada/doc/gnat_rm/about_this_guide.rst b/gcc/ada/doc/gnat_rm/about_this_guide.rst index 9defee8..ff72194 100644 --- a/gcc/ada/doc/gnat_rm/about_this_guide.rst +++ b/gcc/ada/doc/gnat_rm/about_this_guide.rst @@ -14,7 +14,7 @@ GNAT compiler. It includes information on implementation dependent characteristics of GNAT, including all the information required by Annex M of the Ada language standard. -GNAT implements Ada 95, Ada 2005 and Ada 2012, and it may also be +GNAT implements Ada 95, Ada 2005, Ada 2012 and Ada 2022, and it may also be invoked in Ada 83 compatibility mode. By default, GNAT assumes Ada 2012, but you can override with a compiler switch @@ -93,8 +93,8 @@ This reference manual contains the following chapters: to GNAT's implementation of machine code insertions, tasking, and several other features. -* :ref:`Implementation_of_Ada_2012_Features`, describes the status of the - GNAT implementation of the Ada 2012 language standard. +* :ref:`Implementation_of_Ada_2022_Features`, describes the status of the + GNAT implementation of the Ada 2022 language standard. * :ref:`Security_Hardening_Features` documents GNAT extensions aimed at security hardening. diff --git a/gcc/ada/doc/gnat_rm/compatibility_and_porting_guide.rst b/gcc/ada/doc/gnat_rm/compatibility_and_porting_guide.rst index 5a20995..3da2b32 100644 --- a/gcc/ada/doc/gnat_rm/compatibility_and_porting_guide.rst +++ b/gcc/ada/doc/gnat_rm/compatibility_and_porting_guide.rst @@ -134,9 +134,9 @@ types will be portable. Compatibility with Ada 83 ========================= -.. index:: Compatibility (between Ada 83 and Ada 95 / Ada 2005 / Ada 2012) +.. index:: Compatibility (between Ada 83 and Ada 95 / Ada 2005 / Ada 2012 / Ada 2022) -Ada 95 and the subsequent revisions Ada 2005 and Ada 2012 +Ada 95 and the subsequent revisions Ada 2005, Ada 2012, Ada 2022 are highly upwards compatible with Ada 83. In particular, the design intention was that the difficulties associated with moving from Ada 83 to later versions of the standard should be no greater @@ -505,7 +505,7 @@ such an Ada 83 application is being ported to different target hardware (for example where the byte endianness has changed) then you will need to carefully examine the program logic; the porting effort will heavily depend on the robustness of the original design. Moreover, Ada 95 (and thus -Ada 2005 and Ada 2012) are sometimes +Ada 2005, Ada 2012, and Ada 2022) are sometimes incompatible with typical Ada 83 compiler practices regarding implicit packing, the meaning of the Size attribute, and the size of access values. GNAT's approach to these issues is described in :ref:`Representation_Clauses`. diff --git a/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst b/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst index ee2df66..f313179 100644 --- a/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst +++ b/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst @@ -657,6 +657,22 @@ An exception message can also be added: when Imported_C_Func /= 0; end; +Implicit With +------------- + +This feature allows a standalone ``use`` clause in the context clause of a +compilation unit to imply an implicit ``with`` of the same library unit where +an equivalent ``with`` clause would be allowed. + +.. code-block:: ada + + use Ada.Text_IO; + procedure Main is + begin + Put_Line ("Hello"); + end; + + Storage Model ------------- @@ -1334,113 +1350,150 @@ case statement with composite selector type". Mutably Tagged Types with Size'Class Aspect ------------------------------------------- -The ``Size'Class`` aspect can be applied to a tagged type to specify a size -constraint for the type and its descendants. When this aspect is specified -on a tagged type, the class-wide type of that type is considered to be a -"mutably tagged" type - meaning that objects of the class-wide type can have -their tag changed by assignment from objects with a different tag. +For a specific tagged nonformal type T that satisfies some conditions +described later in this section, the universal-integer-valued type-related +representation aspect ``Size'Class`` may be specified; any such specified +aspect value shall be static. -Example: +Specifying this aspect imposes an upper bound on the sizes of all specific +descendants of T (including T itself). T'Class (but not T) is then said to be +a "mutably tagged" type - meaning that T'Class is a definite subtype and that +the tag of a variable of type T'Class may be modified by assignment in some +cases described later in this section. An inherited ``Size'Class`` aspect +value may be overridden, but not with a larger value. -.. code-block:: ada +If the ``Size'Class`` aspect is specified for a type T, then every specific +descendant of T (including T itself) - type Base is tagged null record - with Size'Class => 16 * 8; -- Size in bits (128 bits, or 16 bytes) +* shall have a Size that does not exceed the specified value; and - type Derived_Type is new Base with record - Data_Field : Integer; - end record; -- ERROR if Derived_Type exceeds 16 bytes +* shall have a (possibly inherited) ``Size'Class`` aspect that does not exceed + the specifed value; and + +* shall be undiscriminated; and -Class-wide types with a specified ``Size'Class`` can be used as the type of -array components, record components, and stand-alone objects. +* shall have no composite subcomponent whose subtype is subject to a nonstatic + constraint; and + +* shall not have a tagged partial view other than a private extension; and + +* shall not be a descendant of an interface type; and + +* shall not have a statically deeper accessibility level than that of T. + +If the ``Size'Class`` aspect is not specified for a type T (either explicitly +or by inheritance), then it shall not be specified for any descendant of T. + +Example: .. code-block:: ada - Inst : Base'Class; - type Array_of_Base is array (Positive range <>) of Base'Class; + type Root_Type is tagged null record with Size'Class => 16 * 8; + + type Derived_Type is new Root_Type with record + Stuff : Some_Type; + end record; -- ERROR if Derived_Type exceeds 16 bytes -If the ``Size'Class`` aspect is specified for a type ``T``, then every -specific descendant of ``T`` [redundant: (including ``T``)] +Because any subtype of a mutably tagged type is definite, it can be used as a +component subtype for enclosing array or record types, as the subtype of a +default-initialized stand-alone object, or as the subtype of an uninitialized +allocator, as in this example: -- shall have a Size that does not exceed the specified value; and +.. code-block:: ada -- shall be undiscriminated; and + Obj : Root_Type'Class; + type Array_of_Roots is array (Positive range <>) of Root_Type'Class; -- shall have no composite subcomponent whose subtype is subject to a - dynamic constraint; and +Default initialization of an object of such a definite subtype proceeds as +for the corresponding specific type, except that Program_Error is raised if +the specific type is abstract. In particular, the initial tag of the object +is that of the corresponding specific type. -- shall have no interface progenitors; and +There is a general design principle that if a type has a tagged partial view, +then the type's ``Size'Class`` aspect (or lack thereof) should be determinable +by looking only at the partial view. That provides the motivation for the +rules of the next two paragraphs. -- shall not have a tagged partial view other than a private extension; and +If a type has a tagged partial view, then a ``Size'Class`` aspect specification +may be provided only at the point of the partial view declaration (in other +words, no such aspect specification may be provided when the full view of +the type is declared). All of the above rules (in particular, the rule that +an overriding ``Size'Class`` aspect value shall not be larger than the +overridden inherited value) are also enforced when the full view (which may +have a different ancestor type than that of the partial view) is declared. +If a partial view for a type inherits a ``Size'Class`` aspect value and does +not override that value with an explicit aspect specification, then the +(static) aspect values inherited by the partial view and by the full view +shall be equal. -- shall not have a statically deeper accessibility level than that of ``T``. +An actual parameter of an instantiation whose corresponding formal parameter +is a formal tagged private type shall not be either mutably tagged or the +corresponding specific type of a mutably tagged type. -In addition to the places where Legality Rules normally apply (see 12.3), -these legality rules apply also in the private part and in the body of an -instance of a generic unit. +For the legality rules in this section, the RM 12.3(11) rule about legality +checking in the visible part and formal part of an instance is extended (in +the same way that it is extended in many other places in the RM) to include +the private part of an instance. -For any subtype ``S`` that is a subtype of a descendant of ``T``, ``S'Class'Size`` is -defined to yield the specified value [redundant:, although ``S'Class'Size`` is -not a static expression]. +An object (or a view thereof) of a tagged type is defined to be +"tag-constrained" if it is -A class-wide descendant of a type with a specified ``Size'Class`` aspect is -defined to be a "mutably tagged" type. Any subtype of a mutably tagged type is, -by definition, a definite subtype (RM 3.3 notwithstanding). Default -initialization of an object of such a definite subtype proceeds as for the -corresponding specific type, except that ``Program_Error`` is raised if the -specific type is abstract. [In particular, the initial tag of the object is -that of the corresponding specific type.] +* an object whose type is not mutably tagged; or -An object of a tagged type is defined to be "tag-constrained" if it is +* a constant object; or -- an object whose type is not mutably tagged; or +* a view conversion of a tag-constrained object; or -- a constant object; or +* a view conversion to a type that is not a descendant of the operand's + type; or -- a view conversion of a tag-constrained object; or +* a formal in out or out parameter whose corresponding actual parameter is + tag-constrained; or -- a formal ``in out`` or ``out`` parameter whose corresponding - actual parameter is tag-constrained. +* a dereference of an access value. -In the case of an assignment to a tagged variable that -is not tag-constrained, no check is performed that the tag of the value of -the expression is the same as that of the target (RM 5.2 notwithstanding). +In the case of an assignment to a tagged variable that is not +tag-constrained, no check is performed that the tag of the value +of the expression is the same as that of the target (RM 5.2 notwithstanding). Instead, the tag of the target object becomes that of the source object of -the assignment. +the assignment. Note that the tag of an object of a mutably tagged type MT +will always be the tag of some specific type that is a descendant of MT. An assignment to a composite object similarly copies the tags of any -subcomponents of the source object that have a mutably-tagged type. - -The ``Constrained`` attribute is defined for any name denoting an object of a -mutably tagged type (RM 3.7.2 notwithstanding). In this case, the Constrained -attribute yields the value True if the object is tag-constrained and False -otherwise. - -Renaming is not allowed (see 8.5.1) for a type conversion having an operand of -a mutably tagged type ``MT`` and a target type ``TT`` such that ``TT'Class`` -does not cover ``MT``, nor for any part of such an object, nor for any slice -of such an object. This rule also applies in any context where a name is -required to be one for which "renaming is allowed" (for example, see RM 12.4). - -A name denoting a view of a variable of a mutably tagged type shall not -occur as an operative constituent of the prefix of a name denoting a -prefixed view of a callable entity, except as the callee name in a call to -the callable entity. - -For a type conversion between two general access types, either both or neither -of the designated types shall be mutably tagged. For an ``Access`` (or -``Unchecked_Access``) attribute reference, the designated type of the type of the -attribute reference and the type of the prefix of the attribute shall either -both or neither be mutably tagged. +subcomponents of the source object that have a mutably tagged type. + +The Constrained attribute is defined for any name denoting an object of a +mutably tagged type (RM 3.7.2 notwithstanding). In this case, the +Constrained attribute yields the value True if the object is +tag-constrained and False otherwise. + +Renaming is not allowed (see RM 8.5.1) for a type conversion having an operand +of a mutably tagged type MT and a target type TT such that TT (or its +corresponding specific type if TT is class-wide) is not an ancestor of MT +(this is sometimes called a "downward" conversion), nor for any part of +such an object, nor for any slice of any part of such an object. This +rule also applies in any context where a name is required to be one for +which "renaming is allowed" (for example, see RM 12.4). +[This is analogous to the way that renaming is not allowed for a +discriminant-dependent component of an unconstrained variable.] + +A name denoting a view of a variable of a mutably tagged type shall not occur +as an operative constituent of the prefix of a name denoting a prefixed +view of a callable entity, except as the callee name in a call to the +callable entity. This disallows, for example, renaming such a prefixed view, +passing the prefixed view name as a generic actual parameter, or using the +prefixed view name as the prefix of an attribute. The execution of a construct is erroneous if the construct has a constituent that is a name denoting a subcomponent of a tagged object and the object's -tag is changed by this execution between evaluating the name and the last use -(within this execution) of the subcomponent denoted by the name. +tag is changed by this execution between evaluating the name and the last +use (within this execution) of the subcomponent denoted by the name. +This is analogous to the RM 3.7.2(4) rule about discriminant-dependent +subcomponents. -If the type of a formal parameter is a specific tagged type then the execution +If the type of a formal parameter is a specific tagged type, then the execution of the call is erroneous if the tag of the actual is changed while the formal -parameter exists (that is, before leaving the corresponding callable -construct). +parameter exists (that is, before leaving the corresponding callable construct). +This is analogous to the RM 6.4.1(18) rule about discriminated parameters. Generalized Finalization ------------------------ @@ -1453,97 +1506,60 @@ that the record type must be a root type, in other words not a derived type. The aspect additionally makes it possible to specify relaxed semantics for the finalization operations by means of the ``Relaxed_Finalization`` setting. - -Example: +Here is the archetypal example: .. code-block:: ada - type Ctrl is record - Id : Natural := 0; + type T is record + ... end record with Finalizable => (Initialize => Initialize, Adjust => Adjust, Finalize => Finalize, Relaxed_Finalization => True); - procedure Adjust (Obj : in out Ctrl); - procedure Finalize (Obj : in out Ctrl); - procedure Initialize (Obj : in out Ctrl); - -The three procedures have the same profile, taking a single ``in out T`` -parameter. + procedure Adjust (Obj : in out T); + procedure Finalize (Obj : in out T); + procedure Initialize (Obj : in out T); -We follow the same dynamic semantics as controlled objects: +The three procedures have the same profile, with a single ``in out`` parameter, +and also have the same dynamic semantics as for controlled types: - ``Initialize`` is called when an object of type ``T`` is declared without - default expression. + initialization expression. - ``Adjust`` is called after an object of type ``T`` is assigned a new value. - ``Finalize`` is called when an object of type ``T`` goes out of scope (for - stack-allocated objects) or is explicitly deallocated (for heap-allocated - objects). It is also called when on the value being replaced in an - assignment. - -However the following differences are enforced by default when compared to the -current Ada controlled-objects finalization model: + stack-allocated objects) or is deallocated (for heap-allocated objects). + It is also called when the value is replaced by an assignment. -* No automatic finalization of heap allocated objects: ``Finalize`` is only - called when an object is implicitly deallocated. As a consequence, no-runtime - support is needed for the implicit case, and no header will be maintained for - this in heap-allocated controlled objects. +However, when ``Relaxed_Finalization`` is either ``True`` or not explicitly +specified, the following differences are implemented relative to the semantics +of controlled types: - Heap-allocated objects allocated through a nested access type definition will - hence **not** be deallocated either. The result is simply that memory will be - leaked in those cases. +* The compiler has permission to perform no automatic finalization of + heap-allocated objects: ``Finalize`` is only called when such an object + is explicitly deallocated, or when the designated object is assigned a new + value. As a consequence, no runtime support is needed for performing + implicit deallocation. In particular, no per-object header data is needed + for heap-allocated objects. -* The ``Finalize`` procedure should have have the :ref:`No_Raise_Aspect` specified. - If that's not the case, a compilation error will be raised. + Heap-allocated objects allocated through a nested access type will therefore + **not** be deallocated either. The result is simply that memory will be leaked + in this case. -Additionally, two other configuration aspects are added, -``Legacy_Heap_Finalization`` and ``Exceptions_In_Finalize``: +* The ``Adjust`` and ``Finalize`` procedures are automatically considered as + having the :ref:`No_Raise_Aspect` specified for them. In particular, the + compiler has permission to enforce none of the guarantees specified by the + RM 7.6.1 (14/1) and subsequent subclauses. -* ``Legacy_Heap_Finalization``: Uses the legacy automatic finalization of - heap-allocated objects - -* ``Exceptions_In_Finalize``: Allow users to have a finalizer that raises exceptions - **NB!** note that using this aspect introduces execution time penalities. - -.. _No_Raise_Aspect: - -No_Raise aspect ----------------- - -The ``No_Raise`` aspect can be applied to a subprogram to declare that this subprogram is not -expected to raise any exceptions. Should an exception still occur during the execution of -this subprogram, ``Program_Error`` is raised. - -New specification for ``Ada.Finalization.Controlled`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -``Ada.Finalization.Controlled`` is now specified as: - -.. code-block:: ada - - type Controlled is abstract tagged null record - with Initialize => Initialize, - Adjust => Adjust, - Finalize => Finalize, - Legacy_Heap_Finalization, Exceptions_In_Finalize; - - procedure Initialize (Self : in out Controlled) is abstract; - procedure Adjust (Self : in out Controlled) is abstract; - procedure Finalize (Self : in out Controlled) is abstract; - - -### Examples - -A simple example of a ref-counted type: +Simple example of ref-counted type: .. code-block:: ada type T is record - Value : Integer; + Value : Integer; Ref_Count : Natural := 0; end record; @@ -1555,8 +1571,8 @@ A simple example of a ref-counted type: type T_Ref is record Value : T_Access; end record - with Adjust => Adjust, - Finalize => Finalize; + with Finalizable => (Adjust => Adjust, + Finalize => Finalize); procedure Adjust (Ref : in out T_Ref) is begin @@ -1568,8 +1584,7 @@ A simple example of a ref-counted type: Def_Ref (Ref.Value); end Finalize; - -A simple file handle that ensures resources are properly released: +Simple file handle that ensures resources are properly released: .. code-block:: ada @@ -1579,51 +1594,47 @@ A simple file handle that ensures resources are properly released: function Open (Path : String) return File; procedure Close (F : in out File); + private type File is limited record Handle : ...; end record - with Finalize => Close; - - -Finalized tagged types -^^^^^^^^^^^^^^^^^^^^^^^ + with Finalizable (Finalize => Close); + end P; -Aspects are inherited by derived types and optionally overriden by those. The -compiler-generated calls to the user-defined operations are then -dispatching whenever it makes sense, i.e. the object in question is of -class-wide type and the class includes at least one finalized tagged type. +Finalizable tagged types +^^^^^^^^^^^^^^^^^^^^^^^^ -However note that for simplicity, it is forbidden to change the value of any of -those new aspects in derived types. +The aspect is inherited by derived types and the primitives may be overridden +by the derivation. The compiler-generated calls to these operations are then +dispatching whenever it makes sense, i.e. when the object in question is of a +class-wide type and the class includes at least one finalizable tagged type. Composite types ^^^^^^^^^^^^^^^ -When a finalized type is used as a component of a composite type, the latter -becomes finalized as well. The three primitives are derived automatically -in order to call the primitives of their components. - -If that composite type was already user-finalized, then the compiler -calls the primitives of the components so as to stay consistent with today's -controlled types's behavior. - -So, ``Initialize`` and ``Adjust`` are called on components before they -are called on the composite object, but ``Finalize`` is called on the composite -object first. +When a finalizable type is used as a component of a composite type, the latter +becomes finalizable as well. The three primitives are derived automatically +in order to call the primitives of their components. The dynamic semantics is +the same as for controlled components of composite types. Interoperability with controlled types ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -As a consequence of the redefinition of the ``Controlled`` type as a base type -with the new aspects defined, interoperability with controlled type naturally -follows the definition of the above rules. In particular: +Finalizable types are fully interoperable with controlled types, in particular +it is possible for a finalizable type to have a controlled component and vice +versa, but the stricter dynamic semantics, in other words that of controlled +types, is applied in this case. -* It is possible to have a new finalized type have a controlled type - component -* It is possible to have a controlled type have a finalized type - component +.. _No_Raise_Aspect: +No_Raise aspect +---------------- + +The ``No_Raise`` aspect can be applied to a subprogram to declare that this +subprogram is not expected to raise an exception. Should an exception still +be raised during the execution of the subprogram, it is caught at the end of +this execution and ``Program_Error`` is propagated to the caller. Inference of Dependent Types in Generic Instantiations ------------------------------------------------------ @@ -1766,3 +1777,19 @@ If an exception is raised in the finally part, it cannot be caught by the ``exce Abort/ATC (asynchronous transfer of control) cannot interrupt a finally block, nor prevent its execution, that is the finally block must be executed in full even if the containing task is aborted, or if the control is transferred out of the block. + +Continue statement +------------------ + +The ``continue`` keyword makes it possible to stop execution of a loop iteration +and continue with the next one. A continue statement has the same syntax +(except "exit" is replaced with "continue"), static semantics, and legality +rules as an exit statement. The difference is in the dynamic semantics: where an +exit statement would cause a transfer of control that completes the (implicitly +or explicitly) specified loop_statement, a continue statement would instead +cause a transfer of control that completes only the current iteration of that +loop_statement, like a goto statement targeting a label following the last +statement in the sequence of statements of the specified loop_statement. + +Note that ``continue`` is a keyword but it is not a reserved word. This is a +configuration that does not exist in standard Ada. diff --git a/gcc/ada/doc/gnat_rm/implementation_advice.rst b/gcc/ada/doc/gnat_rm/implementation_advice.rst index 435cfa4..d4fdd09 100644 --- a/gcc/ada/doc/gnat_rm/implementation_advice.rst +++ b/gcc/ada/doc/gnat_rm/implementation_advice.rst @@ -1218,16 +1218,12 @@ RM E.5(28-29): Partition Communication Subsystem should allow them to block until the corresponding subprogram body returns." -Followed by GLADE, a separately supplied PCS that can be used with -GNAT. +A separately supplied PCS that can be used with GNAT when combined with the PolyORB product. "The ``Write`` operation on a stream of type ``Params_Stream_Type`` should raise ``Storage_Error`` if it runs out of space trying to write the ``Item`` into the stream." -Followed by GLADE, a separately supplied PCS that can be used with -GNAT. - .. index:: COBOL support RM F(7): COBOL Support diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_aspects.rst b/gcc/ada/doc/gnat_rm/implementation_defined_aspects.rst index 61ea10c..a369568 100644 --- a/gcc/ada/doc/gnat_rm/implementation_defined_aspects.rst +++ b/gcc/ada/doc/gnat_rm/implementation_defined_aspects.rst @@ -538,6 +538,14 @@ Aspect Persistent_BSS This boolean aspect is equivalent to :ref:`pragma Persistent_BSS<Pragma-Persistent_BSS>`. +Aspect Potentially_Invalid +========================== +.. index:: Potentially_Invalid + +For the syntax and semantics of this aspect, see the SPARK 2014 Reference +Manual, section 13.9.1. + + Aspect Predicate ================ .. index:: Predicate @@ -549,6 +557,12 @@ predicate is static or dynamic is controlled by the form of the expression. It is also separately controllable using pragma ``Assertion_Policy``. +Aspect Program_Exit +=================== +.. index:: Program_Exit + +This boolean aspect is equivalent to :ref:`pragma Program_Exit<Pragma-Program_Exit>`. + Aspect Pure_Function ==================== .. index:: Pure_Function diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst b/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst index f051810..86d2a81 100644 --- a/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst +++ b/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst @@ -1629,9 +1629,9 @@ Attribute Valid_Value .. index:: Valid_Value The ``'Valid_Value`` attribute is defined for enumeration types other than -those in package Standard. This attribute is a function that takes -a String, and returns Boolean. ``T'Valid_Value (S)`` returns True -if and only if ``T'Value (S)`` would not raise Constraint_Error. +those in package Standard or types derived from those types. This attribute is +a function that takes a String, and returns Boolean. ``T'Valid_Value (S)`` +returns True if and only if ``T'Value (S)`` would not raise Constraint_Error. Attribute Valid_Scalars ======================= diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_characteristics.rst b/gcc/ada/doc/gnat_rm/implementation_defined_characteristics.rst index 3e41899..f7746c8 100644 --- a/gcc/ada/doc/gnat_rm/implementation_defined_characteristics.rst +++ b/gcc/ada/doc/gnat_rm/implementation_defined_characteristics.rst @@ -377,11 +377,7 @@ may have been set by a call to ``Ada.Command_Line.Set_Exit_Status``). * "The mechanisms for building and running partitions. See 10.2(24)." -GNAT itself supports programs with only a single partition. The GNATDIST -tool provided with the GLADE package (which also includes an implementation -of the PCS) provides a completely flexible method for building and running -programs consisting of multiple partitions. See the separate GLADE manual -for details. +GNAT itself supports programs with only a single partition. The PolyORB product (which also includes an implementation of the PCS) provides a completely flexible method for building and running programs consisting of multiple partitions. See the separate PolyORB user guide for details. * "The details of program execution, including program @@ -394,7 +390,7 @@ See separate section on compilation model. implementation. See 10.2(28)." Passive partitions are supported on targets where shared memory is -provided by the operating system. See the GLADE reference manual for +provided by the operating system. See the PolyORB user guide for further details. * @@ -467,7 +463,7 @@ Implementation-defined assertion_aspect_marks include Assert_And_Cut, Assume, Contract_Cases, Debug, Ghost, Initial_Condition, Loop_Invariant, Loop_Variant, Postcondition, Precondition, Predicate, Refined_Post, Statement_Assertions, and Subprogram_Variant. Implementation-defined -policy_identifiers include Ignore and Suppressible. +policy_identifiers include Disable and Suppressible. * "The default assertion policy. See 11.4.2(10)." @@ -1188,27 +1184,27 @@ Unknown. "The means for creating and executing distributed programs. See E(5)." -The GLADE package provides a utility GNATDIST for creating and executing -distributed programs. See the GLADE reference manual for further details. +The PolyORB product provides means creating and executing +distributed programs. See the PolyORB user guide for further details. * "Any events that can result in a partition becoming inaccessible. See E.1(7)." -See the GLADE reference manual for full details on such events. +See the PolyORB user guide for full details on such events. * "The scheduling policies, treatment of priorities, and management of shared resources between partitions in certain cases. See E.1(11)." -See the GLADE reference manual for full details on these aspects of +See the PolyORB user guide for full details on these aspects of multi-partition execution. * "Whether the execution of the remote subprogram is immediately aborted as a result of cancellation. See E.4(13)." -See the GLADE reference manual for details on the effect of abort in +See the PolyORB user guide for details on the effect of abort in a distributed application. * @@ -1219,7 +1215,7 @@ System.RPC.Partition_ID'Last is Integer'Last. See source file :file:`s-rpc.ads`. * "Implementation-defined interfaces in the PCS. See E.5(26)." -See the GLADE reference manual for a full description of all +See the PolyORB user guide for a full description of all implementation defined interfaces. * diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst index d18ce36..3986298 100644 --- a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst +++ b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst @@ -123,6 +123,11 @@ and generics may name types with unknown discriminants without using the ``(<>)`` notation. In addition, some but not all of the additional restrictions of Ada 83 are enforced. +Like all configuration pragmas, if the pragma is placed before a library +level package specification it is not propagated to the corresponding +package body (see RM 10.1.5(8)); it must be added explicitly to the +package body. + Ada 83 mode is intended for two purposes. Firstly, it allows existing Ada 83 code to be compiled and adapted to GNAT with less effort. Secondly, it aids in keeping code backwards compatible with Ada 83. @@ -149,6 +154,11 @@ contexts. This pragma is useful when writing a reusable component that itself uses Ada 95 features, but which is intended to be usable from either Ada 83 or Ada 95 programs. +Like all configuration pragmas, if the pragma is placed before a library +level package specification it is not propagated to the corresponding +package body (see RM 10.1.5(8)); it must be added explicitly to the +package body. + Pragma Ada_05 ============= @@ -166,6 +176,11 @@ This pragma is useful when writing a reusable component that itself uses Ada 2005 features, but which is intended to be usable from either Ada 83 or Ada 95 programs. +Like all configuration pragmas, if the pragma is placed before a library +level package specification it is not propagated to the corresponding +package body (see RM 10.1.5(8)); it must be added explicitly to the +package body. + The one argument form (which is not a configuration pragma) is used for managing the transition from Ada 95 to Ada 2005 in the run-time library. If an entity is marked @@ -209,6 +224,11 @@ contexts. This pragma is useful when writing a reusable component that itself uses Ada 2012 features, but which is intended to be usable from Ada 83, Ada 95, or Ada 2005 programs. +Like all configuration pragmas, if the pragma is placed before a library +level package specification it is not propagated to the corresponding +package body (see RM 10.1.5(8)); it must be added explicitly to the +package body. + The one argument form, which is not a configuration pragma, is used for managing the transition from Ada 2005 to Ada 2012 in the run-time library. If an entity is marked @@ -252,6 +272,11 @@ contexts. This pragma is useful when writing a reusable component that itself uses Ada 2022 features, but which is intended to be usable from Ada 83, Ada 95, Ada 2005 or Ada 2012 programs. +Like all configuration pragmas, if the pragma is placed before a library +level package specification it is not propagated to the corresponding +package body (see RM 10.1.5(8)); it must be added explicitly to the +package body. + The one argument form, which is not a configuration pragma, is used for managing the transition from Ada 2012 to Ada 2022 in the run-time library. If an entity is marked @@ -1940,7 +1965,8 @@ Syntax: EXIT_CASE ::= GUARD => EXIT_KIND EXIT_KIND ::= Normal_Return | Exception_Raised - | (Exception_Raised => exception_name) + | (Exception_Raised => exception_name) + | Program_Exit GUARD ::= Boolean_expression For the semantics of this aspect, see the SPARK 2014 Reference Manual, section @@ -5285,6 +5311,20 @@ generating ``Restrictions`` pragmas, it generates violations of the profile generate warning messages instead of error messages. +.. _Pragma-Program_Exit: + +Pragma Program_Exit +=================== + +Syntax: + +.. code-block:: ada + + pragma Program_Exit [ (boolean_EXPRESSION) ]; + +For the semantics of this pragma, see the entry for aspect ``Program_Exit`` +in the SPARK 2014 Reference Manual, section 6.1.10. + Pragma Propagate_Exceptions =========================== .. index:: Interfacing to C++ @@ -5874,13 +5914,33 @@ Syntax: pragma Short_Circuit_And_Or; -This configuration pragma causes any occurrence of the AND operator applied to -operands of type Standard.Boolean to be short-circuited (i.e. the AND operator -is treated as if it were AND THEN). Or is similarly treated as OR ELSE. This -may be useful in the context of certification protocols requiring the use of -short-circuited logical operators. If this configuration pragma occurs locally -within the file being compiled, it applies only to the file being compiled. +This configuration pragma causes the predefined AND and OR operators of +type Standard.Boolean to have short-circuit semantics. That is, they +behave like AND THEN and OR ELSE; the right-hand side is not evaluated +if the left-hand side determines the result. This may be useful in the +context of certification protocols requiring the use of short-circuited +logical operators. + There is no requirement that all units in a partition use this option. +However, mixing of short-circuit and non-short-circuit semantics can be +confusing. Therefore, the recommended use is to put the pragma in a +configuration file that applies to the whole program. Alternatively, if +you have a legacy library that should not use this pragma, you can put +it in a separate library project that does not use the pragma. +In any case, fine-grained mixing of the different semantics is not +recommended. If pragma ``Short_Circuit_And_Or`` is specified, then it +is illegal to rename the predefined Boolean AND and OR, or to pass +them to generic formal functions; this corresponds to the fact that +AND THEN and OR ELSE cannot be renamed nor passed as generic formal +functions. + +Note that this pragma has no effect on other logical operators -- +predefined operators of modular types, array-of-boolean types and types +derived from Standard.Boolean, nor user-defined operators. + +See also the pragma ``Unevaluated_Use_Of_Old`` and the restriction +``No_Direct_Boolean_Operators``, which may be useful in conjunction +with ``Short_Circuit_And_Or``. Pragma Short_Descriptors ======================== diff --git a/gcc/ada/doc/gnat_rm/implementation_of_ada_2012_features.rst b/gcc/ada/doc/gnat_rm/implementation_of_ada_2012_features.rst deleted file mode 100644 index 9708e15..0000000 --- a/gcc/ada/doc/gnat_rm/implementation_of_ada_2012_features.rst +++ /dev/null @@ -1,1330 +0,0 @@ -.. _Implementation_of_Ada_2012_Features: - -*********************************** -Implementation of Ada 2012 Features -*********************************** - -.. index:: Ada 2012 implementation status - -.. index:: -gnat12 option (gcc) - -.. index:: pragma Ada_2012 - -.. index:: configuration pragma Ada_2012 - -.. index:: Ada_2012 configuration pragma - -This chapter contains a complete list of Ada 2012 features that have been -implemented. -Generally, these features are only -available if the *-gnat12* (Ada 2012 features enabled) option is set, -which is the default behavior, -or if the configuration pragma ``Ada_2012`` is used. - -However, new pragmas, attributes, and restrictions are -unconditionally available, since the Ada 95 standard allows the addition of -new pragmas, attributes, and restrictions (there are exceptions, which are -documented in the individual descriptions), and also certain packages -were made available in earlier versions of Ada. - -An ISO date (YYYY-MM-DD) appears in parentheses on the description line. -This date shows the implementation date of the feature. Any wavefront -subsequent to this date will contain the indicated feature, as will any -subsequent releases. A date of 0000-00-00 means that GNAT has always -implemented the feature, or implemented it as soon as it appeared as a -binding interpretation. - -Each feature corresponds to an Ada Issue ('AI') approved by the Ada -standardization group (ISO/IEC JTC1/SC22/WG9) for inclusion in Ada 2012. -The features are ordered based on the relevant sections of the Ada -Reference Manual ("RM"). When a given AI relates to multiple points -in the RM, the earliest is used. - -A complete description of the AIs may be found in -http://www.ada-auth.org/ai05-summary.html. - -.. index:: AI-0002 (Ada 2012 feature) - -* *AI-0002 Export C with unconstrained arrays (0000-00-00)* - - The compiler is not required to support exporting an Ada subprogram with - convention C if there are parameters or a return type of an unconstrained - array type (such as ``String``). GNAT allows such declarations but - generates warnings. It is possible, but complicated, to write the - corresponding C code and certainly such code would be specific to GNAT and - non-portable. - - RM References: B.01 (17) B.03 (62) B.03 (71.1/2) - -.. index:: AI-0003 (Ada 2012 feature) - -* *AI-0003 Qualified expressions as names (2010-07-11)* - - In Ada 2012, a qualified expression is considered to be syntactically a name, - meaning that constructs such as ``A'(F(X)).B`` are now legal. This is - useful in disambiguating some cases of overloading. - - RM References: 3.03 (11) 3.03 (21) 4.01 (2) 4.04 (7) 4.07 (3) - 5.04 (7) - -.. index:: AI-0007 (Ada 2012 feature) - -* *AI-0007 Stream read and private scalar types (0000-00-00)* - - The RM as written appeared to limit the possibilities of declaring read - attribute procedures for private scalar types. This limitation was not - intended, and has never been enforced by GNAT. - - RM References: 13.13.02 (50/2) 13.13.02 (51/2) - -.. index:: AI-0008 (Ada 2012 feature) - -* *AI-0008 General access to constrained objects (0000-00-00)* - - The wording in the RM implied that if you have a general access to a - constrained object, it could be used to modify the discriminants. This was - obviously not intended. ``Constraint_Error`` should be raised, and GNAT - has always done so in this situation. - - RM References: 3.03 (23) 3.10.02 (26/2) 4.01 (9) 6.04.01 (17) 8.05.01 (5/2) - -.. index:: AI-0009 (Ada 2012 feature) - -* *AI-0009 Pragma Independent[_Components] (2010-07-23)* - - This AI introduces the new pragmas ``Independent`` and - ``Independent_Components``, - which control guaranteeing independence of access to objects and components. - The AI also requires independence not unaffected by confirming rep clauses. - - RM References: 9.10 (1) 13.01 (15/1) 13.02 (9) 13.03 (13) C.06 (2) - C.06 (4) C.06 (6) C.06 (9) C.06 (13) C.06 (14) - -.. index:: AI-0012 (Ada 2012 feature) - -* *AI-0012 Pack/Component_Size for aliased/atomic (2010-07-15)* - - It is now illegal to give an inappropriate component size or a pragma - ``Pack`` that attempts to change the component size in the case of atomic - or aliased components. Previously GNAT ignored such an attempt with a - warning. - - RM References: 13.02 (6.1/2) 13.02 (7) C.06 (10) C.06 (11) C.06 (21) - -.. index:: AI-0015 (Ada 2012 feature) - -* *AI-0015 Constant return objects (0000-00-00)* - - The return object declared in an *extended_return_statement* may be - declared constant. This was always intended, and GNAT has always allowed it. - - RM References: 6.05 (2.1/2) 3.03 (10/2) 3.03 (21) 6.05 (5/2) - 6.05 (5.7/2) - -.. index:: AI-0017 (Ada 2012 feature) - -* *AI-0017 Freezing and incomplete types (0000-00-00)* - - So-called 'Taft-amendment types' (i.e., types that are completed in package - bodies) are not frozen by the occurrence of bodies in the - enclosing declarative part. GNAT always implemented this properly. - - RM References: 13.14 (3/1) - -.. index:: AI-0019 (Ada 2012 feature) - -* *AI-0019 Freezing of primitives for tagged types (0000-00-00)* - - The RM suggests that primitive subprograms of a specific tagged type are - frozen when the tagged type is frozen. This would be an incompatible change - and is not intended. GNAT has never attempted this kind of freezing and its - behavior is consistent with the recommendation of this AI. - - 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) - -.. index:: AI-0026 (Ada 2012 feature) - -* *AI-0026 Missing rules for Unchecked_Union (2010-07-07)* - - Record representation clauses concerning Unchecked_Union types cannot mention - the discriminant of the type. The type of a component declared in the variant - part of an Unchecked_Union cannot be controlled, have controlled components, - nor have protected or task parts. If an Unchecked_Union type is declared - within the body of a generic unit or its descendants, then the type of a - component declared in the variant part cannot be a formal private type or a - formal private extension declared within the same generic unit. - - RM References: 7.06 (9.4/2) B.03.03 (9/2) B.03.03 (10/2) - -.. index:: AI-0030 (Ada 2012 feature) - -* *AI-0030 Requeue on synchronized interfaces (2010-07-19)* - - Requeue is permitted to a protected, synchronized or task interface primitive - providing it is known that the overriding operation is an entry. Otherwise - the requeue statement has the same effect as a procedure call. Use of pragma - ``Implemented`` provides a way to impose a static requirement on the - overriding operation by adhering to one of the implementation kinds: entry, - protected procedure or any of the above. - - RM References: 9.05 (9) 9.05.04 (2) 9.05.04 (3) 9.05.04 (5) - 9.05.04 (6) 9.05.04 (7) 9.05.04 (12) - -.. index:: AI-0031 (Ada 2012 feature) - -* *AI-0031 Add From parameter to Find_Token (2010-07-25)* - - A new version of ``Find_Token`` is added to all relevant string packages, - with an extra parameter ``From``. Instead of starting at the first - character of the string, the search for a matching Token starts at the - character indexed by the value of ``From``. - These procedures are available in all versions of Ada - but if used in versions earlier than Ada 2012 they will generate a warning - that an Ada 2012 subprogram is being used. - - RM References: A.04.03 (16) A.04.03 (67) A.04.03 (68/1) A.04.04 (51) - A.04.05 (46) - -.. index:: AI-0032 (Ada 2012 feature) - -* *AI-0032 Extended return for class-wide functions (0000-00-00)* - - If a function returns a class-wide type, the object of an extended return - statement can be declared with a specific type that is covered by the class- - wide type. This has been implemented in GNAT since the introduction of - extended returns. Note AI-0103 complements this AI by imposing matching - rules for constrained return types. - - RM References: 6.05 (5.2/2) 6.05 (5.3/2) 6.05 (5.6/2) 6.05 (5.8/2) - 6.05 (8/2) - -.. index:: AI-0033 (Ada 2012 feature) - -* *AI-0033 Attach/Interrupt_Handler in generic (2010-07-24)* - - Neither of these two pragmas may appear within a generic template, because - the generic might be instantiated at other than the library level. - - RM References: 13.11.02 (16) C.03.01 (7/2) C.03.01 (8/2) - -.. index:: AI-0034 (Ada 2012 feature) - -* *AI-0034 Categorization of limited views (0000-00-00)* - - The RM makes certain limited with clauses illegal because of categorization - considerations, when the corresponding normal with would be legal. This is - not intended, and GNAT has always implemented the recommended behavior. - - RM References: 10.02.01 (11/1) 10.02.01 (17/2) - -.. index:: AI-0035 (Ada 2012 feature) - -* *AI-0035 Inconsistencies with Pure units (0000-00-00)* - - This AI remedies some inconsistencies in the legality rules for Pure units. - Derived access types are legal in a pure unit (on the assumption that the - rule for a zero storage pool size has been enforced on the ancestor type). - The rules are enforced in generic instances and in subunits. GNAT has always - implemented the recommended behavior. - - 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) - -.. index:: AI-0037 (Ada 2012 feature) - -* *AI-0037 Out-of-range box associations in aggregate (0000-00-00)* - - This AI confirms that an association of the form ``Indx => <>`` in an - array aggregate must raise ``Constraint_Error`` if ``Indx`` - is out of range. The RM specified a range check on other associations, but - not when the value of the association was defaulted. GNAT has always inserted - a constraint check on the index value. - - RM References: 4.03.03 (29) - -.. index:: AI-0038 (Ada 2012 feature) - -* *AI-0038 Minor errors in Text_IO (0000-00-00)* - - These are minor errors in the description on three points. The intent on - all these points has always been clear, and GNAT has always implemented the - correct intended semantics. - - 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) - -.. index:: AI-0039 (Ada 2012 feature) - -* *AI-0039 Stream attributes cannot be dynamic (0000-00-00)* - - The RM permitted the use of dynamic expressions (such as ``ptr.all``) - for stream attributes, but these were never useful and are now illegal. GNAT - has always regarded such expressions as illegal. - - RM References: 13.03 (4) 13.03 (6) 13.13.02 (38/2) - -.. index:: AI-0040 (Ada 2012 feature) - -* *AI-0040 Limited with clauses on descendant (0000-00-00)* - - This AI confirms that a limited with clause in a child unit cannot name - an ancestor of the unit. This has always been checked in GNAT. - - RM References: 10.01.02 (20/2) - -.. index:: AI-0042 (Ada 2012 feature) - -* *AI-0042 Overriding versus implemented-by (0000-00-00)* - - This AI fixes a wording gap in the RM. An operation of a synchronized - interface can be implemented by a protected or task entry, but the abstract - operation is not being overridden in the usual sense, and it must be stated - separately that this implementation is legal. This has always been the case - in GNAT. - - RM References: 9.01 (9.2/2) 9.04 (11.1/2) - -.. index:: AI-0043 (Ada 2012 feature) - -* *AI-0043 Rules about raising exceptions (0000-00-00)* - - This AI covers various omissions in the RM regarding the raising of - exceptions. GNAT has always implemented the intended semantics. - - RM References: 11.04.01 (10.1/2) 11 (2) - -.. index:: AI-0044 (Ada 2012 feature) - -* *AI-0044 Restrictions on container instantiations (0000-00-00)* - - This AI places restrictions on allowed instantiations of generic containers. - These restrictions are not checked by the compiler, so there is nothing to - change in the implementation. This affects only the RM documentation. - - 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) - -.. index:: AI-0046 (Ada 2012 feature) - -* *AI-0046 Null exclusion match for full conformance (2010-07-17)* - - For full conformance, in the case of access parameters, the null exclusion - must match (either both or neither must have ``not null``). - - RM References: 6.03.02 (18) - -.. index:: AI-0050 (Ada 2012 feature) - -* *AI-0050 Raising Constraint_Error early for function call (0000-00-00)* - - The implementation permissions for raising ``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 - not take advantage of these incorrect permissions in any case. - - RM References: 6.05 (24/2) - -.. index:: AI-0056 (Ada 2012 feature) - -* *AI-0056 Index on null string returns zero (0000-00-00)* - - The wording in the Ada 2005 RM implied an incompatible handling of the - ``Index`` functions, resulting in raising an exception instead of - returning zero in some situations. - This was not intended and has been corrected. - GNAT always returned zero, and is thus consistent with this AI. - - RM References: A.04.03 (56.2/2) A.04.03 (58.5/2) - -.. index:: AI-0058 (Ada 2012 feature) - -* *AI-0058 Abnormal completion of an extended return (0000-00-00)* - - The RM had some incorrect wording implying wrong treatment of abnormal - completion in an extended return. GNAT has always implemented the intended - correct semantics as described by this AI. - - RM References: 6.05 (22/2) - -.. index:: AI-0060 (Ada 2012 feature) - -* *AI-0060 Extended definition of remote access types (0000-00-00)* - - This AI extends the definition of remote access types to include access - to limited, synchronized, protected or task class-wide interface types. - GNAT already implemented this extension. - - RM References: A (4) E.02.02 (9/1) E.02.02 (9.2/1) E.02.02 (14/2) E.02.02 (18) - -.. index:: AI-0062 (Ada 2012 feature) - -* *AI-0062 Null exclusions and deferred constants (0000-00-00)* - - A full constant may have a null exclusion even if its associated deferred - constant does not. GNAT has always allowed this. - - RM References: 7.04 (6/2) 7.04 (7.1/2) - -.. index:: AI-0064 (Ada 2012 feature) - -* *AI-0064 Redundant finalization rule (0000-00-00)* - - This is an editorial change only. The intended behavior is already checked - by an existing ACATS test, which GNAT has always executed correctly. - - RM References: 7.06.01 (17.1/1) - -.. index:: AI-0065 (Ada 2012 feature) - -* *AI-0065 Remote access types and external streaming (0000-00-00)* - - This AI clarifies the fact that all remote access types support external - streaming. This fixes an obvious oversight in the definition of the - language, and GNAT always implemented the intended correct rules. - - RM References: 13.13.02 (52/2) - -.. index:: AI-0070 (Ada 2012 feature) - -* *AI-0070 Elaboration of interface types (0000-00-00)* - - This is an editorial change only, there are no testable consequences short of - checking for the absence of generated code for an interface declaration. - - RM References: 3.09.04 (18/2) - -.. index:: AI-0072 (Ada 2012 feature) - -* *AI-0072 Task signalling using 'Terminated (0000-00-00)* - - This AI clarifies that task signalling for reading ``'Terminated`` only - occurs if the result is True. GNAT semantics has always been consistent with - this notion of task signalling. - - RM References: 9.10 (6.1/1) - -.. index:: AI-0073 (Ada 2012 feature) - -* *AI-0073 Functions returning abstract types (2010-07-10)* - - This AI covers a number of issues regarding returning abstract types. In - particular generic functions cannot have abstract result types or access - result types designated an abstract type. There are some other cases which - are detailed in the AI. Note that this binding interpretation has not been - retrofitted to operate before Ada 2012 mode, since it caused a significant - number of regressions. - - RM References: 3.09.03 (8) 3.09.03 (10) 6.05 (8/2) - -.. index:: AI-0076 (Ada 2012 feature) - -* *AI-0076 function with controlling result (0000-00-00)* - - This is an editorial change only. The RM defines calls with controlling - results, but uses the term 'function with controlling result' without an - explicit definition. - - RM References: 3.09.02 (2/2) - -.. index:: AI-0077 (Ada 2012 feature) - -* *AI-0077 Limited withs and scope of declarations (0000-00-00)* - - This AI clarifies that a declaration does not include a context clause, - and confirms that it is illegal to have a context in which both a limited - and a nonlimited view of a package are accessible. Such double visibility - was always rejected by GNAT. - - RM References: 10.01.02 (12/2) 10.01.02 (21/2) 10.01.02 (22/2) - -.. index:: AI-0078 (Ada 2012 feature) - -* *AI-0078 Relax Unchecked_Conversion alignment rules (0000-00-00)* - - In Ada 2012, compilers are required to support unchecked conversion where the - target alignment is a multiple of the source alignment. GNAT always supported - this case (and indeed all cases of differing alignments, doing copies where - required if the alignment was reduced). - - RM References: 13.09 (7) - -.. index:: AI-0079 (Ada 2012 feature) - -* *AI-0079 Allow other_format characters in source (2010-07-10)* - - Wide characters in the unicode category *other_format* are now allowed in - source programs between tokens, but not within a token such as an identifier. - - RM References: 2.01 (4/2) 2.02 (7) - -.. index:: AI-0080 (Ada 2012 feature) - -* *AI-0080 'View of' not needed if clear from context (0000-00-00)* - - This is an editorial change only, described as non-testable in the AI. - - RM References: 3.01 (7) - -.. index:: AI-0087 (Ada 2012 feature) - -* *AI-0087 Actual for formal nonlimited derived type (2010-07-15)* - - The actual for a formal nonlimited derived type cannot be limited. In - particular, a formal derived type that extends a limited interface but which - is not explicitly limited cannot be instantiated with a limited type. - - RM References: 7.05 (5/2) 12.05.01 (5.1/2) - -.. index:: AI-0088 (Ada 2012 feature) - -* *AI-0088 The value of exponentiation (0000-00-00)* - - This AI clarifies the equivalence rule given for the dynamic semantics of - exponentiation: the value of the operation can be obtained by repeated - multiplication, but the operation can be implemented otherwise (for example - using the familiar divide-by-two-and-square algorithm, even if this is less - accurate), and does not imply repeated reads of a volatile base. - - RM References: 4.05.06 (11) - -.. index:: AI-0091 (Ada 2012 feature) - -* *AI-0091 Do not allow other_format in identifiers (0000-00-00)* - - Wide characters in the unicode category *other_format* are not permitted - within an identifier, since this can be a security problem. The error - message for this case has been improved to be more specific, but GNAT has - never allowed such characters to appear in identifiers. - - 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) - -.. index:: AI-0093 (Ada 2012 feature) - -* *AI-0093 Additional rules use immutably limited (0000-00-00)* - - This is an editorial change only, to make more widespread use of the Ada 2012 - 'immutably limited'. - - RM References: 3.03 (23.4/3) - -.. index:: AI-0095 (Ada 2012 feature) - -* *AI-0095 Address of intrinsic subprograms (0000-00-00)* - - The prefix of ``'Address`` cannot statically denote a subprogram with - convention ``Intrinsic``. The use of the ``Address`` attribute raises - ``Program_Error`` if the prefix denotes a subprogram with convention - ``Intrinsic``. - - RM References: 13.03 (11/1) - -.. index:: AI-0096 (Ada 2012 feature) - -* *AI-0096 Deriving from formal private types (2010-07-20)* - - In general it is illegal for a type derived from a formal limited type to be - nonlimited. This AI makes an exception to this rule: derivation is legal - if it appears in the private part of the generic, and the formal type is not - tagged. If the type is tagged, the legality check must be applied to the - private part of the package. - - RM References: 3.04 (5.1/2) 6.02 (7) - -.. index:: AI-0097 (Ada 2012 feature) - -* *AI-0097 Treatment of abstract null extension (2010-07-19)* - - The RM as written implied that in some cases it was possible to create an - object of an abstract type, by having an abstract extension inherit a non- - abstract constructor from its parent type. This mistake has been corrected - in GNAT and in the RM, and this construct is now illegal. - - RM References: 3.09.03 (4/2) - -.. index:: AI-0098 (Ada 2012 feature) - -* *AI-0098 Anonymous subprogram access restrictions (0000-00-00)* - - An unintentional omission in the RM implied some inconsistent restrictions on - the use of anonymous access to subprogram values. These restrictions were not - intentional, and have never been enforced by GNAT. - - RM References: 3.10.01 (6) 3.10.01 (9.2/2) - -.. index:: AI-0099 (Ada 2012 feature) - -* *AI-0099 Tag determines whether finalization needed (0000-00-00)* - - This AI clarifies that 'needs finalization' is part of dynamic semantics, - and therefore depends on the run-time characteristics of an object (i.e. its - tag) and not on its nominal type. As the AI indicates: "we do not expect - this to affect any implementation". - - RM References: 7.06.01 (6) 7.06.01 (7) 7.06.01 (8) 7.06.01 (9/2) - -.. index:: AI-0100 (Ada 2012 feature) - -* *AI-0100 Placement of pragmas (2010-07-01)* - - This AI is an earlier version of AI-163. It simplifies the rules - for legal placement of pragmas. In the case of lists that allow pragmas, if - the list may have no elements, then the list may consist solely of pragmas. - - RM References: 2.08 (7) - -.. index:: AI-0102 (Ada 2012 feature) - -* *AI-0102 Some implicit conversions are illegal (0000-00-00)* - - It is illegal to assign an anonymous access constant to an anonymous access - variable. The RM did not have a clear rule to prevent this, but GNAT has - always generated an error for this usage. - - RM References: 3.07 (16) 3.07.01 (9) 6.04.01 (6) 8.06 (27/2) - -.. index:: AI-0103 (Ada 2012 feature) - -* *AI-0103 Static matching for extended return (2010-07-23)* - - If the return subtype of a function is an elementary type or a constrained - type, the subtype indication in an extended return statement must match - statically this return subtype. - - RM References: 6.05 (5.2/2) - -.. index:: AI-0104 (Ada 2012 feature) - -* *AI-0104 Null exclusion and uninitialized allocator (2010-07-15)* - - The assignment ``Ptr := new not null Some_Ptr;`` will raise - ``Constraint_Error`` because the default value of the allocated object is - **null**. This useless construct is illegal in Ada 2012. - - RM References: 4.08 (2) - -.. index:: AI-0106 (Ada 2012 feature) - -* *AI-0106 No representation pragmas on generic formals (0000-00-00)* - - The RM appeared to allow representation pragmas on generic formal parameters, - but this was not intended, and GNAT has never permitted this usage. - - RM References: 13.01 (9.1/1) - -.. index:: AI-0108 (Ada 2012 feature) - -* *AI-0108 Limited incomplete view and discriminants (0000-00-00)* - - This AI confirms that an incomplete type from a limited view does not have - discriminants. This has always been the case in GNAT. - - RM References: 10.01.01 (12.3/2) - -.. index:: AI-0109 (Ada 2012 feature) - -* *AI-0109 Redundant check in S'Class'Input (0000-00-00)* - - This AI is an editorial change only. It removes the need for a tag check - that can never fail. - - RM References: 13.13.02 (34/2) - -.. index:: AI-0112 (Ada 2012 feature) - -* *AI-0112 Detection of duplicate pragmas (2010-07-24)* - - This AI concerns giving names to various representation aspects, but the - practical effect is simply to make the use of duplicate - ``Atomic[_Components]``, - ``Volatile[_Components]``, and - ``Independent[_Components]`` pragmas illegal, and GNAT - now performs this required check. - - RM References: 13.01 (8) - -.. index:: AI-0114 (Ada 2012 feature) - -* *AI-0114 Classification of letters (0000-00-00)* - - The code points 170 (``FEMININE ORDINAL INDICATOR``), - 181 (``MICRO SIGN``), and - 186 (``MASCULINE ORDINAL INDICATOR``) are technically considered - lower case letters by Unicode. - However, they are not allowed in identifiers, and they - return ``False`` to ``Ada.Characters.Handling.Is_Letter/Is_Lower``. - This behavior is consistent with that defined in Ada 95. - - RM References: A.03.02 (59) A.04.06 (7) - -.. index:: AI-0116 (Ada 2012 feature) - -* *AI-0116 Alignment of class-wide objects (0000-00-00)* - - This AI requires that the alignment of a class-wide object be no greater - than the alignment of any type in the class. GNAT has always followed this - recommendation. - - RM References: 13.03 (29) 13.11 (16) - -.. index:: AI-0118 (Ada 2012 feature) - -* *AI-0118 The association of parameter associations (0000-00-00)* - - This AI clarifies the rules for named associations in subprogram calls and - generic instantiations. The rules have been in place since Ada 83. - - RM References: 6.04.01 (2) 12.03 (9) - -.. index:: AI-0120 (Ada 2012 feature) - -* *AI-0120 Constant instance of protected object (0000-00-00)* - - This is an RM editorial change only. The section that lists objects that are - constant failed to include the current instance of a protected object - within a protected function. This has always been treated as a constant - in GNAT. - - RM References: 3.03 (21) - -.. index:: AI-0122 (Ada 2012 feature) - -* *AI-0122 Private with and children of generics (0000-00-00)* - - This AI clarifies the visibility of private children of generic units within - instantiations of a parent. GNAT has always handled this correctly. - - RM References: 10.01.02 (12/2) - -.. index:: AI-0123 (Ada 2012 feature) - -* *AI-0123 Composability of equality (2010-04-13)* - - Equality of untagged record composes, so that the predefined equality for a - composite type that includes a component of some untagged record type - ``R`` uses the equality operation of ``R`` (which may be user-defined - or predefined). This makes the behavior of untagged records identical to that - of tagged types in this respect. - - This change is an incompatibility with previous versions of Ada, but it - corrects a non-uniformity that was often a source of confusion. Analysis of - a large number of industrial programs indicates that in those rare cases - where a composite type had an untagged record component with a user-defined - equality, either there was no use of the composite equality, or else the code - expected the same composability as for tagged types, and thus had a bug that - would be fixed by this change. - - RM References: 4.05.02 (9.7/2) 4.05.02 (14) 4.05.02 (15) 4.05.02 (24) - 8.05.04 (8) - -.. index:: AI-0125 (Ada 2012 feature) - -* *AI-0125 Nonoverridable operations of an ancestor (2010-09-28)* - - In Ada 2012, the declaration of a primitive operation of a type extension - or private extension can also override an inherited primitive that is not - visible at the point of this declaration. - - RM References: 7.03.01 (6) 8.03 (23) 8.03.01 (5/2) 8.03.01 (6/2) - -.. index:: AI-0126 (Ada 2012 feature) - -* *AI-0126 Dispatching with no declared operation (0000-00-00)* - - This AI clarifies dispatching rules, and simply confirms that dispatching - executes the operation of the parent type when there is no explicitly or - implicitly declared operation for the descendant type. This has always been - the case in all versions of GNAT. - - RM References: 3.09.02 (20/2) 3.09.02 (20.1/2) 3.09.02 (20.2/2) - -.. index:: AI-0127 (Ada 2012 feature) - -* *AI-0127 Adding Locale Capabilities (2010-09-29)* - - This package provides an interface for identifying the current locale. - - RM References: A.19 A.19.01 A.19.02 A.19.03 A.19.05 A.19.06 - A.19.07 A.19.08 A.19.09 A.19.10 A.19.11 A.19.12 A.19.13 - -.. index:: AI-0128 (Ada 2012 feature) - -* *AI-0128 Inequality is a primitive operation (0000-00-00)* - - If an equality operator ("=") is declared for a type, then the implicitly - declared inequality operator ("/=") is a primitive operation of the type. - This is the only reasonable interpretation, and is the one always implemented - by GNAT, but the RM was not entirely clear in making this point. - - RM References: 3.02.03 (6) 6.06 (6) - -.. index:: AI-0129 (Ada 2012 feature) - -* *AI-0129 Limited views and incomplete types (0000-00-00)* - - This AI clarifies the description of limited views: a limited view of a - package includes only one view of a type that has an incomplete declaration - and a full declaration (there is no possible ambiguity in a client package). - This AI also fixes an omission: a nested package in the private part has no - limited view. GNAT always implemented this correctly. - - RM References: 10.01.01 (12.2/2) 10.01.01 (12.3/2) - -.. index:: AI-0132 (Ada 2012 feature) - -* *AI-0132 Placement of library unit pragmas (0000-00-00)* - - This AI fills a gap in the description of library unit pragmas. The pragma - clearly must apply to a library unit, even if it does not carry the name - of the enclosing unit. GNAT has always enforced the required check. - - RM References: 10.01.05 (7) - -.. index:: AI-0134 (Ada 2012 feature) - -* *AI-0134 Profiles must match for full conformance (0000-00-00)* - - For full conformance, the profiles of anonymous-access-to-subprogram - parameters must match. GNAT has always enforced this rule. - - RM References: 6.03.01 (18) - -.. index:: AI-0137 (Ada 2012 feature) - -* *AI-0137 String encoding package (2010-03-25)* - - The packages ``Ada.Strings.UTF_Encoding``, together with its child - packages, ``Conversions``, ``Strings``, ``Wide_Strings``, - and ``Wide_Wide_Strings`` have been - implemented. These packages (whose documentation can be found in the spec - files :file:`a-stuten.ads`, :file:`a-suenco.ads`, :file:`a-suenst.ads`, - :file:`a-suewst.ads`, :file:`a-suezst.ads`) allow encoding and decoding of - ``String``, ``Wide_String``, and ``Wide_Wide_String`` - values using UTF coding schemes (including UTF-8, UTF-16LE, UTF-16BE, and - UTF-16), as well as conversions between the different UTF encodings. With - the exception of ``Wide_Wide_Strings``, these packages are available in - Ada 95 and Ada 2005 mode as well as Ada 2012 mode. - The ``Wide_Wide_Strings`` package - is available in Ada 2005 mode as well as Ada 2012 mode (but not in Ada 95 - mode since it uses ``Wide_Wide_Character``). - - RM References: A.04.11 - -.. index:: AI-0139-2 (Ada 2012 feature) - -* *AI-0139-2 Syntactic sugar for iterators (2010-09-29)* - - The new syntax for iterating over arrays and containers is now implemented. - Iteration over containers is for now limited to read-only iterators. Only - default iterators are supported, with the syntax: ``for Elem of C``. - - RM References: 5.05 - -.. index:: AI-0146 (Ada 2012 feature) - -* *AI-0146 Type invariants (2009-09-21)* - - Type invariants may be specified for private types using the aspect notation. - Aspect ``Type_Invariant`` may be specified for any private type, - ``Type_Invariant'Class`` can - only be specified for tagged types, and is inherited by any descendent of the - tagged types. The invariant is a boolean expression that is tested for being - true in the following situations: conversions to the private type, object - declarations for the private type that are default initialized, and - [**in**] **out** - parameters and returned result on return from any primitive operation for - the type that is visible to a client. - GNAT defines the synonyms ``Invariant`` for ``Type_Invariant`` and - ``Invariant'Class`` for ``Type_Invariant'Class``. - - RM References: 13.03.03 (00) - -.. index:: AI-0147 (Ada 2012 feature) - -* *AI-0147 Conditional expressions (2009-03-29)* - - Conditional expressions are permitted. The form of such an expression is: - - :: - - (if expr then expr {elsif expr then expr} [else expr]) - - The parentheses can be omitted in contexts where parentheses are present - anyway, such as subprogram arguments and pragma arguments. If the **else** - clause is omitted, **else** *True* is assumed; - thus ``(if A then B)`` is a way to conveniently represent - *(A implies B)* in standard logic. - - RM References: 4.03.03 (15) 4.04 (1) 4.04 (7) 4.05.07 (0) 4.07 (2) - 4.07 (3) 4.09 (12) 4.09 (33) 5.03 (3) 5.03 (4) 7.05 (2.1/2) - -.. index:: AI-0152 (Ada 2012 feature) - -* *AI-0152 Restriction No_Anonymous_Allocators (2010-09-08)* - - Restriction ``No_Anonymous_Allocators`` prevents the use of allocators - where the type of the returned value is an anonymous access type. - - RM References: H.04 (8/1) - -.. index:: AI-0157 (Ada 2012 feature) - -* *AI-0157 Allocation/Deallocation from empty pool (2010-07-11)* - - Allocation and Deallocation from an empty storage pool (i.e. allocation or - deallocation of a pointer for which a static storage size clause of zero - has been given) is now illegal and is detected as such. GNAT - previously gave a warning but not an error. - - RM References: 4.08 (5.3/2) 13.11.02 (4) 13.11.02 (17) - -.. index:: AI-0158 (Ada 2012 feature) - -* *AI-0158 Generalizing membership tests (2010-09-16)* - - This AI extends the syntax of membership tests to simplify complex conditions - that can be expressed as membership in a subset of values of any type. It - introduces syntax for a list of expressions that may be used in loop contexts - as well. - - RM References: 3.08.01 (5) 4.04 (3) 4.05.02 (3) 4.05.02 (5) 4.05.02 (27) - -.. index:: AI-0161 (Ada 2012 feature) - -* *AI-0161 Restriction No_Default_Stream_Attributes (2010-09-11)* - - A new restriction ``No_Default_Stream_Attributes`` prevents the use of any - of the default stream attributes for elementary types. If this restriction is - in force, then it is necessary to provide explicit subprograms for any - stream attributes used. - - RM References: 13.12.01 (4/2) 13.13.02 (40/2) 13.13.02 (52/2) - -.. index:: AI-0162 (Ada 2012 feature) - -* *AI-0162 Incomplete type completed by partial view (2010-09-15)* - - Incomplete types are made more useful by allowing them to be completed by - private types and private extensions. - - RM References: 3.10.01 (2.5/2) 3.10.01 (2.6/2) 3.10.01 (3) 3.10.01 (4/2) - -.. index:: AI-0163 (Ada 2012 feature) - -* *AI-0163 Pragmas in place of null (2010-07-01)* - - A statement sequence may be composed entirely of pragmas. It is no longer - necessary to add a dummy ``null`` statement to make the sequence legal. - - RM References: 2.08 (7) 2.08 (16) - -.. index:: AI-0171 (Ada 2012 feature) - -* *AI-0171 Pragma CPU and Ravenscar Profile (2010-09-24)* - - A new package ``System.Multiprocessors`` is added, together with the - definition of pragma ``CPU`` for controlling task affinity. A new no - dependence restriction, on ``System.Multiprocessors.Dispatching_Domains``, - is added to the Ravenscar profile. - - RM References: D.13.01 (4/2) D.16 - -.. index:: AI-0173 (Ada 2012 feature) - -* *AI-0173 Testing if tags represent abstract types (2010-07-03)* - - The function ``Ada.Tags.Type_Is_Abstract`` returns ``True`` if invoked - with the tag of an abstract type, and ``False`` otherwise. - - RM References: 3.09 (7.4/2) 3.09 (12.4/2) - -.. index:: AI-0176 (Ada 2012 feature) - -* *AI-0176 Quantified expressions (2010-09-29)* - - Both universally and existentially quantified expressions are implemented. - They use the new syntax for iterators proposed in AI05-139-2, as well as - the standard Ada loop syntax. - - RM References: 1.01.04 (12) 2.09 (2/2) 4.04 (7) 4.05.09 (0) - -.. index:: AI-0177 (Ada 2012 feature) - -* *AI-0177 Parameterized expressions (2010-07-10)* - - The new Ada 2012 notion of parameterized expressions is implemented. The form - is: - - .. code-block:: ada - - function-specification is (expression) - - This is exactly equivalent to the - corresponding function body that returns the expression, but it can appear - in a package spec. Note that the expression must be parenthesized. - - RM References: 13.11.01 (3/2) - -.. index:: AI-0178 (Ada 2012 feature) - -* *AI-0178 Incomplete views are limited (0000-00-00)* - - This AI clarifies the role of incomplete views and plugs an omission in the - RM. GNAT always correctly restricted the use of incomplete views and types. - - RM References: 7.05 (3/2) 7.05 (6/2) - -.. index:: AI-0179 (Ada 2012 feature) - -* *AI-0179 Statement not required after label (2010-04-10)* - - It is not necessary to have a statement following a label, so a label - can appear at the end of a statement sequence without the need for putting a - null statement afterwards, but it is not allowable to have only labels and - no real statements in a statement sequence. - - RM References: 5.01 (2) - -.. index:: AI-0181 (Ada 2012 feature) - -* *AI-0181 Soft hyphen is a non-graphic character (2010-07-23)* - - From Ada 2005 on, soft hyphen is considered a non-graphic character, which - means that it has a special name (``SOFT_HYPHEN``) in conjunction with the - ``Image`` and ``Value`` attributes for the character types. Strictly - speaking this is an inconsistency with Ada 95, but in practice the use of - these attributes is so obscure that it will not cause problems. - - RM References: 3.05.02 (2/2) A.01 (35/2) A.03.03 (21) - -.. index:: AI-0182 (Ada 2012 feature) - -* *AI-0182 Additional forms for* ``Character'Value`` *(0000-00-00)* - - This AI allows ``Character'Value`` to accept the string ``'?'`` where - ``?`` is any character including non-graphic control characters. GNAT has - always accepted such strings. It also allows strings such as - ``HEX_00000041`` to be accepted, but GNAT does not take advantage of this - permission and raises ``Constraint_Error``, as is certainly still - permitted. - - RM References: 3.05 (56/2) - -.. index:: AI-0183 (Ada 2012 feature) - -* *AI-0183 Aspect specifications (2010-08-16)* - - Aspect specifications have been fully implemented except for pre and post- - conditions, and type invariants, which have their own separate AI's. All - forms of declarations listed in the AI are supported. The following is a - list of the aspects supported (with GNAT implementation aspects marked) - -==================================== =========== -Supported Aspect Source -==================================== =========== - ``Ada_2005`` -- GNAT - ``Ada_2012`` -- GNAT - ``Address`` - ``Alignment`` - ``Atomic`` - ``Atomic_Components`` - ``Bit_Order`` - ``Component_Size`` - ``Contract_Cases`` -- GNAT - ``Discard_Names`` - ``External_Tag`` - ``Favor_Top_Level`` -- GNAT - ``Inline`` - ``Inline_Always`` -- GNAT - ``Invariant`` -- GNAT - ``Machine_Radix`` - ``No_Return`` - ``Object_Size`` -- GNAT - ``Pack`` - ``Persistent_BSS`` -- GNAT - ``Post`` - ``Pre`` - ``Predicate`` - ``Preelaborable_Initialization`` - ``Pure_Function`` -- GNAT - ``Remote_Access_Type`` -- GNAT - ``Shared`` -- GNAT - ``Size`` - ``Storage_Pool`` - ``Storage_Size`` - ``Stream_Size`` - ``Suppress`` - ``Suppress_Debug_Info`` -- GNAT - ``Test_Case`` -- GNAT - ``Thread_Local_Storage`` -- GNAT - ``Type_Invariant`` - ``Unchecked_Union`` - ``Universal_Aliasing`` -- GNAT - ``Unmodified`` -- GNAT - ``Unreferenced`` -- GNAT - ``Unreferenced_Objects`` -- GNAT - ``Unsuppress`` - ``Value_Size`` -- GNAT - ``Volatile`` - ``Volatile_Components`` - ``Warnings`` -- GNAT -==================================== =========== - - Note that for aspects with an expression, e.g. ``Size``, the expression is - treated like a default expression (visibility is analyzed at the point of - occurrence of the aspect, but evaluation of the expression occurs at the - freeze point of the entity involved). - - RM References: 3.02.01 (3) 3.02.02 (2) 3.03.01 (2/2) 3.08 (6) - 3.09.03 (1.1/2) 6.01 (2/2) 6.07 (2/2) 9.05.02 (2/2) 7.01 (3) 7.03 - (2) 7.03 (3) 9.01 (2/2) 9.01 (3/2) 9.04 (2/2) 9.04 (3/2) - 9.05.02 (2/2) 11.01 (2) 12.01 (3) 12.03 (2/2) 12.04 (2/2) 12.05 (2) - 12.06 (2.1/2) 12.06 (2.2/2) 12.07 (2) 13.01 (0.1/2) 13.03 (5/1) - 13.03.01 (0) - -.. index:: AI-0185 (Ada 2012 feature) - -* *AI-0185 Ada.Wide_[Wide_]Characters.Handling (2010-07-06)* - - Two new packages ``Ada.Wide_[Wide_]Characters.Handling`` provide - classification functions for ``Wide_Character`` and - ``Wide_Wide_Character``, as well as providing - case folding routines for ``Wide_[Wide_]Character`` and - ``Wide_[Wide_]String``. - - RM References: A.03.05 (0) A.03.06 (0) - -.. index:: AI-0188 (Ada 2012 feature) - -* *AI-0188 Case expressions (2010-01-09)* - - Case expressions are permitted. This allows use of constructs such as: - - .. code-block:: ada - - X := (case Y is when 1 => 2, when 2 => 3, when others => 31) - - RM References: 4.05.07 (0) 4.05.08 (0) 4.09 (12) 4.09 (33) - -.. index:: AI-0189 (Ada 2012 feature) - -* *AI-0189 No_Allocators_After_Elaboration (2010-01-23)* - - This AI introduces a new restriction ``No_Allocators_After_Elaboration``, - which says that no dynamic allocation will occur once elaboration is - completed. - In general this requires a run-time check, which is not required, and which - GNAT does not attempt. But the static cases of allocators in a task body or - in the body of the main program are detected and flagged at compile or bind - time. - - RM References: D.07 (19.1/2) H.04 (23.3/2) - -.. index:: AI-0190 (Ada 2012 feature) - -* *AI-0190 pragma Default_Storage_Pool (2010-09-15)* - - This AI introduces a new pragma ``Default_Storage_Pool``, which can be - used to control storage pools globally. - In particular, you can force every access - type that is used for allocation (**new**) to have an explicit storage pool, - or you can declare a pool globally to be used for all access types that lack - an explicit one. - - RM References: D.07 (8) - -.. index:: AI-0193 (Ada 2012 feature) - -* *AI-0193 Alignment of allocators (2010-09-16)* - - This AI introduces a new attribute ``Max_Alignment_For_Allocation``, - analogous to ``Max_Size_In_Storage_Elements``, but for alignment instead - of size. - - RM References: 13.11 (16) 13.11 (21) 13.11.01 (0) 13.11.01 (1) - 13.11.01 (2) 13.11.01 (3) - -.. index:: AI-0194 (Ada 2012 feature) - -* *AI-0194 Value of Stream_Size attribute (0000-00-00)* - - The ``Stream_Size`` attribute returns the default number of bits in the - stream representation of the given type. - This value is not affected by the presence - of stream subprogram attributes for the type. GNAT has always implemented - this interpretation. - - RM References: 13.13.02 (1.2/2) - -.. index:: AI-0195 (Ada 2012 feature) - -* *AI-0195 Invalid value handling is implementation defined (2010-07-03)* - - The handling of invalid values is now designated to be implementation - defined. This is a documentation change only, requiring Annex M in the GNAT - Reference Manual to document this handling. - In GNAT, checks for invalid values are made - only when necessary to avoid erroneous behavior. Operations like assignments - which cannot cause erroneous behavior ignore the possibility of invalid - values and do not do a check. The date given above applies only to the - documentation change, this behavior has always been implemented by GNAT. - - RM References: 13.09.01 (10) - -.. index:: AI-0196 (Ada 2012 feature) - -* *AI-0196 Null exclusion tests for out parameters (0000-00-00)* - - Null exclusion checks are not made for ``out`` parameters when - evaluating the actual parameters. GNAT has never generated these checks. - - RM References: 6.04.01 (13) - -.. index:: AI-0198 (Ada 2012 feature) - -* *AI-0198 Inheriting abstract operators (0000-00-00)* - - This AI resolves a conflict between two rules involving inherited abstract - operations and predefined operators. If a derived numeric type inherits - an abstract operator, it overrides the predefined one. This interpretation - was always the one implemented in GNAT. - - RM References: 3.09.03 (4/3) - -.. index:: AI-0199 (Ada 2012 feature) - -* *AI-0199 Aggregate with anonymous access components (2010-07-14)* - - A choice list in a record aggregate can include several components of - (distinct) anonymous access types as long as they have matching designated - subtypes. - - RM References: 4.03.01 (16) - -.. index:: AI-0200 (Ada 2012 feature) - -* *AI-0200 Mismatches in formal package declarations (0000-00-00)* - - This AI plugs a gap in the RM which appeared to allow some obviously intended - illegal instantiations. GNAT has never allowed these instantiations. - - RM References: 12.07 (16) - -.. index:: AI-0201 (Ada 2012 feature) - -* *AI-0201 Independence of atomic object components (2010-07-22)* - - If an Atomic object has a pragma ``Pack`` or a ``Component_Size`` - attribute, then individual components may not be addressable by independent - tasks. However, if the representation clause has no effect (is confirming), - then independence is not compromised. Furthermore, in GNAT, specification of - other appropriately addressable component sizes (e.g. 16 for 8-bit - characters) also preserves independence. GNAT now gives very clear warnings - both for the declaration of such a type, and for any assignment to its components. - - RM References: 9.10 (1/3) C.06 (22/2) C.06 (23/2) - -.. index:: AI-0203 (Ada 2012 feature) - -* *AI-0203 Extended return cannot be abstract (0000-00-00)* - - A return_subtype_indication cannot denote an abstract subtype. GNAT has never - permitted such usage. - - RM References: 3.09.03 (8/3) - -.. index:: AI-0205 (Ada 2012 feature) - -* *AI-0205 Extended return declares visible name (0000-00-00)* - - This AI corrects a simple omission in the RM. Return objects have always - been visible within an extended return statement. - - RM References: 8.03 (17) - -.. index:: AI-0206 (Ada 2012 feature) - -* *AI-0206 Remote types packages and preelaborate (2010-07-24)* - - Remote types packages are now allowed to depend on preelaborated packages. - This was formerly considered illegal. - - RM References: E.02.02 (6) - -.. index:: AI-0207 (Ada 2012 feature) - -* *AI-0207 Mode conformance and access constant (0000-00-00)* - - This AI confirms that access_to_constant indication must match for mode - conformance. This was implemented in GNAT when the qualifier was originally - introduced in Ada 2005. - - RM References: 6.03.01 (16/2) - -.. index:: AI-0208 (Ada 2012 feature) - -* *AI-0208 Characteristics of incomplete views (0000-00-00)* - - The wording in the Ada 2005 RM concerning characteristics of incomplete views - was incorrect and implied that some programs intended to be legal were now - illegal. GNAT had never considered such programs illegal, so it has always - implemented the intent of this AI. - - RM References: 3.10.01 (2.4/2) 3.10.01 (2.6/2) - -.. index:: AI-0210 (Ada 2012 feature) - -* *AI-0210 Correct Timing_Events metric (0000-00-00)* - - This is a documentation only issue regarding wording of metric requirements, - that does not affect the implementation of the compiler. - - RM References: D.15 (24/2) - -.. index:: AI-0211 (Ada 2012 feature) - -* *AI-0211 No_Relative_Delays forbids Set_Handler use (2010-07-09)* - - The restriction ``No_Relative_Delays`` forbids any calls to the subprogram - ``Ada.Real_Time.Timing_Events.Set_Handler``. - - RM References: D.07 (5) D.07 (10/2) D.07 (10.4/2) D.07 (10.7/2) - -.. index:: AI-0214 (Ada 2012 feature) - -* *AI-0214 Defaulted discriminants for limited tagged (2010-10-01)* - - Ada 2012 relaxes the restriction that forbids discriminants of tagged types - to have default expressions by allowing them when the type is limited. It - is often useful to define a default value for a discriminant even though - it can't be changed by assignment. - - RM References: 3.07 (9.1/2) 3.07.02 (3) - -.. index:: AI-0216 (Ada 2012 feature) - -* *AI-0216 No_Task_Hierarchy forbids local tasks (0000-00-00)* - - It is clearly the intention that ``No_Task_Hierarchy`` is intended to - forbid tasks declared locally within subprograms, or functions returning task - objects, and that is the implementation that GNAT has always provided. - However the language in the RM was not sufficiently clear on this point. - Thus this is a documentation change in the RM only. - - RM References: D.07 (3/3) - -.. index:: AI-0219 (Ada 2012 feature) - -* *AI-0219 Pure permissions and limited parameters (2010-05-25)* - - This AI refines the rules for the cases with limited parameters which do not - allow the implementations to omit 'redundant'. GNAT now properly conforms - to the requirements of this binding interpretation. - - RM References: 10.02.01 (18/2) - -.. index:: AI-0220 (Ada 2012 feature) - -* *AI-0220 Needed components for aggregates (0000-00-00)* - - This AI addresses a wording problem in the RM that appears to permit some - complex cases of aggregates with nonstatic discriminants. GNAT has always - implemented the intended semantics. - - RM References: 4.03.01 (17) diff --git a/gcc/ada/doc/gnat_rm/implementation_of_ada_2022_features.rst b/gcc/ada/doc/gnat_rm/implementation_of_ada_2022_features.rst new file mode 100644 index 0000000..f9ff068 --- /dev/null +++ b/gcc/ada/doc/gnat_rm/implementation_of_ada_2022_features.rst @@ -0,0 +1,2249 @@ +.. _Implementation_of_Ada_2022_Features: + +*********************************** +Implementation of Ada 2022 Features +*********************************** + +.. index:: Ada 2022 implementation status + +.. index:: -gnat22 option (gcc) + +.. index:: pragma Ada_2022 + +.. index:: configuration pragma Ada_2022 + +.. index:: Ada_2022 configuration pragma + +This chapter contains a complete list of Ada 2022 features that have been +implemented. Generally, these features are only available if the *-gnat22* (Ada 2022 features enabled) option is set, or if the configuration pragma ``Ada_2022`` is used. + +However, new pragmas, attributes, and restrictions are unconditionally available, since the Ada standard allows the addition of new pragmas, attributes, and restrictions (there are exceptions, which are +documented in the individual descriptions), and also certain packages +were made available in earlier versions of Ada. + +An ISO date (YYYY-MM-DD) appears in parentheses on the description line. +This date shows the implementation date of the feature. Any wavefront +subsequent to this date will contain the indicated feature, as will any +subsequent releases. A date of 0000-00-00 means that GNAT has always +implemented the feature, or implemented it as soon as it appeared as a +binding interpretation. + +Each feature corresponds to an Ada Issue ('AI') approved by the Ada +standardization group (ISO/IEC JTC1/SC22/WG9) for inclusion in Ada 2022. + +The section "RM references" lists all modified paragraphs in the Ada 2012 reference manual. The details of each modification as well as a complete description of the AIs may be found in +http://www.ada-auth.org/AI12-SUMMARY.HTML. + +.. index:: AI12-0001 (Ada 2022 feature) + +* *AI12-0001 Independence and Representation clauses for atomic objects (2019-11-27)* + + The compiler accepts packing clauses in all cases, even if they have effectively no influence on the layout. Types, where packing is essentially infeasible are, for instance atomic, aliased and by-reference types. + + RM references: 13.02 (6.1/2) 13.02 (7) 13.02 (8) 13.02 (9/3) C.06 (8.1/3) + C.06 (10) C.06 (11) C.06 (21) C.06 (24) + +.. index:: AI12-0003 (Ada 2022 feature) + +* *AI12-0003 Specifying the standard storage pool (2020-06-25)* + + Allows the standard storage pool being specified with a ``Default_Storage_Pool`` pragma or aspect. + + RM references: 8.02 (11) 13.11.03 (1/3) 13.11.03 (3.1/3) 13.11.03 (4/3) + 13.11.03 (4.1/3) 13.11.03 (5/3) 13.11.03 (6.2/3) 13.11.03 + (6.3/3) + +.. index:: AI12-0004 (Ada 2022 feature) + +* *AI12-0004 Normalization and allowed characters for identifiers (2020-06-11)* + + This AI clarifies that Ada identifiers containing characters which are not + allowed in Normalization Form KC are illegal. + + RM references: 2.01 (4.1/3) 2.03 (4/3) A.03.02 (4/3) A.03.02 (32.5/3) + A.03.05 (18/3) A.03.05 (51/3) + +.. index:: AI12-0020 (Ada 2022 feature) + +* *AI12-0020 'Image for all types (2020-03-30)* + + Put_Image prints out a human-readable representation of an object. The + functionality in Ada2022 RM is fully implemented except the support for + types in the ``Remote_Types`` packages. + + RM references: 4.10 (0) 3.05 (27.1/2) 3.05 (27.2/2) 3.05 (27.3/2) 3.05 + (27.4/2) 3.05 (27.5/2) 3.05 (27.6/2) 3.05 (27.7/2) 3.05 (28) 3.05 + (29) 3.05 (30/3) 3.05 (31) 3.05 (32) 3.05 (33/3) 3.05 (37.1/2) + 3.05 (38) 3.05 (39) 3.05 (43/3) 3.05 (55/3) 3.05 (55.1/5) 3.05 + (55.2/4) 3.05 (55.3/4) 3.05 (55.4/4) 3.05 (59) H.04 (23) H.04 (23.8/2) + +.. index:: AI12-0022 (Ada 2022 feature) + +* *AI12-0022 Raise_Expressions (2013-01-27)* + + This feature allows you to write "raise NAME [with STRING]" in an + expression to rise given exception. It is particularly useful in the case of + assertions such as preconditions allowing to specify which exception a + precondition raises if it fails. + + RM references: 4.04 (3/3) 11.02 (6) 11.03 (2/2) 11.03 (3) 11.03 (3.1/2) + 11.03 (4/2) 11.04.01 (10.1/3) + +.. index:: AI12-0027 (Ada 2022 feature) + +* *AI12-0027 Access values should never designate unaliased components (2020-06-15)* + + AI12-0027 adds a requirement for a value conversion that converts from an array of unaliased components to an array of aliased components to make a copy. It defines such conversions to have a local accessibility, effectively preventing the possibility of unsafe accesses to unaliased components. + + RM references: 4.06 (24.17/3) 4.06 (24.21/2) 4.06 (58) 6.02 (10/3) 3.10.02 (10/3) + +.. index:: AI12-0028 (Ada 2022 feature) + +* *AI12-0028 Import of variadic C functions (2020-03-03)* + + Ada programs can now properly call variadic C functions by means of the + conventions C_Variadic_<n>, for small integer values <n>. + + RM references: B.03 (1/3) B.03 (60.15/3) B.03 (75) + +.. index:: AI12-0030 (Ada 2022 feature) + +* *AI12-0030 Formal derived types and stream attribute availability (2020-08-21)* + + Corner cases involving streaming operations for formal derived limited types + that are now defined to raise Program_Error. Before, behavior in these cases + was undefined. Stream attribute availability is more precisely computed in cases where a derived type declaration occurs ahead of a streaming attribute specification for the parent type. + + RM references: 12.05.01 (21/3) 13.13.02 (49/2) + +.. index:: AI12-0031 (Ada 2022 feature) + +* *AI12-0031 All_Calls_Remote and indirect calls (0000-00-00)* + + Remote indirect calls (i.e., calls through a remote access-to-subprogram type) + behave the same as remote direct calls. + + RM references: E.02.03 (19/3) + +.. index:: AI12-0032 (Ada 2022 feature) + +* *AI12-0032 Questions on 'Old (2020-04-24)* + + AI12-0032 resolves several issues related to the 'Old attribute. The GNAT + compiler already implemented what the AI requires in most of those cases, but two having to do with static and dynamic checking of the accessibility level of the constant object implicitly declared for an 'Old attribute reference were not yet implemented. Accessibility checking for these constants is now implemented as defined in the AI. + + RM references: 4.01.03 (9/3) 6.01.01 (22/3) 6.01.01 (26/3) 6.01.01 (35/3) + +.. index:: AI12-0033 (Ada 2022 feature) + +* *AI12-0033 Sets of CPUs when defining dispatching domains (0000-00-00)* + + The set of CPUs associated with a dispatching domain is no longer required + to be a contiguous range of CPU values. + + RM references: D.16.01 (7/3) D.16.01 (9/3) D.16.01 (20/3) D.16.01 (23/3) + D.16.01 (24/3) D.16.01 (26/3) + +.. index:: AI12-0035 (Ada 2022 feature) + +* *AI12-0035 Accessibility checks for indefinite elements of containers (0000-00-00)* + + If the element type for an instance of one of the indefinite container generics has an access discriminant, then accessibility checks (at run-time) prevent inserting a value into a container object if the value's discriminant designates an object that is too short-lived (that is, if the designated object has an accessibility level that is deeper than that of the instance). Without this check, dangling references would be possible. GNAT handled this correctly already before this AI was issued. + + RM references: A.18 (5/3) A.18.11 (8/2) A.18.12 (7/2) A.18.13 (8/2) + A.18.14 (8/2) A.18.15 (4/2) A.18.16 (4/2) A.18.17 (7/3) A.18.18 + (39/3) A.18.18 (47/3) + +.. index:: AI12-0036 (Ada 2022 feature) + +* *AI12-0036 The actual for an untagged formal derived type cannot be tagged (2019-10-21)* + + AI12-0036 is a binding interpretation that adds the following legality rule: + The actual type for a formal derived type shall be tagged if and only if the + formal derived type is a private extension. The check is implemented for all Ada dialects, not just Ada 2022. + + RM references: 12.05.01 (5.1/3) + +.. index:: AI12-0037 (Ada 2022 feature) + +* *AI12-0037 New types in Ada.Locales can't be converted to/from strings (2016-09-10)* + + The type definitions for Language_Code and Country_Code are now using dynamic + predicates. + + RM references: A.19 (4/3) + +.. index:: AI12-0039 (Ada 2022 feature) + +* *AI12-0039 Ambiguity in syntax for membership expression removed (0000-00-00)* + + An ambiguity in the syntax for membership expressions was resolved. For example, "A in B and C" can be parsed in only one way because of this AI. + + RM references: 4.04 (3/3) 4.04 (3.2/3) 4.05.02 (3.1/3) 4.05.02 (4) 4.05.02 + (4.1/3) 4.05.02 (27/3) 4.05.02 (27.1/3) 4.05.02 (28.1/3) 4.05.02 + (28.2/3) 4.05.02 (29/3) 4.05.02 (30/3) 4.05.02 (30.1/3) 4.05.02 + (30.2/3) 4.05.02 (30.3/3) 4.09 (11/3) 4.09 (32.6/3) 8.06 (27.1/3) + 3.02.04 (17/3) + +.. index:: AI12-0040 (Ada 2022 feature) + +* *AI12-0040 Resolving the selecting_expression of a case_expression (0000-00-00)* + + The definition of "complete context" is corrected so that selectors of case expressions + and of case statements are treated uniformly. + + RM references: 8.06 (9) + +.. index:: AI12-0041 (Ada 2022 feature) + +* *AI12-0041 Type_Invariant'Class for interface types (2016-12-12)* + + Subprogram calls within class-wide type invariant expressions get resolved + as primitive operations instead of being dynamically dispatched. + + RM references: 7.03.02 (1/3) 7.03.02 (3/3) + +.. index:: AI12-0042 (Ada 2022 feature) + +* *AI12-0042 Type invariant checking rules (2020-06-05)* + + AI12-0042 adds rules for type invariants. + Specifically, when inheriting a private dispatching operation when the ancestor operation is visible at the point of the type extension, the operation must be abstract or else overridden. In addition, for a class-wide view conversion from an object of a specific type T to which a type invariant applies, an invariant check is performed when the conversion is within the immediate scope of T. + + RM references: 7.03.02 (6/3) 7.03.02 (17/3) 7.03.02 (18/3) 7.03.02 (19/3) + 7.03.02 (20/3) + +.. index:: AI12-0043 (Ada 2022 feature) + +* *AI12-0043 Details of the storage pool used when Storage_Size is specified (0000-00-00)* + + Clarify that a Storage_Size specification for an access type specifies both an upper bound and a lower bound (not just a lower bound) of the amount of storage allowed for allocated objects. + + RM references: 13.11 (18) + +.. index:: AI12-0044 (Ada 2022 feature) + +* *AI12-0044 Calling visible functions from type invariant expressions (2020-05-11)* + + AI05-0289-1 extends invariant checking to `in` parameters. However, this makes + it impossible to call a public function of the type from an invariant + expression, as that public function will attempt to check the invariant, + resulting in an infinite recursion. + + This AI specifies, that type-invariant checking is performed on parameters + of mode `in` upon return from procedure calls, but not of `in`-mode + parameters in functions. + + RM references: 7.03.02 (19/3) + +.. index:: AI12-0045 (Ada 2022 feature) + +* *AI12-0045 Pre- and Postconditions are allowed on generic subprograms (2015-03-17)* + + The SPARK toolset now supports contracts on generic subprograms, packages and + their respective bodies. + + RM references: 6.01.01 (1/3) + +.. index:: AI12-0046 (Ada 2022 feature) + +* *AI12-0046 Enforcing legality for anonymous access components in record aggregates (0000-00-00)* + + For a record aggregate of the form (X | Y => ....), any relevant legality rules are checked for both for X and Y. + + For example, + + .. code:: + + X : aliased constant String := ... ; + type R is record + F1 : access constant String; + F2 : access String; + end record; + Obj : R := (F1 | F2 => X'Access); -- ok for F1, but illegal for F2 + + RM references: 4.03.01 (16/3) + +.. index:: AI12-0047 (Ada 2022 feature) + +* *AI12-0047 Generalized iterators and discriminant-dependent components (0000-00-00)* + + Iterating over the elements of an array is subject to the same legality checks as renaming the array. For example, if an assignment to an enclosing discriminated object could cause an array object to cease to exist then we don't allow renaming the array. So it is similarly not allowed to iterate over the elements of such an array. + + RM references: 5.05.02 (6/3) + +.. index:: AI12-0048 (Ada 2022 feature) + +* *AI12-0048 Default behavior of tasks on a multiprocessor with a specified dispatching policy (0000-00-00)* + + Clarify that if the user does not impose requirements about what CPUs a given task might execute on, then the implementation does not get to impose such requirements. This avoids potential problems with priority inversion. + + RM references: D.16.01 (30/3) + +.. index:: AI12-0049 (Ada 2022 feature) + +* *AI12-0049 Invariants need to be checked on the initialization of deferred constants (0000-00-00)* + + Invariant checking for deferred constants (and subcomponents thereof) is performed. Corrects a clear oversight in the previous RM wording. + + RM references: 7.03.02 (10/3) + +.. index:: AI12-0050 (Ada 2022 feature) + +* *AI12-0050 Conformance of quantified expressions (2016-07-22)* + + Compiler rejects a subprogram body when an expression for a boolean formal + parameter includes a quantified expression, and the subprogram declaration + contains a textual copy of the same. + + RM references: 6.03.01 (20) 6.03.01 (21) + +.. index:: AI12-0051 (Ada 2022 feature) + +* *AI12-0051 The Priority aspect can be specified when Attach_Handler is specified (0000-00-00)* + + Previous RM wording had two contradictory rules for determining (in some cases) the priority of a protected subprogram that is attached to an interrupt. The AI clarifies which one of the rules takes precedence. + + RM references: D.03 (10/3) + +.. index:: AI12-0052 (Ada 2022 feature) + +* *AI12-0052 Implicit objects are considered overlapping (0000-00-00)* + + Clarify that the rules about unsynchronized concurrent access apply as one would expect in the case of predefined routines that access Text_IO's default input and default output files. There was no compiler changes needed to implement this. + + RM references: A (3/2) A.10.03 (21) + +.. index:: AI12-0054-2 (Ada 2022 feature) + +* *AI12-0054-2 Aspect Predicate_Failure (0000-00-00)* + + New aspect Predicate_Failure is defined. A solution for the problem that a predicate like + + .. code:: + + subtype Open_File is File with Dynamic_Predicate =\> Is_Open (Open_File) or else (raise File_Not_Open); + + does the wrong thing in the case of a membership test. + + RM references: 3.02.04 (14/3) 3.02.04 (31/3) 3.02.04 (35/3) + +.. index:: AI12-0055 (Ada 2022 feature) + +* *AI12-0055 All properties of a usage profile are defined by pragmas (2020-06-09)* + + AI12-0055 allows the use of the No_Dynamic_CPU_Assignment restriction in pragmas Restrictions and Restrictions_Warnings. + + RM references: D.07 (10/3) D.13 (6/3) D.13 (8/3) D.13 (10/3) + +.. index:: AI12-0059 (Ada 2022 feature) + +* *AI12-0059 Object_Size attribute (2019-12-02)* + + AI12-0059 brings GNAT-defined attribute Object_Size to Ada standard + and clarifies its semantics. Given that the attribute already existed in + GNAT compiler, the feature is supported for all language versions. + + RM references: 4.09.01 (2/3) 13.01 (14) 13.01 (23) 13.03 (9/3) 13.03 + (50/2) 13.03 (51) 13.03 (52) 13.03 (58) + +.. index:: AI12-0061 (Ada 2022 feature) + +* *AI12-0061 Iterated component associations in array aggregates (2016-09-01)* + + Ada issue AI12-061 introduces a new construct in array aggregates allowing + component associations to be parameterized by a loop variable, for example: + + .. code:: + + Array (1 .. 10) of Integer := + (for I in 1 .. 10 => I ** 2); + type Matrix is + array + (Positive range <>, Positive range <>) of Float; + G : constant Matrix + := + (for I in 1 .. 4 => + (for J in 1 .. 4 => + (if I=J then + 1.0 else 0.0))); -- Identity matrix + + The expression in such an association can also be a function that returns a + limited type, and the range can be specified by the 'others' choice. + + RM references: 4.03.03 (5/2) 4.03.03 (6) 4.03.03 (17/3) 4.03.03 (20) + 4.03.03 (23.1/4) 4.03.03 (32/3) 4.03.03 (43) 3.01 (6/3) 3.03 (6) + 3.03 (18.1/3) 3.03.01 (23/3) 5.05 (6) 8.01 (2.1/4) + +.. index:: AI12-0062 (Ada 2022 feature) + +* *AI12-0062 Raise exception with failing string function (0000-00-00)* + + Clarify that if raising exception E1 is accompanied with a String-valued + expression whose evaluation raises exception E2, then E2 is what gets propagated. + + RM references: 11.03 (4/2) + +.. index:: AI12-0065 (Ada 2022 feature) + +* *AI12-0065 Descendants of incomplete views (0000-00-00)* + + This AI is a clarification of potentially confusing wording. GNAT correctly handles the example given in AARM 7.3.1(5.b-5.d), which illustrates the topic of this AI. + + RM references: 7.03.01 (5.2/3) + +.. index:: AI12-0067 (Ada 2022 feature) + +* *AI12-0067 Accessibility level of explicitly aliased parameters of procedures and entries (0000-00-00)* + + The AI fixes a case where the intent was fairly obvious but the RM wording failed to mention a case (with the result that the accessibility level of an explicitly aliased parameter of a procedure or entry was undefined even though the intent was clear). + + RM references: 3.10.02 (7/3) + +.. index:: AI12-0068 (Ada 2022 feature) + +* *AI12-0068 Predicates and the current instance of a subtype (2020-05-06)* + + AI12-0068 is a binding interpretation that defines the current instance name in a type or subtype aspect to be a value rather than an object. This affects + attributes whose prefix is a current instance in predicates, type invariants, and ``Default_Initial_Condition`` aspects. In particular, in the case of the ``Constrained`` attribute the value will always be True, and formerly legal attributes that require an object as their prefix (such as ``Size``, ``Access``, ``Address``, etc.) are illegal when applied to a current instance in type and subtype aspects. + + RM references: 8.06 (17/3) + +.. index:: AI12-0069 (Ada 2022 feature) + +* *AI12-0069 Inconsistency in Tree container definition (0000-00-00)* + + The description of how iteration over a Tree container's elements was contradictory in some cases regarding whether a cursor designating the Root node is included in the iteration. This contradiction was resolved. In the "!ACATS Test" section of the AI, it says that if an implementation were to get this wrong then almost any attempt to iterate over any tree would fail at runtime. + + RM references: A.18.10 (153/3) A.18.10 (155/3) A.18.10 (157/3) A.18.10 (159/3) + +.. index:: AI12-0070 (Ada 2022 feature) + +* *AI12-0070 9.3(2) does not work for anonymous access types (0000-00-00)* + + The RM contained some old wording about the master of an allocated object that only made sense for named access types. The AI clarifies the wording to clearly state the scope of validity and ensures that the paragraph does not contradict 3.10.2's rules for anonymous access types. + + RM references: 3.10.02 (13.1/3) 9.03 (2) + +.. index:: AI12-0071 (Ada 2022 feature) + +* *AI12-0071 Order of evaluation when multiple predicates apply (2015-08-10)* + + AI12-0071 specifies the semantics of multiple/inherited predicates on a + single subtype. + + RM references: 3.02.04 (4/3) 3.02.04 (6/3) 3.02.04 (30/3) 3.02.04 (31/3) + 3.02.04 (32/3) 3.02.04 (33/3) 3.02.04 (35/3) 3.05.05 (7.1/3) + 3.05.05 (7.2/3) 3.05.05 (7.3/3) 3.08.01 (10.1/3) 3.08.01 (15/3) + 4.05.02 (29/3) 4.05.02 (30/3) 4.06 (51/3) 4.09.01 (10/3) 5.04 + (7/3) 5.05 (9/3) 13.09.02 (3/3) 13.09.02 (12) + +.. index:: AI12-0072 (Ada 2022 feature) + +* *AI12-0072 Missing rules for Discard_Names aspect (0000-00-00)* + + Clarify that Discard_Names is an aspect, not just a pragma. + + RM references: C.05 (1) C.05 (5) C.05 (7/2) C.05 (8) + +.. index:: AI12-0073 (Ada 2022 feature) + +* *AI12-0073 Synchronous Barriers are not allowed with Ravenscar (2020-02-24)* + + Ada 2022 adds (as a binding interpretation) a ``No_Dependence => + Ada.Synchronous_Barriers`` restriction to the Ravenscar profile. + + RM references: D.13 (6/3) + +.. index:: AI12-0074 (Ada 2022 feature) + +* *AI12-0074 View conversions and out parameters passed by copy (2020-03-26)* + + This Ada 2022 AI makes illegal some cases of out parameters whose type has a + ``Default_Value`` aspect. + + RM references: 4.06 (56) 6.04.01 (6.25/3) 6.04.01 (13.1/3) + +.. index:: AI12-0075 (Ada 2022 feature) + +* *AI12-0075 Static expression functions (2020-04-13)* + + Ada 2022 defines a new aspect ``Static`` that can be specified on expression + functions. Such an expression function can be called in contexts requiring static expressions when the actual parameters are all static, allowing for greater abstraction in complex static expressions. + + RM references: 4.09 (21) 6.08 (3/4) 6.08 (5/4) 6.08 (6/4) 7.03.02 (8.2/5) + 7.03.02 (15/4) 7.03.02 (16/4) 7.03.02 (17/4) 7.03.02 (19/4) + 7.03.02 (20/5) + +.. index:: AI12-0076 (Ada 2022 feature) + +* *AI12-0076 Variable state in pure packages (0000-00-00)* + + Defines an obscure constant-modifying construct to be erroneous. The issue is that the current instance of a type is a variable object, so the following is legal: + + .. code:: + + type T; + type T_Ref (Access_To_Variable : access T) is null record; + type T is limited record + Self : T_Ref (T'Access); + Int : Integer; + end record; + + Obj : constant T := (Self => <>, Int => 123); + begin + Obj.Self.Access_To_Variable.Int := 456; -- modifying a component of a constant + + In cases where constancy is really needed (e.g., for an object declared in a Pure context), such a case needs to be erroneous. + + RM references: 10.02.01 (17/3) E.02.02 (17/2) + +.. index:: AI12-0077 (Ada 2022 feature) + +* *AI12-0077 Has_Same_Storage on objects of size zero (2020-03-30)* + + This binding interpretation requires the Has_Same_Storage attribute + to return always `false` for objects that have a size of zero. + + RM references: 13.03 (73.4/3) + +.. index:: AI12-0078 (Ada 2022 feature) + +* *AI12-0078 Definition of node for tree container is confusing (0000-00-00)* + + Clarifies the expected behavior in processing tree containers. + + RM references: A.18.10 (2/3) A.18.10 (3/3) + +.. index:: AI12-0081 (Ada 2022 feature) + +* *AI12-0081 Real-time aspects need to specify when they are evaluated (0000-00-00)* + + Clarify the point at which Priority and Interrupt_Priority aspect expressions are evaluated. + + RM references: D.01 (17/3) D.16 (9/3) + +.. index:: AI12-0084 (Ada 2022 feature) + +* *AI12-0084 Box expressions in array aggregates (2014-12-15)* + + This AI addresses an issue where compiler used to fail to initialize + components of a multidimensional aggregates with box initialization when + scalar components have a specified default value. The AI clarifies that + in an array aggregate with box (i.e., ``<>``) component values, the + ``Default_Component_Value`` of the array type (if any) should not be ignored. + + RM references: 4.03.03 (23.1/2) + +.. index:: AI12-0085 (Ada 2022 feature) + +* *AI12-0085 Missing aspect cases for Remote_Types (0000-00-00)* + + A distributed systems annex (Annex E) clarification. Aspect specifications + that are forbidden using attribute definition clause syntax are also forbidden + using aspect_specification syntax. + + RM references: E.02.02 (17/2) + +.. index:: AI12-0086 (Ada 2022 feature) + +* *AI12-0086 Aggregates and variant parts (2019-08-14)* + + In Ada 2012, a discriminant value that governs an active variant part in an + aggregate had to be static. AI12-0086 relaxes this restriction: If the subtype of the discriminant value is a static subtype all of whose values select the same variant, then the expression for the discriminant is allowed to be nonstatic. + + RM references: 4.03.01 (17/3) 4.03.01 (19/3) + +.. index:: AI12-0088 (Ada 2022 feature) + +* *AI12-0088 UTF_Encoding.Conversions and overlong characters on input (0000-00-00)* + + Clarify that overlong characters are acceptable on input even if we never generate them as output. + + RM references: A.04.11 (54/3) A.04.11 (55/3) + +.. index:: AI12-0089 (Ada 2022 feature) + +* *AI12-0089 Accessibility rules need to take into account that a generic function is not a (0000-00-00)* + + Fix cases in RM wording where the accessibility rules for a function failed to take into account the fact that a generic function is not a function. For example, a generic function with an explicitly aliased parameter should be able to return references to that parameter in the same ways that a (non-generic) function can. The previous wording did not allow that. + + RM references: 3.10.02 (7/3) 3.10.02 (19.2/3) 3.10.02 (19.3/3) 6.05 (4/3) + +.. index:: AI12-0093 (Ada 2022 feature) + +* *AI12-0093 Iterator with indefinite cursor (0000-00-00)* + + A clarification that confirms what GNAT is already doing. + + RM references: 5.05.02 (8/3) 5.05.02 (10/3) + +.. index:: AI12-0094 (Ada 2022 feature) + +* *AI12-0094 An access_definition should be a declarative region (0000-00-00)* + + Fixes wording omission in the RM, confirming that the behaviour of GNAT is + correct. + + RM references: 8.03 (2) 8.03 (26/3) + +.. index:: AI12-0095 (Ada 2022 feature) + +* *AI12-0095 Generic formal types and constrained partial views (0000-00-00)* + + Deciding whether an actual parameter corresponding to an explicitly aliased formal parameter is legal depends on (among other things) whether the parameter type has a constrained partial view. The AI clarifies how this compile-time checking works in the case of a generic formal type (assume the best in the spec and recheck each instance, assume the worst in a generic body). + + RM references: 3.10.02 (27.2/3) 4.06 (24.16/2) 6.04.01 (6.2/3) 12.05.01 (15) + +.. index:: AI12-0096 (Ada 2022 feature) + +* *AI12-0096 The exception raised when a subtype conversion fails a predicate check (0000-00-00)* + + Clarify that the Predicate_Failure aspect works the same in a subtype conversion as in any other context. + + RM references: 4.06 (57/3) + +.. index:: AI12-0097 (Ada 2022 feature) + +* *AI12-0097 Tag of the return object of a simple return expression (0000-00-00)* + + Clarify wording about the tag of a function result in the case of a simple (i.e. not extended) return statement in a function with a class-wide result type. + + RM references: 6.05 (8/3) + +.. index:: AI12-0098 (Ada 2022 feature) + +* *AI12-0098 Problematic examples for ATC (0000-00-00)* + + The AI clarifies reference manual examples, there is no compiler impact. + + RM references: 9.07.04 (13) + +.. index:: AI12-0099 (Ada 2022 feature) + +* *AI12-0099 Wording problems with predicates (2020-05-04)* + + When extending a task or protected type from an ancestor interface subtype with a predicate, a link error can occur due to the compiler failing to generate the predicate-checking function. This AI clarifies the requirement for such predicate inheritance for concurrent types. + + RM references: 3.02.04 (4/4) 3.02.04 (12/3) 3.02.04 (20/3) + +.. index:: AI12-0100 (Ada 2022 feature) + +* *AI12-0100 A qualified expression makes a predicate check (2020-02-17)* + + The compiler now enforces predicate checks on qualified expressions when the + qualifying subtype imposes a predicate. + + RM references: 4.07 (4) + +.. index:: AI12-0101 (Ada 2022 feature) + +* *AI12-0101 Incompatibility of hidden untagged record equality (2019-10-31)* + + AI12-0101 is a binding interpretation that removes a legality rule that + prohibited the declaration of a primitive equality function for a private type in the private part of its enclosing package (either before or after the completion of the type) when the type is completed as an untagged record type. Such declarations are now accepted in Ada 2012 and later Ada versions. + + As a consequence of this work, some cases where the implementation of AI05-0123 was incomplete were corrected. + More specifically, if a user-defined equality operator is present for an untagged record type in an Ada 2012 program, that user-defined equality operator will be (correctly) executed in some difficult-to-characterize cases where the predefined component-by-component comparison was previously being (incorrectly) executed. This can arise, for example, in the case of the predefined equality operation for an enclosing composite type that has a component of the user-defined primitive equality op's operand type. + This correction means that the impact of this change is not limited solely to code that was previously rejected at compile time. + + RM references: 4.05.02 (9.8/3) + +.. index:: AI12-0102 (Ada 2022 feature) + +* *AI12-0102 Stream_IO.File_Type has Preelaborable_Initialization (0000-00-00)* + + Modifies the declaration of one type in a predefined package. GNAT's version of ``Ada.Streams.Stream_IO`` already had this modification (the ``Preelaborable__Initialization`` pragma). + + RM references: A.12.01 (5) + +.. index:: AI12-0103 (Ada 2022 feature) + +* *AI12-0103 Expression functions that are completions in package specifications (0000-00-00)* + + Clarifies that expression functions that are completions do not cause "general" freeze-everybody-in-sight freezing like a subprogram body. + + RM references: 13.14 (3/3) 13.14 (5/3) + +.. index:: AI12-0104 (Ada 2022 feature) + +* *AI12-0104 Overriding an aspect is undefined (0000-00-00)* + + A clarification of the wording in RM, no compiler impact. + + RM references: 4.01.06 (4/3) 4.01.06 (17/3) + +.. index:: AI12-0105 (Ada 2022 feature) + +* *AI12-0105 Pre and Post are not allowed on any subprogram completion (0000-00-00)* + + Language-defined aspects (e.g., ``Post``) cannot be specified as part of the completion of a subprogram declaration. Fix a hole in the RM wording to clarify that this general rule applies even in the special cases where the completion is either an expression function or a null procedure. + + RM references: 13.01.01 (18/3) + +.. index:: AI12-0106 (Ada 2022 feature) + +* *AI12-0106 Write'Class aspect (0000-00-00)* + + Clarify that the syntax used in an ACATS test BDD2005 for specifying a class-wide streaming aspect is correct. + + RM references: 13.01.01 (28/3) 13.13.02 (38/3) + +.. index:: AI12-0107 (Ada 2022 feature) + +* *AI12-0107 A prefixed view of a By_Protected_Procedure interface has convention protected (2020-06-05)* + + A prefixed view of a subprogram with aspect Synchronization set to + By_Protected_Procedure has convention protected. + + RM references: 6.03.01 (10.1/2) 6.03.01 (12) 6.03.01 (13) + +.. index:: AI12-0109 (Ada 2022 feature) + +* *AI12-0109 Representation of untagged derived types (2019-11-12)* + + Ada disallows a nonconforming specification of a type-related representation + aspect of an untagged by-reference type. The motivation for this rule is to ensure that a parent type and a later type derived from the parent agree with respect to such aspects. AI12-0109 disallows a construct that otherwise could be used to get around this rule: an aspect specification for the parent type that occurs after the declaration of the derived type. + + RM references: 13.01 (10/3) + +.. index:: AI12-0110 (Ada 2022 feature) + +* *AI12-0110 Tampering checks are performed first (2020-04-14)* + + AI12-0110 requires tampering checks in the containers library to be + performed first, before any other checks. + + RM references: A.18.02 (97.1/3) A.18.03 (69.1/3) A.18.04 (15.1/3) A.18.07 + (14.1/3) A.18.10 (90/3) A.18.18 (35/3) + +.. index:: AI12-0112 (Ada 2022 feature) + +* *AI12-0112 Contracts for container operations (0000-00-00)* + + A representation change replacing english descriptions of contracts for + operations on predefined container types with pre/post-conditions. No compiler + impact. + + RM references: A.18.02 (99/3) 11.04.02 (23.1/3) 11.05 (23) 11.05 (26) A + (4) A.18 (10) + +.. index:: AI12-0114 (Ada 2022 feature) + +* *AI12-0114 Overlapping objects designated by access parameters are not thread-safe (0000-00-00)* + + There are rules saying that concurrent calls to predefined subprograms don't interfere with each other unless actual parameters overlap. The AI clarifies that such an interference is also possible if overlapping objects are reachable via access dereferencing from actual parameters of the two calls. + + RM references: A (3/2) + +.. index:: AI12-0116 (Ada 2022 feature) + +* *AI12-0116 Private types and predicates (0000-00-00)* + + Clarify that the same aspect cannot be specified twice for the same type. ``Dynamic_Predicate``, for example, can be specified on either the partial view of a type or on the completion in the private part, but not on both. + + RM references: 13.01 (9/3) 13.01 (9.1/3) + +.. index:: AI12-0117 (Ada 2022 feature) + +* *AI12-0117 Restriction No_Tasks_Unassigned_To_CPU (2020-06-12)* + + This AI adds a restriction No_Tasks_Unassigned_To_CPU to provide safe + use of Ravenscar. + + The CPU aspect is specified for the environment task. No CPU aspect is + specified to be statically equal to ``Not_A_Specific_CPU``. If aspect CPU + is specified (dynamically) to the value ``Not_A_Specific_CPU``, then + Program_Error is raised. If Set_CPU or ``Delay_Until_And_Set_CPU`` are called + with the CPU parameter equal to ``Not_A_Specific_CPU``, then ``Program_Error`` is raised. + + RM references: D.07 (10.8/3) + +.. index:: AI12-0120 (Ada 2022 feature) + +* *AI12-0120 Legality and exceptions of generalized loop iteration (0000-00-00)* + + Clarify that the expansion-based definition of generalized loop iteration + includes legality checking. If the expansion would be illegal (for example, + because of passing a constant actual parameter in a call when the mode of + the corresponding formal parameter is in-out), then the loop is illegal too. + + RM references: 5.05.02 (6.1/4) 5.05.02 (10/3) 5.05.02 (13/3) + +.. index:: AI12-0121 (Ada 2022 feature) + +* *AI12-0121 Stream-oriented aspects (0000-00-00)* + + Clarify that streaming-oriented aspects (e.g., Read) can be specified using + aspect_specification syntax, not just via an attribute definition clause. + + RM references: 13.13.02 (38/3) + +.. index:: AI12-0124 (Ada 2022 feature) + +* *AI12-0124 Add Object'Image (2017-03-24)* + + The corrigendum of Ada 2012 extends attribute ``'Image following`` the syntax for the GNAT ``'Img`` attribute. This AI fixes a gap in the earlier implementation, which did not recognize function calls and attributes that are functions as valid object prefixes. + + RM references: 3.05 (55/3) + +.. index:: AI12-0125-3 (Ada 2022 feature) + +* *AI12-0125-3 Add @ as an abbreviation for the LHS of an assignment (2016-11-11)* + + This AI introduces the use of the character '@' as an abbreviation for the left-hand side of an assignment statement, usable anywhere within the expression on the right-hand side. To use this feature the compilation flag -gnat2022 must be specified. + + RM references: 5.02.01 (0) 2.02 (9) 3.03 (21.1/3) 4.01 (2/3) 8.06 (9/4) + +.. index:: AI12-0127 (Ada 2022 feature) + +* *AI12-0127 Partial aggregate notation (2016-10-12)* + + This AI describes a new constructor for aggregates, in terms of an existing record or array object, and a series of component-wise modifications of its value, given by named associations for the modified components. To use this feature the compilation flag ``-gnat2022`` must be specified. + + RM references: 4.03 (2) 4.03 (3/2) 4.03 (4) 4.03.01 (9) 4.03.01 (15/3) + 4.03.01 (16/4) 4.03.01 (17/5) 4.03.01 (17.1/2) 4.03.03 (4) 4.03.03 + (14) 4.03.03 (17/5) 4.03.04 (0) 7.05 (2.6/2) + +.. index:: AI12-0128 (Ada 2022 feature) + +* *AI12-0128 Exact size access to parts of composite atomic objects (2019-11-24)* + + According to this AI, the compiler generates full access to atomic composite objects even if the access is only partial in the source code. To use this feature the compilation flag ``-gnat2022`` must be specified. + + RM references: C.06 (13.2/3) C.06 (19) C.06 (20) C.06 (22/2) C.06 (25/4) + +.. index:: AI12-0129 (Ada 2022 feature) + +* *AI12-0129 Make protected objects more protecting (2020-07-01)* + + A new aspect Exclusive_Functions has been added to the language to force the + use of read/write locks on protected functions when needed. + + RM references: 9.05.01 (2) 9.05.01 (4) 9.05.01 (5) 9.05.01 (7) 9.05.03 + (15) 9.05.03 (23) + +.. index:: AI12-0130 (Ada 2022 feature) + +* *AI12-0130 All I/O packages should have Flush (2016-07-03)* + + The Flush routine has been added for the ``Sequential_IO`` and ``Direct_IO`` standard packages in the Ada 2012 COR.1:2016. The Flush routine here is equivalent to the one found in ``Text_IO``. The ``Flush`` procedure synchronizes the external file with the internal file (by flushing any internal buffers) without closing the file. + + RM references: A.08.01 (10) A.08.02 (28/3) A.08.04 (10) A.10.03 (21) + A.12.01 (28/2) A.12.01 (28.6/1) + +.. index:: AI12-0131 (Ada 2022 feature) + +* *AI12-0131 Inherited Pre'Class when unspecified on initial subprogram (0000-00-00)* + + If T1 is a tagged type with a primitive P that has no class-wide precondition, + and if T2 is an extension of T1 which overrides the inherited primitive P, then that overriding P is not allowed to have a class-wide precondition. Allowing it would be ineffective except in corner cases where it would be confusing. + + RM references: 6.01.01 (17/3) 6.01.01 (18/3) + +.. index:: AI12-0132 (Ada 2022 feature) + +* *AI12-0132 Freezing of renames-as-body (2020-06-13)* + + This AI clarifies that a renames-as-body freezes the expression of any + expression function that it renames. + + RM references: 13.14 (5/3) + +.. index:: AI12-0133 (Ada 2022 feature) + +* *AI12-0133 Type invariants and default initialized objects (0000-00-00)* + + Clarify that invariant checking for a default-initialized object is performed regardless of where the object is declared (in particular, even when the full view of the type is visible). + + RM references: 7.03.02 (10.3/3) + +.. index:: AI12-0135 (Ada 2022 feature) + +* *AI12-0135 Enumeration types should be eligible for convention C (0000-00-00)* + + Ada previously allowed but did not require supporting specifying convention C for an enumeration type. Now it is required that an implementation shall support it. + + RM references: B.01 (14/3) B.01 (41/3) B.03 (65) + +.. index:: AI12-0136 (Ada 2022 feature) + +* *AI12-0136 Language-defined packages and aspect Default_Storage_Pool (0000-00-00)* + + Clarify that the effect of specifying Default_Storage_Pool for an instance of a predefined generic is implementation-defined. No compiler impact. + + RM references: 13.11.03 (5/3) + +.. index:: AI12-0137 (Ada 2022 feature) + +* *AI12-0137 Incomplete views and access to class-wide types (0000-00-00)* + + If the designated type of an access type is incomplete when the access type is declared, then we have rules about whether we get a complete view when a value of the access type is dereferenced. Clarify that analogous rules apply if the designated type is class-wide. + + RM references: 3.10.01 (2.1/2) + +.. index:: AI12-0138 (Ada 2022 feature) + +* *AI12-0138 Iterators of formal derived types (2021-02-11)* + + AI12-0138 specifies the legality rules for confirming specifications of + nonoverridable aspects. This completes the legality checks for aspect ``Implicit_Dereference`` and simplifies the checks for those aspects that are inherited operations. + + RM references: 13.01.01 (18/4) 13.01.01 (34/3) 4.01.05 (6/3) 4.01.06 (5/3) + 4.01.06 (6/3) 4.01.06 (7/3) 4.01.06 (8/3) 4.01.06 (9/3) 5.05.01 (11/3) + +.. index:: AI12-0140 (Ada 2022 feature) + +* *AI12-0140 Access to unconstrained partial view when full view is constrained (0000-00-00)* + + Clarify some confusion about about whether what matters when checking whether designated subtypes statically match is the view of the designated type that is currently available v.s. the view that was available when the access type was declared. + + RM references: 3.02 (7/2) 7.03.01 (5/1) + +.. index:: AI12-0143 (Ada 2022 feature) + +* *AI12-0143 Using an entry index of a family in a precondition (2022-04-05)* + + Ada 2022 adds the ``Index`` attribute, which allows the use of the entry family index of an entry call within preconditions and post-conditions. + + RM references: 6.01.01 (30/3) 9.05.04 (5/3) + +.. index:: AI12-0144 (Ada 2022 feature) + +* *AI12-0144 Make Discrete_Random more flexible (2020-01-31)* + + A new function Random with First/Last parameters is provided in the + ``Ada.Numerics.Discrete_Random`` package. + + RM references: A.05.02 (20) A.05.02 (32) A.05.02 (41) A.05.02 (42) + +.. index:: AI12-0145 (Ada 2022 feature) + +* *AI12-0145 Pool_of_Subpool returns null when called too early (0000-00-00)* + + Clarify that if you ask for the pool of a subpool (by calling ``Pool_Of_Subpool``) before ``Set_Pool_of_Subpool`` is called, then the result is null. + + RM references: 13.11.04 (20/3) + +.. index:: AI12-0147 (Ada 2022 feature) + +* *AI12-0147 Expression functions and null procedures can be declared in a protected_body (2015-03-05)* + + AI12-0147 specifies that null procedures and expression functions are now + allowed in protected bodies. + + RM references: 9.04 (8/1) + +.. index:: AI12-0149 (Ada 2022 feature) + +* *AI12-0149 Type invariants are checked for functions returning access-to-type (0000-00-00)* + + Extend the rule saying that ``Type_Invariant`` checks are performed for access-to-T parameters (where T has a specified ``Type_Invariant``) so that the rule also applies to function results. + + RM references: 7.03.02 (19.3/4) + +.. index:: AI12-0150 (Ada 2022 feature) + +* *AI12-0150 Class-wide type invariants and statically bound calls (0000-00-00)* + + The same approach used in AI12-0113 to ensure that contract-related calls associated with a call to a subprogram "match" with respect to dispatching also applies to ``Type_Invariant`` checking. + + RM references: 7.03.02 (3/3) 7.03.02 (5/3) 7.03.02 (9/3) 7.03.02 (22/3) + +.. index:: AI12-0154 (Ada 2022 feature) + +* *AI12-0154 Aspects of library units (0000-00-00)* + + Clarify that an aspect_specification for a library unit is equivalent to a corresponding aspect-specifying pragma. + + RM references: 13.01.01 (32/3) + +.. index:: AI12-0156 (Ada 2022 feature) + +* *AI12-0156 Use subtype_indication in generalized iterators (0000-00-00)* + + For iterating over an array, we already allow (but do not require) explicitly providing a subtype indication in an iterator_specification. Tee AI generalizes this to handle the case where the element type of the array is of an anonymous access type. This also allows (but does not require) explicitly naming the cursor subtype in a generalized iterator. + The main motivation for allowing these new cases is improving readability by making it easy to infer the (sub)type of the iteration object just by looking at the loop. + + RM references: 5.05.02 (2/3) 5.05.02 (5/4) 5.05.02 (7/3) 3.10.02 (11.1/2) + +.. index:: AI12-0157 (Ada 2022 feature) + +* *AI12-0157 Missing rules for expression functions (0000-00-00)* + + Clarify that an expression function behaves like a single-return-statement + function in more cases: it can return an aggregate without extra parens, the expression has an applicable index constraint, and the same accessibility rules apply in both cases. + + For instance, the code below is legal: + + .. code:: + + subtype S is String (1 .. 10); + function f return S is (others => '?'); + + RM references: 3.10.02 (19.2/4) 3.10.02 (19.3/4) 4.03.03 (11/2) 6.08 (2/3) + 6.08 (3/3) 6.08 (5/3) 6.08 (6/3) 6.08 (7/3) 7.05 (2.9/3) 13.14 + (5.1/4) 13.14 (5.2/4) 13.14 (8/3) 13.14 (10.1/3) 13.14 (10.2/3) + 13.14 (10.3/3) + +.. index:: AI12-0160 (Ada 2022 feature) + +* *AI12-0160 Adding an indexing aspect to an indexable container type (0000-00-00)* + + If the parent type of a derived type has exactly one of the two indexing aspects (that is, constant_indexing and variable_indexing) specified, then the derived type cannot have a specification for the other one. + + RM references: 4.01.06 (6/4) 4.01.06 (9/4) 3.06 (22.2/3) + +.. index:: AI12-0162 (Ada 2022 feature) + +* *AI12-0162 Memberships and Unchecked_Unions (0000-00-00)* + + Clarify that membership tests for unchecked_union types work consistently when + testing membership in more than one subtype (X in AA | BB | CC) as when + testing for one. + + RM references: B.03.03 (25/2) + +.. index:: AI12-0164 (Ada 2022 feature) + +* *AI12-0164 Max_Entry_Queue_Length aspect for entries (2019-06-11)* + + AI12-0164 defines pragma and aspect ``Max_Entry_Queue_Length`` in addition + to the GNAT-specific equivalents ``Max_Queue_Length`` and ``Max_Entry_Queue_Depth``. + + RM references: D.04 (16) + +.. index:: AI12-0165 (Ada 2022 feature) + +* *AI12-0165 Operations of class-wide types and formal abstract subprograms (2021-10-19)* + + Ada 2022 specifies that when the controlling type of a formal abstract + subprogram declaration is a formal type, and the actual type is a class-wide type T'Class, the actual subprogram can be an implicitly declared subprogram corresponding to a primitive operation of type T. + + RM references: 12.06 (8.5/2) + +.. index:: AI12-0166 (Ada 2022 feature) + +* *AI12-0166 External calls to protected functions that appear to be internal calls (2016-11-15)* + + According to this AI, the compiler rejects a call to a protected operation when the call appears within a precondition for another protected operation. + + RM references: 6.01.01 (34/3) 9.05 (3/3) 9.05 (7.1/3) + +.. index:: AI12-0167 (Ada 2022 feature) + +* *AI12-0167 Type_Invariants and tagged-type View Conversions (0000-00-00)* + + This AI clarifies that no invariant check is performed in a case where an invariant-violating value is assigned to a component. This confirms the current compiler behavior. + + RM references: 7.03.02 (9/4) + +.. index:: AI12-0168 (Ada 2022 feature) + +* *AI12-0168 Freezing of generic instantiations of generics with bodies (0000-00-00)* + + Adjust freezing rules to be compatible with AI12-0103-1. The change confirms the current compiler behavior. + + RM references: 13.14 (3/4) + +.. index:: AI12-0169 (Ada 2022 feature) + +* *AI12-0169 Aspect specifications for entry bodies (0000-00-00)* + + Change syntax to allow aspect specifications for implementation-defined aspects on entry bodies. The change doesn't influence any of the language-defined aspects and is solely required for SPARK. + + RM references: 9.05.02 (5) + +.. index:: AI12-0170 (Ada 2022 feature) + +* *AI12-0170 Abstract subprogram calls in class-wide precondition expressions (2020-07-06)* + + This AI specifies rules for calls to abstract functions within class-wide preconditions and postconditions. + + RM references: 3.09.03 (7) 6.01.01 (7/4) 6.01.01 (18/4) 6.01.01 (18.2/4) + +.. index:: AI12-0172 (Ada 2022 feature) + +* *AI12-0172 Raise expressions in limited contexts (2019-07-29)* + + The compiler has been enhanced to support the use of raise expressions in + limited contexts. + + RM references: 7.05 (2.1/3) + +.. index:: AI12-0173 (Ada 2022 feature) + +* *AI12-0173 Expression of an extended return statement (0000-00-00)* + + Fix the wording related to expression of an extended return statement that was made ambiguous by changes of syntax in other AI's. No compiler changes involved. + + RM references: 6.05 (3/2) 6.05 (5/3) + +.. index:: AI12-0174 (Ada 2022 feature) + +* *AI12-0174 Aggregates of Unchecked_Unions using named notation (0000-00-00)* + + In many cases, it is illegal to name a discriminant of an unchecked_union type. Relax this rule to allow the use of named notation in an aggregate of an unchecked_union type. + + RM references: B.03.03 (9/3) + +.. index:: AI12-0175 (Ada 2022 feature) + +* *AI12-0175 Preelaborable packages with address clauses (2020-03-20)* + + The compiler nows accepts calls to certain functions that are essentially unchecked conversions in preelaborated library units. To use this feature the compilation flag ``-gnat2022`` must be specified. + + RM references: 10.02.01 (7) + +.. index:: AI12-0179 (Ada 2022 feature) + +* *AI12-0179 Failure of postconditions of language-defined units (0000-00-00)* + + A clarification that expressing postconditions for predefined units via RM wording or via ``Post`` aspect specifications are equivalent. In particular, the expression in such a ``Post`` aspect specification should not yield False. No implementation changes needed. + + RM references: 1.01.03 (17/3) 11.04.02 (23.1/3) + +.. index:: AI12-0180 (Ada 2022 feature) + +* *AI12-0180 Using protected subprograms and entries within an invariant (2020-06-22)* + + AI12-0180 makes entries and protected subprograms directly visible within Invariant aspects of a task or protected type. + + RM references: 13.01.01 (12/3) + +.. index:: AI12-0181 (Ada 2022 feature) + +* *AI12-0181 Self-referencing representation aspects (0000-00-00)* + + Clarify that a name or expression which freezes an entity cannot occur in an aspect specification for that entity. + + RM references: 13.01 (9/4) 13.01 (9.1/4) 13.14 (19) + +.. index:: AI12-0182 (Ada 2022 feature) + +* *AI12-0182 Pre'Class and protected operations (0000-00-00)* + + Confirm that Pre'Class and Post'Class cannot be specified for a protected operation. No language change. + + RM references: 13.01.01 (16/3) + +.. index:: AI12-0184 (Ada 2022 feature) + +* *AI12-0184 Long Long C Data Types (2020-01-30)* + + Two new types ``long_long`` and ``unsigned_long_long`` are introduced in the package ``Interfaces.C``. + + RM references: B.03 (71.3/3) + +.. index:: AI12-0185 (Ada 2022 feature) + +* *AI12-0185 Resolution of postcondition-specific attributes (0000-00-00)* + + Clarify resolution rules for ``'Old`` and ``'Result`` attribute references to match original intent. + + RM references: 6.01.01 (7/4) 6.01.01 (8/3) 6.01.01 (26.10/4) 6.01.01 (29/3) + +.. index:: AI12-0186 (Ada 2022 feature) + +* *AI12-0186 Profile freezing for the Access attribute (0000-00-00)* + + Clarify that the use of Some_Subprogram'Access does not freeze the profile of Some_Subprogram. + + RM references: 13.14 (15) + +.. index:: AI12-0187 (Ada 2022 feature) + +* *AI12-0187 Stable properties of abstract data types (2020-11-04)* + + Ada 2022 defines a new aspect, ``Stable_Properties``, for use in + generating additional postcondition checks for subprograms. + + RM references: 7.03.04 (0) 13.01.01 (4/3) + +.. index:: AI12-0191 (Ada 2022 feature) + +* *AI12-0191 Clarify "part" for type invariants (0000-00-00)* + + Clarify that for purposes of determining whether an invariant check is required for a "part" of an object, we do not look at "parts" which do not correspond to "parts" of the nominal type of the object. For example, if we have a parameter Param of a tagged type T1 (or equivalently of type T1'Class), and type T2 is an extension of T1 which declares a component Foo, and T1'Class (Param)'Tag = T2'Tag, then no invariant check is performed for Param's Foo component (or any subcomponent thereof). + + RM references: 3.03 (23/5) 3.09.01 (4.1/2) 6.08 (5.8/5) 7.03.02 (8.3/5) + 7.03.02 (8.4/5) 7.03.02 (8.5/5) 7.03.02 (8.6/5) 7.03.02 (8.7/5) + 7.03.02 (8.8/5) 7.03.02 (8.9/5) 7.03.02 (8.10/5) 7.03.02 (8.11/5) + 7.03.02 (8.12/5) 7.03.02 (10.1/4) 7.03.02 (15/5) 7.03.02 (17/4) + 7.03.02 (18/4) 7.03.02 (19/4) 13.13.02 (9/3) + +.. index:: AI12-0192 (Ada 2022 feature) + +* *AI12-0192 "requires late initialization" and protected types (2020-03-11)* + + This AI clarifies that components of a protected type require late initialization when their initialization references (implicitly) the current instance of the type. + + RM references: 3.03.01 (8.1/2) + +.. index:: AI12-0194 (Ada 2022 feature) + +* *AI12-0194 Language-defined aspects and entry bodies (0000-00-00)* + + The AI Includes entry bodies on the list of bodies for which no language-defined aspects can be specified (although specifying an implementation-defined aspect may be allowed). + + A wording change, no implementation impact. + + RM references: 13.01.01 (17/3) + +.. index:: AI12-0195 (Ada 2022 feature) + +* *AI12-0195 Inheriting body but overriding precondition or postcondition (2021-08-11)* + + Ada 2022 specifies that if a primitive with a class-wide precondition or + postcondition is inherited, and some primitive function called in the class-wide precondition or postcondition is overridden, then a dispatching call to the first primitive with a controlling operand that has the tag of the overriding type is required to check both the interpretation using the overriding function and the interpretation using the original overridden function. + + RM references: 6.01.01 (38/4) + +.. index:: AI12-0196 (Ada 2022 feature) + +* *AI12-0196 Concurrent access to Ada container libraries (0000-00-00)* + + Clarify that parallel execution of operations which use cursors to refer to different elements of the same container does not violate the rules about erroneous concurrent access in some cases. That is, if C1 and C2 are cursors that refer to different elements of some container, then it is ok to concurrently execute an operation that is passed C1 and which accesses one element of the container, with another operation (perhaps the same operation, perhaps not) that is passed C2 and which accesses another element of the container. + + RM references: A.18 (2/2) A.18.02 (125/2) A.18.02 (133/3) A.18.02 (135/3) + A.18.03 (81/3) A.18.04 (36/3) A.18.07 (34/2) A.18.10 (116/3) + +.. index:: AI12-0198 (Ada 2022 feature) + +* *AI12-0198 Potentially unevaluated components of array aggregates (2020-05-13)* + + Ada 2022 enforces the detection of components that belong to a nonstatic or + null range of index values of an array aggregate. + + RM references: 6.01.01 (22.1/4) + +.. index:: AI12-0199 (Ada 2022 feature) + +* *AI12-0199 Abstract subprogram calls in class-wide invariant expressions (0000-00-00)* + + Class-wide type invariants do not apply to abstract types, to avoid various + problems. Define the notion of a "corresponding expression" for a class-wide + type invariant, replacing references to components as appropriate, taking into + account rules for corresponding and specified discriminants when applying them + to a nonabstract descendant. + + RM references: 7.03.02 (5/4) 7.03.02 (8/3) + +.. index:: AI12-0201 (Ada 2022 feature) + +* *AI12-0201 Missing operations of static string types (2020-02-25)* + + Relational operators and type conversions of static string types are now static in Ada 2022. + + RM references: 4.09 (9) 4.09 (19) 4.09 (20) 4.09 (24) + +.. index:: AI12-0203 (Ada 2022 feature) + +* *AI12-0203 Overriding a nonoverridable aspect (0000-00-00)* + + A corner case wording clarification that has no impact on compilers. + + RM references: 4.01.05 (5.1/4) 4.01.05 (7/3) + +.. index:: AI12-0204 (Ada 2022 feature) + +* *AI12-0204 Renaming of a prefixed view (2020-02-24)* + + AI12-0204 clarifies that the prefix of a prefixed view that is renamed or + passed as a formal subprogram must be renameable as an object. + + RM references: 8.05.04 (5.2/2) 12.06 (8.3/2) 4.01.03 (13.1/2) 4.01.06 (9/5) + +.. index:: AI12-0205 (Ada 2022 feature) + +* *AI12-0205 Defaults for generic formal types (2021-04-01)* + + AI12-0205 specifies syntax and semantics that provide defaults for formal types of generic units. The legality rules guarantee that the default subtype_mark that is specified for a formal type would be a legal actual in any instantiation of the generic unit. + + RM references: 12.03 (7/3) 12.03 (10) 12.05 (2.1/3) 12.05 (2.2/3) 12.05 (7/2) + +.. index:: AI12-0206 (Ada 2022 feature) + +* *AI12-0206 Nonoverridable should allow arbitrary kinds of aspects (0000-00-00)* + + A non-overridable aspect can have a value other than a name; for example, ``Max_Entry_Queue_Length`` is non-overridable and it has a scalar value. + Part of adding support for ``Max_Entry_Queue_Length`` (which is already supported by GNAT). + + RM references: 13.01.01 (18.2/4) 13.01.01 (18.3/4) 13.01.01 (18.6/4) + +.. index:: AI12-0207 (Ada 2022 feature) + +* *AI12-0207 Convention of anonymous access types (2020-02-01)* + + The convention of anonymous access elements of arrays now have the same convention as the array instead of convention Ada. + + RM references: 6.03.01 (13.1/3) B.01 (19) B.01 (21/3) + +.. index:: AI12-0208 (Ada 2022 feature) + +* *AI12-0208 Predefined Big numbers support (0000-00-00)* + + Add predefined package ``Ada.Numerics.Big_Numbers``. + + RM references: A.05.05 (0) A.05.06 (0) A.05.07 (0) + +.. index:: AI12-0211 (Ada 2022 feature) + +* *AI12-0211 Interface types and inherited nonoverridable aspects (2020-08-24)* + + AI12-0211 introduces two new legality rules for Ada 2022. The first says that + if a nonoverridable aspect is explicitly specified for a type that also inherits that aspect from another type (an ancestor or a progenitor), then the explicit aspect specification shall be confirming. The second says that if a type inherits a nonoverridable aspect from two different sources (this can only occur if at least one of the two is an interface type), then the two sources shall agree with respect to the given aspect. This AI is a binding interpretation, so these checks are performed even for earlier Ada versions. Because of compatibility concerns, an escape mechanism for suppressing these legality checks is provided: these new checks always pass if the ``-gnatd.M`` switch (relaxed RM semantics) is specified. + + RM references: 13.01.01 (18.3/5) 13.01.01 (18.4/4) + +.. index:: AI12-0212 (Ada 2022 feature) + +* *AI12-0212 Container aggregates; generalized array aggregates (0000-00-00)* + + The AI defines a new feature: generalized array aggregates that already exists in GNAT. + + RM references: 4.03.05 (0) 1.01.04 (12) 1.01.04 (13) 2.01 (15) 2.02 (9/5) + 3.07.01 (3) 3.08.01 (4) 4.03 (2/5) 4.03 (3/5) 4.03.01 (5) 4.03.03 + (3/2) 4.03.03 (4/5) 4.03.03 (5.1/5) 4.03.03 (9) 4.03.03 (17/5) + 4.03.03 (21) 4.03.03 (23.2/5) 4.03.03 (26) 4.03.03 (27) 4.03.03 + (31) 4.03.04 (4/5) 4.04 (3.1/3) 11.02 (3) 13.01.01 (5/3) + 13.01.01 (7/3) A.18.02 (8/3) A.18.02 (14/2) A.18.02 (47/2) A.18.02 + (175/2) A.18.03 (6/3) A.18.05 (3/3) A.18.06 (4/3) A.18.08 (3/3) + A.18.09 (4/3) + +.. index:: AI12-0216 (Ada 2022 feature) + +* *AI12-0216 6.4.1(6.16-17/3) should never apply to composite objects (0000-00-00)* + + Fix wording so that parameter passing cases where there isn't really any aliasing problems or evaluation order dependency are classified as acceptable. + + No compiler impact. + + RM references: 6.04.01 (6.17/3) + +.. index:: AI12-0217 (Ada 2022 feature) + +* *AI12-0217 Rules regarding restrictions on the use of the Old attribute are too strict (2020-03-25)* + + AI12-0217 loosens the rules regarding what is allowed as the prefix of a 'Old + attribute reference. In particular, a prefix is now only required to "statically name" (as opposed to the previous "statically denote") an object. This means that components of composite objects that previously would have been illegal are now legal prefixes. + + RM references: 6.01.01 (24/3) 6.01.01 (27/3) + +.. index:: AI12-0220 (Ada 2022 feature) + +* *AI12-0220 Pre/Post for access-to-subprogram types (2020-04-14)* + + Contract aspects can now be specified for access-to-subprogram types, as + defined for Ada 2022 in this AI. + + RM references: 6.01.01 (1/4) 6.01.01 (2/3) 6.01.01 (4/3) 6.01.01 (19/3) + 6.01.01 (28/3) 6.01.01 (29/3) 6.01.01 (39/3) 13.01.01 (12/5) + +.. index:: AI12-0222 (Ada 2022 feature) + +* *AI12-0222 Representation aspects and private types (0000-00-00)* + + Clarify that the rule against specifying a representation aspect for a type before the type is completely defined also applies in the case where aspect_specification syntax is used (not just in the case where a pragma or some other kind of representation item is used). + + GNAT already implements this. + + RM references: 13.01 (9/5) 13.01 (9.1/4) 13.01 (9.2/5) + +.. index:: AI12-0225 (Ada 2022 feature) + +* *AI12-0225 Prefix of Obj'Image (0000-00-00)* + + Clarify some Object vs. Value corner cases to allow names that do not denote objects in more contexts, such as a qualified expression as a prefix of an Image attribute. + + RM references: 3.05 (55.1/4) + +.. index:: AI12-0226 (Ada 2022 feature) + +* *AI12-0226 Make objects more consistent (0000-00-00)* + + Allow value conversions as objects. For instance this example becomes legal: ``Long_Integer (Duration'Last)'Image``. + + RM references: 3.03 (11.1/3) 3.03 (21.1/3) 3.03 (23.8/5) 4.06 (58.1/4) + 4.06 (58.3/4) + +.. index:: AI12-0227 (Ada 2022 feature) + +* *AI12-0227 Evaluation of nonstatic universal expressions when no operators are involved (0000-00-00)* + + Nonstatic universal integer expressions are always evaluated at runtime as values of type root_integer; similarly, nonstatic universal real expressions are always evaluated at runtime as values of type root_real. + This AI corrects a wording oversight. Previously, the above was only true if a call to operator was involved. With this change it is true in all cases. + + No compiler impact. + + RM references: 4.04 (10) 8.06 (29) + +.. index:: AI12-0228 (Ada 2022 feature) + +* *AI12-0228 Properties of qualified expressions used as names (2020-02-19)* + + This AI clarifies that properties of a qualified object pass through a + qualified expression used as a name. Specifically, "aliased" and "known to be + constrained" are not changed by a qualified expression. + + RM references: 3.03 (23.7/3) 3.10 (9/3) + +.. index:: AI12-0231 (Ada 2022 feature) + +* *AI12-0231 Null_Task_Id and Activation_Is_Complete (0000-00-00)* + + Add ``Activation_Is_Complete`` to the list of functions that raise P_E if passed ``Null_Task_Id``, correcting an oversight. + + RM references: C.07.01 (15) + +.. index:: AI12-0232 (Ada 2022 feature) + +* *AI12-0232 Rules for pure generic bodies (0000-00-00)* + + Clarify the rules for a generic body nested in a pure library unit. + + RM references: 10.02.01 (9/3) 10.02.01 (15.1/3) 10.02.01 (15.5/3) + +.. index:: AI12-0233 (Ada 2022 feature) + +* *AI12-0233 Pre'Class for hidden operations of private types (0000-00-00)* + + Clarify how ``Pre'Class`` checking interacts with private-part overriding of inherited subprograms. A class-wide precondition can be checked at runtime even if it is specified in a private part that the caller cannot see into. + + RM references: 6.01.01 (38/4) + +.. index:: AI12-0234 (Ada 2022 feature) + +* *AI12-0234 Compare-and-swap for atomic objects (0000-00-00)* + + New predefined units for atomic operations (``System.Atomic_Operations`` and child units thereof). + + RM references: C.06.01 (0) C.06.02 (0) + +.. index:: AI12-0235 (Ada 2022 feature) + +* *AI12-0235 System.Storage_Pools should be pure (0000-00-00)* + + Change the predefined package System.Storage_Pools from preelaborated to pure. + + RM references: 13.11 (5) + +.. index:: AI12-0236 (Ada 2022 feature) + +* *AI12-0236 declare expressions (2020-04-08)* + + A ``declare expression`` allows constant objects and renamings to be + declared within an expression. + + RM references: 2.08 (6) 3.09.02 (3) 3.10.02 (9.1/3) 3.10.02 (16.1/3) + 3.10.02 (32.2/3) 4.03.02 (5.4/3) 4.03.03 (15.1/3) 4.04 (7/3) + 4.05.09 (0) 6.02 (10/4) 7.05 (2.1/5) 8.01 (2.1/4) + +.. index:: AI12-0237 (Ada 2022 feature) + +* *AI12-0237 Getting the representation of an enumeration value (2020-01-31)* + + The GNAT-specific attributes ``Enum_Rep`` and ``Enum_Val`` have been standardized and are now also supported as Ada 2022 attributes. + + RM references: 13.04 (10) 13.04 (11/3) + +.. index:: AI12-0242 (Ada 2022 feature) + +* *AI12-0242 Shorthand Reduction Expressions for Objects (0000-00-00)* + + Allow reduction expressions to iterate over an an array or an iterable object without having to explicitly create a value sequence. + + This allows, for instance, writing ``A'Reduce("+", 0)`` instead of the equivalent (but more verbose) ``[for Value of A => Value]'Reduce("+", 0);``. + + RM references: 4.05.10 (0) 4.01.04 (6) + +.. index:: AI12-0247 (Ada 2022 feature) + +* *AI12-0247 Potentially Blocking goes too far for Detect_Blocking (0000-00-00)* + + During a protected action, a call on a subprogram that contains a potentially blocking operation is considered a bounded error (so raising P_E is optional). + This rule imposed an unreasonable implementation burden. + The new rule introduced by this AI allows ignoring (i.e., not detecting) the problem until execution of a potentially blocking operation is actually attempted. + + RM references: 9.05 (55/5) 9.05 (56/5) 9.05.01 (18/5) H.05 (5/2) + +.. index:: AI12-0249 (Ada 2022 feature) + +* *AI12-0249 User-defined numeric literals (2020-04-07)* + + Compiler support is added for three new aspects (``Integer_Literal``, ``Real_Literal``, and ``String_Literal``) as described in AI12-0249 (for ``Integer_Literal`` and ``Real_Literal``), AI12-0295 (for ``String_Literal``), and in two follow-up AIs (AI12-0325 and AI12-0342). For pre-Ada 2022 versions of Ada, these are treated as implementation-defined + aspects. Some implementation work remains, particularly in the interactions between these aspects and tagged types. + + RM references: 4.02 (9) 4.02.01 (0) 4.09 (3) + +.. index:: AI12-0250 (Ada 2022 feature) + +* *AI12-0250 Iterator Filters (2020-05-19)* + + This AI defines Ada 2022 feature of iterator filters, which can be + applied to loop parameter specifications and iterator specifications. + + RM references: 4.03.03 (21) 4.03.03 (26) 4.03.03 (31) 4.03.05 (0) 4.05.10 + (0) 5.05 (4) 5.05 (7) 5.05 (9/4) 5.05 (9.1/4) 5.05 (10) + 5.05.02 (2/3) 5.05.02 (10/3) 5.05.02 (11/3) + +.. index:: AI12-0252 (Ada 2022 feature) + +* *AI12-0252 Duplicate interrupt handlers under Ravenscar (2018-07-05)* + + Ada Issue AI12-0252 requires that the runtime shall terminate with a + Program_Error when more than one interrupt handler is attached to the same interrupt and the restriction No_Dynamic_Attachment is in effect. + + RM references: C.03.01 (13) + +.. index:: AI12-0256 (Ada 2022 feature) + +* *AI12-0256 Aspect No_Controlled_Parts (2021-01-26)* + + The compiler now supports the Ada 2022 aspect No_Controlled_Parts (see + AI12-0256). When specified for a type, this aspect requires that the type and any of its ancestors must not have any controlled parts. + + RM references: H.04.01 (0) 13.01.01 (18.7/5) + +.. index:: AI12-0258 (Ada 2022 feature) + +* *AI12-0258 Containers and controlled element types (0000-00-00)* + + Most predefined containers are allowed to defer finalization of container elements until the finalization of the container. This allows implementation flexibility but causes problems in some cases. AI12-0258 tightens up the rules for the indefinite containers to say that finalization happens earlier - if a client needs the tighter finalization guarantees, then it can use the indefinite containers (even if the element subtype in question is definite). Other solutions involving the holder generic are also possible. + + GNAT implements these tighter element finalization requirements for instances of the indefinite container generics. + + RM references: A.18 (10/4) + +.. index:: AI12-0259 (Ada 2022 feature) + +* *AI12-0259 Lower bound of strings returned from Ada.Command_Line (0000-00-00)* + + Specify that the low-bound of a couple of predefined String-valued functions will always be one. + + RM references: A.15 (14) A.15 (16/3) + +.. index:: AI12-0260 (Ada 2022 feature) + +* *AI12-0260 Functions Is_Basic and To_Basic in Wide_Characters.Handling (2020-04-01)* + + AI12-0260 is implemented for Ada 2022, providing the new functions ``Is_Basic`` and ``To_Basic`` in package ``Ada.Wide_Characters.Handling``. + + RM references: 1.02 (8/3) A.03.05 (8/3) A.03.05 (20/3) A.03.05 (21/3) + A.03.05 (33/3) A.03.05 (61/3) + +.. index:: AI12-0261 (Ada 2022 feature) + +* *AI12-0261 Conflict in "private with" rules (0000-00-00)* + + If a library unit is only visible at some point because of a "private with", there are legality rules about a name denoting that entity. The AI cleans up the wording so that it captures the intent in a corner case involving a private-child library-unit subprogram. The previous wording incorrectly caused this case to be illegal. + + RM references: 10.01.02 (12/3) 10.01.02 (13/2) 10.01.02 (14/2) 10.01.02 + (15/2) 10.01.02 (16/2) + +.. index:: AI12-0262 (Ada 2022 feature) + +* *AI12-0262 Map-Reduce attribute (0000-00-00)* + + The AI defines Reduction Expressions to allow the programmer to apply the + Map-Reduce paradigm to map/transform a set of values to a new set of values, + and then summarize/reduce the transformed values into a single result value. + + RM references: 4.01.04 (1) 4.01.04 (6) 4.01.04 (11) 4.05.10 (0) + +.. index:: AI12-0263 (Ada 2022 feature) + +* *AI12-0263 Update references to ISO/IEC 10646 (0000-00-00)* + + Change RM references to ISO/IEC 10646:2011 to instead refer to ISO/IEC 10646:2017. No compiler impact. + + RM references: 1.01.04 (14.2/3) 2.01 (1/3) 2.01 (3.1/3) 2.01 (4/3) 2.01 + (4.1/5) 2.01 (5/3) 2.01 (15/3) 2.01 (4.1/5) 2.01 (5/3) 2.03 + (4.1/5) 2.03 (5/3) 3.05.02 (2/3) 3.05.02 (3/3) 3.05.02 (4/3) A.01 + (36.1/3) A.01 (36.2/3) A.03.02 (32.6/5) A.03.05 (51.2/5) A.03.05 + (55/3) A.03.05 (59/3) A.04.10 (3/3) B.05 (21/5) + +.. index:: AI12-0264 (Ada 2022 feature) + +* *AI12-0264 Overshifting and overrotating (0000-00-00)* + + Clarify Shift and Rotate op behavior with large shift/rotate amounts. + + RM references: B.02 (9) + +.. index:: AI12-0265 (Ada 2022 feature) + +* *AI12-0265 Default_Initial_Condition for types (2020-11-13)* + + The aspect ``Default_Initial_Condition``, originally proposed by SPARK and + supported in GNAT, is now also included in Ada 2022. One change from the + original implementation is that when the aspect is specified on ancestor types of a derived type, the ancestors' check expressions also apply to the derived type. + ``Default_Initial_Condition`` checks are also now applied in cases of default + initialization of components, allocators, ancestor parts of extension aggregates, and box associations of aggregates. + + RM references: 7.03.03 (0) 1.01.03 (17.1/5) 11.04.02 (23.2/5) 11.04.02 (23.3/5) + +.. index:: AI12-0269 (Ada 2022 feature) + +* *AI12-0269 Aspect No_Return for functions reprise (2020-03-19)* + + This amendment has been implemented under the ``-gnat2022`` switch, and the + compiler now accepts the aspect/pragma No_Return for functions and generic + functions. + + RM references: 6.05.01 (0) 6.05.01 (1/3) 6.05.01 (3.1/3) 6.05.01 (3.4/3) + 6.05.01 (5/2) 6.05.01 (6/2) 6.05.01 (7/2) J.15.02 (2/3) J.15.02 + (3/3) J.15.02 (4/3) + +.. index:: AI12-0272 (Ada 2022 feature) + +* *AI12-0272 (part 1) Pre/Postconditions for formal subprograms (0000-00-00)* + + Pre and Post aspects can be specified for a generic formal subprogram. ``Default_Initial_Condition`` can be specified for a generic formal private type. + + GNAT implements this with an exception of the part related to ``Default_Initial_Condition``. + + RM references: 6.01.01 (1/5) 6.01.01 (39/5) 7.03.03 (1/5) 7.03.03 (2/5) + 7.03.03 (8/5) 7.03.04 (5/5) F.01 (1) + +.. index:: AI12-0275 (Ada 2022 feature) + +* *AI12-0275 Make subtype_mark optional in object renames (2020-01-28)* + + AI12-0275 allows object renamings to be declared without an explicit + subtype_mark or access_definition. This feature can be used by compiling + with the switch ``-gnat2022``. + + RM references: 8.05.01 (2/3) 8.05.01 (3/2) + +.. index:: AI12-0277 (Ada 2022 feature) + +* *AI12-0277 The meaning of "accessibility level of the body of F" (0000-00-00)* + + Clarify that the only time that an explicitly aliased formal parameter has different accessibility properties than an aliased part of a "normal" parameter is for the accessibility checking associated with a return statement. + + RM references: 3.10.02 (19.2/4) + +.. index:: AI12-0278 (Ada 2022 feature) + +* *AI12-0278 Implicit conversions of anonymous return types (0000-00-00)* + + If a call to a function with an anonymous-access-type result is converted to a named access type, it doesn't matter whether the conversion is implicit or explicit. the AI fixes hole where the previous rules didn't cover the implicit conversion case. + + RM references: 3.10.02 (10.3/3) + +.. index:: AI12-0279 (Ada 2022 feature) + +* *AI12-0279 Nonpreemptive dispatching needs more dispatching points (2020-04-17)* + + Ada 2022 defines a new aspect `Yield` that can be specified in the declaration of a noninstance subprogram (including a generic formal subprogram), a generic subprogram, or an entry, to ensure that the associated subprogram has at least one task dispatching point during each invocation. + + RM references: D.02.01 (1.5/2) D.02.01 (7/5) + +.. index:: AI12-0280-2 (Ada 2022 feature) + +* *AI12-0280-2 Making 'Old more flexible (2020-07-24)* + + For Ada 2022, AI12-0280-2 relaxes Ada's restrictions on 'Old attribute + references whose attribute prefix does not statically name an entity. Previously, it was required that such an attribute reference must be unconditionally evaluated when the postcondition is evaluated; with the new rule, conditional evaluation is permitted if the relevant conditions can be evaluated upon entry to the subprogram with the same results as evaluation at the time of the postcondition's evaluation. In this case, the 'Old attribute prefix is evaluated conditionally (more specifically, the prefix is evaluated only if the result of that evaluation is going to be referenced later when the + postcondition is evaluated). + + RM references: 6.01.01 (20/3) 6.01.01 (21/3) 6.01.01 (22/3) 6.01.01 + (22.1/4) 6.01.01 (22.2/5) 6.01.01 (23/3) 6.01.01 (24/3) 6.01.01 + (26/4) 6.01.01 (27/5) 6.01.01 (39/5) + +.. index:: AI12-0282 (Ada 2022 feature) + +* *AI12-0282 Atomic, Volatile, and Independent generic formal types (0000-00-00)* + + The AI specifies that the aspects ``Atomic``, ``Volatile``, ``Independent``, ``Atomic_Components``, ``Volatile_Components``, and ``Independent_Components`` are specifiable for generic formal types. The actual type must have a matching specification. + + RM references: C.06 (6.1/3) C.06 (6.3/3) C.06 (6.5/3) C.06 (6.8/3) C.06 + (12/3) C.06 (12.1/3) C.06 (21/4) + +.. index:: AI12-0285 (Ada 2022 feature) + +* *AI12-0285 Syntax for Stable_Properties aspects (0000-00-00)* + + The AI establishes the required named notation for a Stable_Properties aspect specification in order to avoid syntactic ambiguities. + + With the old syntax, an example like + + .. code:: + + type Ugh is ... + with Stable_Properties =\> Foo, Bar, Nonblocking, Pack; + + was problematic; ``Nonblocking`` and ``Pack`` are other aspects, while ``Foo`` and ``Bar`` are ``Stable_Properties`` functions. With the clarified syntax, the example above shall be written as: + + .. code:: + + type Ugh is ... + with Stable_Properties => (Foo, Bar), Nonblocking, Pack; + + RM references: 7.03.04 (2/5) 7.03.04 (3/5) 7.03.04 (4/5) 7.03.04 (6/5) + 7.03.04 (7/5) 7.03.04 (9/5) 7.03.04 (10/5) 7.03.04 (14/5) 13.01.01 (4/5) + +.. index:: AI12-0287 (Ada 2022 feature) + +* *AI12-0287 Legality Rules for null exclusions in renaming are too fierce (2020-02-17)* + + The null exclusion legality rules for generic formal object matching and object renaming now only apply to generic formal objects with mode in out. + + RM references: 8.05.01 (4.4/2) 8.05.01 (4.5/2) 8.05.01 (4.6/2) 8.05.04 + (4.2/2) 12.04 (8.3/2) 12.04 (8.4/2) 12.04 (8.5/2) 12.04 (8.2/5) + 12.06 (8.2/5) + +.. index:: AI12-0289 (Ada 2022 feature) + +* *AI12-0289 Implicitly null excluding anonymous access types and conformance (2020-06-09)* + + AI12-0289 is implemented for Ada 2022, allowing safer use of access parameters + when the partial view of the designated type is untagged, but the full view is + tagged. + + RM references: 3.10 (26) + +.. index:: AI12-0290 (Ada 2022 feature) + +* *AI12-0290 Restriction Pure_Barriers (2020-02-18)* + + The GNAT implementation of the Pure_Barriers restriction has + been updated to match the Ada RM's definition as specified + in this AI. Some constructs that were accepted by the previous + implementation are now rejected, and vice versa. In + particular, the use of a component of a component of a + protected record in a barrier expression, as in "when + Some_Component.Another_Component =>", formerly was (at least + in some cases) not considered to be a violation of the + Pure_Barriers restriction; that is no longer the case. + + RM references: D.07 (2) D.07 (10.10/4) + +.. index:: AI12-0291 (Ada 2022 feature) + +* *AI12-0291 Jorvik Profile (2020-02-19)* + + The Jorvik profile is now implemented, as defined in this AI. + For Ada 2012 and earlier versions of Ada, Jorvik is an implementation-defined + profile whose definition matches its Ada 2022 definition. + + RM references: D.13 (0) D.13 (1/3) D.13 (4/3) D.13 (6/4) D.13 (9/3) D.13 + (10/3) D.13 (11/4) D.13 (12/4) + +.. index:: AI12-0293 (Ada 2022 feature) + +* *AI12-0293 Add predefined FIFO_Streams packages (0000-00-00)* + + The AI adds ``Ada.Streams.Storage`` and its two subunits ``Bounded`` and ``Unbounded``. + + RM references: 13.13.01 (1) 13.13.01 (9) 13.13.01 (9.1/1) + +.. index:: AI12-0295 (Ada 2022 feature) + +* *AI12-0295 User-defined string (2020-04-07)* + + Compiler support is added for three new aspects (``Integer_Literal``, ``Real_Literal``, and ``String_Literal``) as described in AI12-0249 (for ``Integer_Literal`` and ``Real_Literal``), AI12-0295 (for ``String_Literal``), and in two follow-up AIs (AI12-0325 and AI12-0342). For pre-Ada 2022 versions of Ada, these are treated as implementation-defined aspects. Some implementation work remains, particularly in the interactions between these aspects and tagged types. + + RM references: 4.02 (6) 4.02 (10) 4.02 (11) 3.06.03 (1) 4.02.01 (0) 4.09 (26/3) + +.. index:: AI12-0301 (Ada 2022 feature) + +* *AI12-0301 Predicates should be checked like constraints for types with Default_Value (2020-02-25)* + + This AI clarifies that predicate checks apply for objects that are initialized + by default and that are of a type that has any components whose subtypes specify ``Default_Value`` or ``Default_Component_Value``. + + RM references: 3.02.04 (31/4) + +.. index:: AI12-0304 (Ada 2022 feature) + +* *AI12-0304 Image attributes of language-defined types (2020-07-07)* + + According to this AI, ``Put_Image`` (and therefore ``'Image``) is provided for + the containers and for unbounded strings. + + RM references: 4.10 (0) + +.. index:: AI12-0306 (Ada 2022 feature) + +* *AI12-0306 Split null array aggregates from positional array aggregates (0000-00-00)* + + The AI clarifies the wording of the references RM paragraphs without introducing any language changes. + + RM references: 4.03.03 (2) 4.03.03 (3/2) 4.03.03 (9/5) 4.03.03 (26/5) + 4.03.03 (26.1/5) 4.03.03 (33/3) 4.03.03 (38) 4.03.03 (39) 4.03.03 (42) + +.. index:: AI12-0307 (Ada 2022 feature) + +* *AI12-0307 Resolution of aggregates (2020-08-13)* + + The proposed new syntax for aggregates in Ada 2022 uses square brackets as + delimiters, and in particular allows ``[]`` as a notation for empty array and container aggregates. This syntax is currently available as an experimental feature under the ``-gnatX`` flag. + + RM references: 4.03 (3/5) + +.. index:: AI12-0309 (Ada 2022 feature) + +* *AI12-0309 Missing checks for pragma Suppress (0000-00-00)* + + The AI includes some previously overlooked run-time checks in the list of checks that are potentially suppressed via a pragma ``Suppress``. For example, AI12-0251-1 adds a check that the number of chunks in a chunk_specification is not zero or negative. Clarify that suppressing ``Program_Error_Check`` suppresses that check too. + + RM references: 11.05 (10) 11.05 (19) 11.05 (20) 11.05 (22) 11.05 (24) + +.. index:: AI12-0311 (Ada 2022 feature) + +* *AI12-0311 Suppressing client-side assertions for language-defined units (0000-00-00)* + + The AI defines some new assertion policies that can be given as arguments in a Suppress pragma (e.g., Calendar_Assertion_Check). GNAT recognizes and ignores those new policies, the checks are not implemented. + + RM references: 11.04.02 (23.5/5) 11.05 (23) 11.05 (26) + +.. index:: AI12-0315 (Ada 2022 feature) + +* *AI12-0315 Image Attributes subclause improvements (0000-00-00)* + + Clarify that a named number or similar can be the prefix of an Image attribute reference. + + RM references: 4.10 (0) + +.. index:: AI12-0318 (Ada 2022 feature) + +* *AI12-0318 No_IO should apply to Ada.Directories (2020-01-31)* + + The restriction No_IO now applies to and prevents the use of the + ``Ada.Directories package``. + + RM references: H.04 (20/2) H.04 (24/3) + +.. index:: AI12-0321 (Ada 2022 feature) + +* *AI12-0321 Support for Arithmetic Atomic Operations and Test and Set (0000-00-00)* + + The AI adds some predefined atomic operations, e.g. package System.``Atomic_Operations.Test_And_Set``. + + RM references: C.06.03 (0) C.06.04 (0) + +.. index:: AI12-0325 (Ada 2022 feature) + +* *AI12-0325 Various issues with user-defined literals (2020-04-07)* + + Compiler support is added for three new aspects (``Integer_Literal``, ``Real_Literal``, and ``String_Literal``) as described in AI12-0249 (for ``Integer_Literal`` and ``Real_Literal``), AI12-0295 (for ``String_Literal``), and in two follow-up AIs (AI12-0325 and AI12-0342). For pre-Ada 2022 versions of Ada, these are treated as implementation-defined aspects. Some implementation work remains, particularly in the interactions between these aspects and tagged types. + + RM references: 4.02 (6) 4.02 (10) 4.02 (11) 4.02.01 (0) + +.. index:: AI12-0329 (Ada 2022 feature) + +* *AI12-0329 Naming of FIFO_Streams packages (0000-00-00)* + + The AI changes the name of predefined package ``Ada.Streams.FIFO_Streams`` to ``Ada.Streams.Storage``. + + RM references: 13.13.01 (9/5) 13.13.01 (9.1/5) + +.. index:: AI12-0331 (Ada 2022 feature) + +* *AI12-0331 Order of finalization of a subpool (0000-00-00)* + + Clarify that when a subpool is being finalized, objects allocated from that subpool are finalized before (not after) they cease to exist (i.e. object's storage has been reclaimed). + + RM references: 13.11.05 (5/3) 13.11.05 (6/3) 13.11.05 (7/3) 13.11.05 + (7.1/4) 13.11.05 (8/3) 13.11.05 (9/3) + +.. index:: AI12-0333 (Ada 2022 feature) + +* *AI12-0333 Predicate checks on out parameters (0000-00-00)* + + If a view conversion is passed as an actual parameter corresponding to an out-mode formal parameter, and if the subtype of the formal parameter has a predicate, then no predicate check associated with the conversion is performed. + + RM references: 3.02.04 (31/5) 4.06 (51/4) 6.04.01 (14) + +.. index:: AI12-0335 (Ada 2022 feature) + +* *AI12-0335 Dynamic accessibility check needed for some requeue targets (0000-00-00)* + + Define a new runtime accessibility check for a corner case involving requeue statements. + + RM references: 9.05.04 (7/4) + +.. index:: AI12-0336 (Ada 2022 feature) + +* *AI12-0336 Meaning of Time_Offset (0000-00-00)* + + The AI introduces changes to the predefined package ``Ada.Calendar.Time_Zones``. + + RM references: 9.06.01 (6/2) 9.06.01 (35/2) 9.06.01 (40/2) 9.06.01 (41/2) + 9.06.01 (42/3) 9.06.01 (90/2) 9.06.01 (91/2) + +.. index:: AI12-0337 (Ada 2022 feature) + +* *AI12-0337 Simple_Name("/") in Ada.Directories (0000-00-00)* + + Clarify behavior of subprograms in the predefined package ``Ada.Directories``. In particular, Simple_Name ("/") should return "/" on Unix-like systems. + + RM references: A.16 (47/2) A.16 (74/2) A.16 (82/3) + +.. index:: AI12-0338 (Ada 2022 feature) + +* *AI12-0338 Type invariant checking and incomplete types (0000-00-00)* + + Clarify that type invariants for type T are not checked for incomplete types whose completion is not available, even if that completion has components of type T. + + RM references: 7.03.02 (20/5) + +.. index:: AI12-0339 (Ada 2022 feature) + +* *AI12-0339 Empty function for Container aggregates (2020-08-06)* + + To provide uniform support for container aggregates, all standard container + libraries have been enhanced with a function Empty, to be used when initializing an aggregate prior to inserting the specified elements in the object being constructed. All products have been updated to remove the ambiguities that may have arisen from previous uses of entities named Empty in our sources, and the expansion of container aggregates uses Empty wherever needed. + + RM references: A.18.02 (8/5) A.18.02 (12.3/5) A.18.02 (78.2/5) A.18.02 + (98.6/5) A.18.03 (6/5) A.18.03 (10.2/5) A.18.03 (50.2/5) A.18.05 + (3/5) A.18.05 (7.2/5) A.18.05 (37.3/5) A.18.05 (46/2) A.18.06 + (4/5) A.18.06 (8.2/5) A.18.06 (51.4/5) A.18.08 (3/5) A.18.08 + (8.1/5) A.18.08 (59.2/5) A.18.08 (68/2) A.18.09 (4/5) A.18.09 + (9.1/5) A.18.09 (74.2/5) A.18.10 (15.2/5) A.18.18 (8.1/5) A.18.19 + (6.1/5) A.18.20 (6/3) A.18.21 (6/3) A.18.22 (6/3) A.18.23 (6/3) + A.18.24 (6/3) A.18.25 (8/3) + +.. index:: AI12-0340 (Ada 2022 feature) + +* *AI12-0340 Put_Image should use a Text_Buffer (0000-00-00)* + + Add a new predefined package Ada.Strings.Text_Buffers (along with child units) and change the definition of Put_Image attribute to refer to it. + + RM references: A.04.12 (0) 4.10 (3.1/5) 4.10 (3.2/5) 4.10 (6/5) 4.10 + (25.2/5) 4.10 (28/5) 4.10 (31/5) 4.10 (41/5) H.04 (23.2/5) H.04 (23.11/5) + +.. index:: AI12-0342 (Ada 2022 feature) + +* *AI12-0342 Various issues with user-defined literals (part 2) (2020-04-07)* + + Compiler support is added for three new aspects (``Integer_Literal``, ``Real_Literal``, and ``String_Literal``) as described in AI12-0249 (for ``Integer_Literal`` and ``Real_Literal``), AI12-0295 (for ``String_Literal``), and in two follow-up AIs (AI12-0325 and AI12-0342). For pre-Ada 2022 versions of Ada, these are treated as implementation-defined aspects. Some implementation work remains, particularly in the interactions between these aspects and tagged types. + + RM references: 4.02.01 (0) 3.09.02 (1/2) 6.03.01 (22) + +.. index:: AI12-0343 (Ada 2022 feature) + +* *AI12-0343 Return Statement Checks (2020-04-02)* + + This binding interpretation has been implemented and the accessibility, + predicate, and tag checks prescribed by RM 6.5 are now performed at the appropriate points, as required by this AI. + + RM references: 6.05 (5.12/5) 6.05 (8/4) 6.05 (8.1/3) 6.05 (21/3) + +.. index:: AI12-0345 (Ada 2022 feature) + +* *AI12-0345 Dynamic accessibility of explicitly aliased parameters (0000-00-00)* + + Further clarify (after AI12-0277) accessibility rules for explicitly aliased parameters. + + RM references: 3.10.02 (5) 3.10.02 (7/4) 3.10.02 (10.5/3) 3.10.02 (13.4/4) + 3.10.02 (19.2/5) 3.10.02 (21) + +.. index:: AI12-0350 (Ada 2022 feature) + +* *AI12-0350 Swap for Indefinite_Holders (0000-00-00)* + + Add a ``Swap`` procedure to the predefined package + ``Ada.Containers.Indefinite_Holders``. The AI also contains implementation advice for ``Ada.Containers.Bounded_Indefinite_Holders``, a package that is not implemented by GNAT. + + RM references: A.18.18 (22/5) A.18.18 (67/5) A.18.18 (73/3) A.18.32 (13/5) + +.. index:: AI12-0351 (Ada 2022 feature) + +* *AI12-0351 Matching for actuals for formal derived types (2020-04-03)* + + This binding interpretation requires the compiler to checks + that an actual subtype in a generic parameter association of an instantiation is statically compatible (even when the actual is unconstrained) with the ancestor of an associated nondiscriminated generic formal derived type. + + RM references: 12.05.01 (7) 12.05.01 (8) + +.. index:: AI12-0352 (Ada 2022 feature) + +* *AI12-0352 Early derivation and equality of untagged types (2020-07-09)* + + AI12-0352 clarifies that declaring a user-defined primitive equality operation for a record type T is illegal if it occurs after a type has been derived from T. + + RM references: 4.05.02 (9.8/4) + +.. index:: AI12-0356 (Ada 2022 feature) + +* *AI12-0356 Root_Storage_Pool_With_Subpools should have Preelaborable_Initialization (0000-00-00)* + + Add Preelaborable_Initialization pragmas for predefined types ``Root_Storage_Pool_With_Subpools`` and ``Root_Subpool``. + + RM references: 13.11.04 (4/3) 13.11.04 (5/3) + +.. index:: AI12-0363 (Ada 2022 feature) + +* *AI12-0363 Fixes for Atomic and Volatile (2020-09-08)* + + This amendment has been implemented under the ``-gnat2022`` switch and the compiler now supports the ``Full_Access_Only`` aspect, which is mostly equivalent to GNAT's ``Volatile_Full_Access``. + + RM references: 3.10.02 (26/3) 9.10 (1/5) C.06 (6.4/3) C.06 (6.10/3) C.06 + (8.1/4) C.06 (12/5) C.06 (12.1/5) C.06 (13.3/5) C.06 (19.1/5) + +.. index:: AI12-0364 (Ada 2022 feature) + +* *AI12-0364 Add a modular atomic arithmetic package (0000-00-00)* + + Generalize support for atomic integer operations to extend to modular types. Add new predefined generic package, + ``System.Atomic_Operations.Modular_Arithmetic``. + + RM references: C.06.05 (0) C.06.04 (1/5) C.06.04 (2/5) C.06.04 (3/5) + C.06.04 (9/5) + +.. index:: AI12-0366 (Ada 2022 feature) + +* *AI12-0366 Changes to Big_Integer and Big_Real (0000-00-00)* + + Simplify ``Big_Integer ``and ``Big_Real`` specs by eliminating explicit support for creating "invalid" values. No more + ``Optional_Big_[Integer,Real]`` types. + + RM references: A.05.06 (0) A.05.07 (0) + +.. index:: AI12-0367 (Ada 2022 feature) + +* *AI12-0367 Glitches in aspect specifications (0000-00-00)* + + The AI clarifies a few wording omissions. For example, a specified Small value for a fixed point type has to be positive. + + RM references: 3.05.09 (8/2) 3.05.10 (2/1) 13.01 (9.1/5) 13.14 (10) + +.. index:: AI12-0368 (Ada 2022 feature) + +* *AI12-0368 Declare expressions can be static (2020-05-30)* + + AI12-0368 allows declare expressions to be static in Ada 2022. + + RM references: 4.09 (8) 4.09 (12.1/3) 4.09 (17) 6.01.01 (24.2/5) 6.01.01 + (24.3/5) 6.01.01 (24.4/5) 6.01.01 (24.5/5) C.04 (9) + +.. index:: AI12-0369 (Ada 2022 feature) + +* *AI12-0369 Relaxing barrier restrictions (2020-03-25)* + + The definitions of the ``Simple_Barriers`` and ``Pure_Barriers`` restrictions were modified by this AI, replacing uses of "statically denotes" with "statically names". This means that in many cases (but not all) a barrier expression that references a subcomponent of a component of the protected type while subject to either of the two restrictions is now allowed; with the previous restriction definitions, such a barrier expression would not have been legal. + + RM references: D.07 (1.3/5) D.07 (10.12/5) + +.. index:: AI12-0372 (Ada 2022 feature) + +* *AI12-0372 Static accessibility of "master of the call" (0000-00-00)* + + Add an extra compile-time accessibility check for explicitly aliased parameters needed to prevent dangling references. + + RM references: 3.10.02 (10.5/5) 3.10.02 (19.3/4) 6.04.01 (6.4/3) + +.. index:: AI12-0373 (Ada 2022 feature) + +* *AI12-0373 Bunch of fixes (0000-00-00)* + + Small clarifications to various RM entries with minor impact on compiler implementation. + + RM references: 3.01 (1) 4.02 (4) 4.02 (8/2) 4.02.01 (3/5) 4.02.01 (4/5) + 4.02.01 (5/5) 4.09 (17.3/5) 6.01.01 (41/5) 8.05.04 (4/3) 13.01.01 + (4/3) 13.01.01 (11/3) 13.14 (3/5) + +.. index:: AI12-0376 (Ada 2022 feature) + +* *AI12-0376 Representation changes finally allowed for untagged derived types (0000-00-00)* + + A change of representation for a derived type is allowed in some previously-illegal cases where a change of representation is required to implement a call to a derived subprogram. + + RM references: 13.01 (10/4) + +.. index:: AI12-0377 (Ada 2022 feature) + +* *AI12-0377 View conversions and out parameters of types with Default_Value revisited (2020-06-17)* + + This AI clarifies that an actual of an out parameter that is a view conversion + is illegal if either the target or operand type has Default_Value specified while the other does not. + + RM references: 6.04.01 (5.1/4) 6.04.01 (5.2/4) 6.04.01 (5.3/4) 6.04.01 + (13.1/4) 6.04.01 (13.2/4) 6.04.01 (13.3/4) 6.04.01 (13.4/4) 6.04.01 (15/3) + +.. index:: AI12-0381 (Ada 2022 feature) + +* *AI12-0381 Tag of a delta aggregate (0000-00-00)* + + In the case of a delta aggregate of a specific tagged type, the tag of the aggregate comes from the specific type (as opposed to somehow from the base object). + + RM references: 4.03.04 (14/5) + +.. index:: AI12-0382 (Ada 2022 feature) + +* *AI12-0382 Loosen type-invariant overriding requirement of AI12-0042-1 (0000-00-00)* + + The AI relaxes some corner-case legality rules about type invariants that were added by AI12-0042-1. + + RM references: 7.3.2(6.1/4) + +.. index:: AI12-0383 (Ada 2022 feature) + +* *AI12-0383 Renaming values (2020-06-17)* + + This AI allow names that denote values rather than objects to nevertheless be + renamed using an object renaming. + + RM references: 8.05.01 (1) 8.05.01 (4) 8.05.01 (4.1/2) 8.05.01 (6/2) 8.05.01 (8) + +.. index:: AI12-0384-2 (Ada 2022 feature) + +* *AI12-0384-2 Fixups for Put_Image and Text_Buffers (2021-04-29)* + + In GNAT's initial implementation of the Ada 2022 ``Put_Image`` aspect and + attribute, buffering was performed using a GNAT-defined package, + ``Ada.Strings.Text_Output``. Ada 2022 requires a different package, Ada.``Strings.Text_Buffers``, for this role, and that package is now provided, and the older package is eliminated. + + RM references: 4.10 (0) A.04.12 (0) + +.. index:: AI12-0385 (Ada 2022 feature) + +* *AI12-0385 Predefined shifts and rotates should be static (0000-00-00)* + + This AI allows Shift and Rotate operations in static expressions. GNAT implements this AI partially. + + RM references: 4.09 (20) + +.. index:: AI12-0389 (Ada 2022 feature) + +* *AI12-0389 Ignoring unrecognized aspects (2020-10-08)* + + Two new restrictions, ``No_Unrecognized_Aspects`` and ``No_Unrecognized_Pragmas``, are available to make the compiler emit error messages on unrecognized pragmas and aspects. + + RM references: 13.01.01 (38/3) 13.12.01 (6.3/3) + +.. index:: AI12-0394 (Ada 2022 feature) + +* *AI12-0394 Named Numbers and User-Defined Numeric Literals (2020-10-05)* + + Ada 2022 allows using integer named numbers with types that have an + ``Integer_Literal`` aspect. Similarly, real named numbers may now be used with types that have a ``Real_Literal`` aspect with an overloading that takes two strings, to be used in particular with + ``Ada.Numerics.Big_Numbers.Big_Reals``. + + RM references: 3.03.02 (3) 4.02.01 (4/5) 4.02.01 (8/5) 4.02.01 (12/5) + 4.02.01 (13/5) 4.09 (5) + +.. index:: AI12-0395 (Ada 2022 feature) + +* *AI12-0395 Allow aspect_specifications on formal parameters (0000-00-00)* + + Change syntax rules to allow aspect_specifications on formal parameters, if an implementation if an implementation wants to define one. Currently, GNAT doesn't define any such aspect_specifications. + + RM references: 6.01 (15/3) + +.. index:: AI12-0397 (Ada 2022 feature) + +* *AI12-0397 Default_Initial_Condition applied to derived type (2020-12-09)* + + The compiler now implements the rules for resolving ``Default_Initial_Condition`` + expressions that involve references to the current instance of types with the aspect, as specified by this AI. The type of the current instance is defined to be like a formal derived type, so for a derived type that inherits the aspect, a call passing the current instance to a primitive means that the call will resolve to invoke the corresponding primitive of the descendant type. This also now permits calls to abstract primitives to occur within the aspect expression of an abstract type. + + RM references: 7.03.03 (3/5) 7.03.03 (6/5) 7.03.03 (8/5) + +.. index:: AI12-0398 (Ada 2022 feature) + +* *AI12-0398 Most declarations should have aspect specifications (2020-11-19)* + + It is now possible to specify aspects for discriminant specifications, extended return object declarations, and entry index specifications. This is an extension added for Ada 2022 by this AI. + + RM references: 3.07 (5/2) 6.03.01 (25) 6.05 (2.1/3) 9.05.02 (8) + +.. index:: AI12-0399 (Ada 2022 feature) + +* *AI12-0399 Aspect specification for Preelaborable_Initialization (0000-00-00)* + + Semantics-preserving presentation change. Replace ``Preelaborable_Initialization`` pragmas with equivalent aspect specs in the listed predefined packages. GNAT follows the guidance of this AI partially. + + RM references: 9.05 (53/5) 3.09 (6/5) 7.06 (5/2) 7.06 (7/2) 11.04.01 (2/5) + 11.04.01 (3/2) 13.11 (6/2) 13.11.04 (4/5) 13.11.04 (5/5) 13.13.01 + (3/2) A.04.02 (4/2) A.04.02 (20/2) A.04.05 (4/2) A.04.07 (4/2) + A.04.07 (20/2) A.04.08 (4/2) A.04.08 (20/2) A.12.01 (5/4) A.18.02 + (8/5) A.18.02 (9/2) A.18.02 (79.2/5) A.18.02 (79.3/5) A.18.03 + (6/5) A.18.03 (7/2) A.18.03 (50.2/5) A.18.03 (50.3/5) A.18.05 + (3/5) A.18.05 (4/2) A.18.05 (37.3/5) A.18.05 (37.4/5) A.18.06 + (4/5) A.18.06 (5/2) A.18.06 (51.4/5) A.18.06 (51.5/5) A.18.08 + (3/5) A.18.08 (4/2) A.18.08 (58.2/5) A.18.08 (58.3/5) A.18.09 + (4/5) A.18.09 (5/2) A.18.09 (74.2/5) A.18.09 (74.3/5) A.18.10 + (8/5) A.18.10 (9/3) A.18.10 (70.2/5) A.18.10 (70.3/5) A.18.18 + (6/5) B.03.01 (5/2) C.07.01 (2/5) G.01.01 (4/2) + +.. index:: AI12-0400 (Ada 2022 feature) + +* *AI12-0400 Ambiguities associated with Vector Append and container aggregates (0000-00-00)* + + Change the names of subprograms in the predefined Vector containers from ``Append`` to ``Append_Vector`` and from ``Prepend`` to ``Prepend_Vector`` in order to resolve some ambiguity problems. GNAT adds the subprograms with new names but also keeps the old ones for backward compatibility. + + RM references: A.18.02 (8/5) A.18.02 (36/5) A.18.02 (37/5) A.18.02 (38/5) + A.18.02 (44/5) A.18.02 (46/5) A.18.02 (47/5) A.18.02 (58/5) + A.18.02 (79.2/5) A.18.02 (150/5) A.18.02 (151/5) A.18.02 (152/5) + A.18.02 (153/5) A.18.02 (154/5) A.18.02 (155/5) A.18.02 (156/5) + A.18.02 (168/5) A.18.02 (169/5) A.18.02 (172/5) A.18.02 (173/5) + A.18.02 (174/5) A.18.02 (175.1/5) A.18.03 (23/5) A.18.03 (23.1/5) + A.18.03 (58.2/5) A.18.03 (96/5) A.18.03 (97.1/5) + +.. index:: AI12-0401 (Ada 2022 feature) + +* *AI12-0401 Renaming of qualified expression of variable (2020-10-31)* + + Ada 2022 AI12-0401 restricts renaming of a qualified expression to cases where + the operand is a constant, or the target subtype statically matches the nominal subtype of the operand, or is unconstrained with no predicates, to prevent setting variables to values outside their range or constraints. + + RM references: 3.03 (23.2/3) 8.05.01 (4.7/5) 8.05.01 (5/3) + +.. index:: AI12-0409 (Ada 2022 feature) + +* *AI12-0409 Preelaborable_Initialization and bounded containers (2021-06-23)* + + As defined by this AI, the ``Preelaborable_Initializatio`` aspect now has a + corresponding attribute of the same name. Types declared within a generic package specification are permitted to specify the expression of a ``Prelaborable_Initialization`` aspect by including one or more references to the attribute applied to a formal private or formal derived type conjoined by ``and`` operators. This permits the full type of a private type with such an aspect expression to have components of the named formal types, and such a type will have preelaborable initialization in an instance when the + actual types for all referenced formal types have preelaborable initialization. + + RM references: 10.02.01 (4.1/2) 10.02.01 (4.2/2) 10.02.01 (11.1/2) + 10.02.01 (11.2/2) 10.02.01 (11.6/2) 10.02.01 (11.7/2) 10.02.01 + (11.8/2) 13.01 (11/3) A.18.19 (5/5) A.18.20 (5/5) A.18.21 (5/5) + A.18.22 (5/5) A.18.23 (5/5) A.18.24 (5/5) A.18.25 (5/5) A.18.32 + (6/5) J.15.14 (0) + +.. index:: AI12-0411 (Ada 2022 feature) + +* *AI12-0411 Add "bool" to Interfaces.C (0000-00-00)* + + RM references: B.03 (13) B.03 (43/2) B.03 (65.1/4) + +.. index:: AI12-0412 (Ada 2022 feature) + +* *AI12-0412 Abstract Pre/Post'Class on primitive of abstract type (2021-05-19)* + + In Ada 2022, by AI12-0412, it's legal to specify Pre'Class and Post'Class + aspects on nonabstract primitive subprograms of an abstract type, but if the + expression of such an aspect is nonstatic, then it's illegal to make a nondispatching call to such a primitive, to apply ``'Access`` to it, or to pass such a primitive as an actual subprogram for a concrete formal subprogram in a generic instantiation. + + RM references: 6.01.01 (18.2/4) + +.. index:: AI12-0413 (Ada 2022 feature) + +* *AI12-0413 Reemergence of "=" when defined to be abstract (0000-00-00)* + + The AI clarifies rules about operator reemergence in instances, and nondispatching calls to abstract subprograms. + + RM references: 3.09.03 (7) 4.05.02 (14.1/3) 4.05.02 (24.1/3) 12.05 (8/3) + +.. index:: AI12-0423 (Ada 2022 feature) + +* *AI12-0423 Aspect inheritance fixups (0000-00-00)* + + Clarify that the No_Return aspect behaves as one would expect for an inherited subprogram and that inheritance works as one would expect for a multi-part aspect whose value is specified via an aggregate (e.g., the Aggregate aspect). + + RM references: 6.05.01 (3.3/3) 13.01 (15.7/5) 13.01 (15.8/5) + +.. index:: AI12-0432 (Ada 2022 feature) + +* *AI12-0432 View conversions of assignments and predicate checks (2021-05-05)* + + When a predicate applies to a tagged type, a view conversion to that type + normally requires a predicate check. However, as specified by AI12-0432, when the view conversion appears as the target of an assignment, a predicate check is not applied to the object in the conversion. + + RM references: 3.02.04 (31/5) 4.06 (51.1/5) diff --git a/gcc/ada/doc/gnat_rm/representation_clauses_and_pragmas.rst b/gcc/ada/doc/gnat_rm/representation_clauses_and_pragmas.rst index b0e131f..7250f65 100644 --- a/gcc/ada/doc/gnat_rm/representation_clauses_and_pragmas.rst +++ b/gcc/ada/doc/gnat_rm/representation_clauses_and_pragmas.rst @@ -1872,7 +1872,7 @@ conventions, and for example records are laid out in a manner that is consistent with C. This means that specifying convention C (for example) has no effect. -There are four exceptions to this general rule: +There are three exceptions to this general rule: * *Convention Fortran and array subtypes*. diff --git a/gcc/ada/doc/gnat_rm/specialized_needs_annexes.rst b/gcc/ada/doc/gnat_rm/specialized_needs_annexes.rst index 15b4a94..f34368c 100644 --- a/gcc/ada/doc/gnat_rm/specialized_needs_annexes.rst +++ b/gcc/ada/doc/gnat_rm/specialized_needs_annexes.rst @@ -4,9 +4,7 @@ Specialized Needs Annexes ************************* -Ada 95, Ada 2005, and Ada 2012 define a number of Specialized Needs Annexes, which are not -required in all implementations. However, as described in this chapter, -GNAT implements all of these annexes: +Ada 95, Ada 2005, Ada 2012, and Ada 2022 define a number of Specialized Needs Annexes, which are not required in all implementations. However, as described in this chapter, GNAT implements all of these annexes: *Systems Programming (Annex C)* The Systems Programming Annex is fully implemented. @@ -18,9 +16,8 @@ GNAT implements all of these annexes: *Distributed Systems (Annex E)* Stub generation is fully implemented in the GNAT compiler. In addition, - a complete compatible PCS is available as part of the GLADE system, - a separate product. When the two - products are used in conjunction, this annex is fully implemented. + a complete compatible PCS is available as part of ``PolyORB``, + a separate product. Note, that PolyORB is a deprecated product and will be eventually replaced with other technologies such as ``RTI``. *Information Systems (Annex F)* @@ -34,4 +31,3 @@ GNAT implements all of these annexes: *Safety and Security / High-Integrity Systems (Annex H)* The Safety and Security Annex (termed the High-Integrity Systems Annex in Ada 2005) is fully implemented. - diff --git a/gcc/ada/doc/gnat_rm/the_gnat_library.rst b/gcc/ada/doc/gnat_rm/the_gnat_library.rst index ac45b5e..d041090 100644 --- a/gcc/ada/doc/gnat_rm/the_gnat_library.rst +++ b/gcc/ada/doc/gnat_rm/the_gnat_library.rst @@ -2037,7 +2037,7 @@ technically an implementation-defined addition). This package provides facilities for partition interfacing. It is used primarily in a distribution context when using Annex E -with ``GLADE``. +with ``PolyORB``. .. _`System.Pool_Global_(s-pooglo.ads)`: diff --git a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst index 4f46fba..fdf1948 100644 --- a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst +++ b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst @@ -2112,7 +2112,7 @@ Alphabetical List of All Switches .. index:: -gnatR (gcc) -:switch:`-gnatR[0|1|2|3|4][e][j][m][s]` +:switch:`-gnatR[0|1|2|3|4][e][h][m][j][s]` Output representation information for declared types, objects and subprograms. Note that this switch is not allowed if a previous :switch:`-gnatD` switch has been given, since these two switches @@ -2259,15 +2259,16 @@ Alphabetical List of All Switches ======= ================================================================== *n* Effect ------- ------------------------------------------------------------------ - *0* No optimization, the default setting if no :switch:`-O` appears - *1* Normal optimization, the default if you specify :switch:`-O` without an - operand. A good compromise between code quality and compilation - time. - *2* Extensive optimization, may improve execution time, possibly at + *0* No optimization, the default setting if no :switch:`-O` appears. + *1* Moderate optimization, same as :switch:`-O` without an operand. + A good compromise between code quality and compilation time. + *2* Extensive optimization, should improve execution time, possibly at the cost of substantially increased compilation time. - *3* Same as :switch:`-O2`, and also includes inline expansion for small - subprograms in the same unit. - *s* Optimize space usage + *3* Full optimization, may further improve execution time, possibly at + the cost of substantially larger generated code. + *s* Optimize for size (code and data) rather than speed. + *z* Optimize aggressively for size (code and data) rather than speed. + *g* Optimize for debugging experience rather than speed. ======= ================================================================== See also :ref:`Optimization_Levels`. @@ -6088,7 +6089,7 @@ Debugging Control .. index:: -gnatR (gcc) -:switch:`-gnatR[0|1|2|3|4][e][j][m][s]` +:switch:`-gnatR[0|1|2|3|4][e][h][m][j][s]` This switch controls output from the compiler of a listing showing representation information for declared types, objects and subprograms. For :switch:`-gnatR0`, no information is output (equivalent to omitting @@ -6116,17 +6117,21 @@ Debugging Control extended representation information for record sub-components of records is included. + If the switch is followed by a ``h`` (e.g. :switch:`-gnatR3h`), then + the components of records are sorted by increasing offsets and holes + between consecutive components are flagged. + If the switch is followed by an ``m`` (e.g. :switch:`-gnatRm`), then subprogram conventions and parameter passing mechanisms for all the subprograms are included. - If the switch is followed by a ``j`` (e.g., :switch:`-gnatRj`), then + If the switch is followed by a ``j`` (e.g. :switch:`-gnatRj`), then the output is in the JSON data interchange format specified by the ECMA-404 standard. The semantic description of this JSON output is available in the specification of the Repinfo unit present in the compiler sources. - If the switch is followed by an ``s`` (e.g., :switch:`-gnatR3s`), then + If the switch is followed by an ``s`` (e.g. :switch:`-gnatR3s`), then the output is to a file with the name :file:`file.rep` where ``file`` is the name of the corresponding source file, except if ``j`` is also specified, in which case the file name is :file:`file.json`. @@ -8123,6 +8128,9 @@ We provide two options that you can use to build code with GNAT LLVM: which version of GNAT built that file because it contains either :code:`GNAT` or :code:`GNAT-LLVM`. + You can also explicitly select GNAT LLVM in your existing GPR project + file by adding :code:`for Toolchain_Name("Ada") use "GNAT_LLVM";` + .. only:: PRO If your project uses one of the libraries packaged with the GCC diff --git a/gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst b/gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst index 756bc74..031fafc 100644 --- a/gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst +++ b/gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst @@ -23,6 +23,7 @@ This chapter covers several topics: * `Performing Dimensionality Analysis in GNAT`_ * `Stack Related Facilities`_ * `Memory Management Issues`_ +* `Sanitizers for Ada`_ .. _Running_and_Debugging_Ada_Programs: @@ -1584,18 +1585,16 @@ Turning on optimization makes the compiler attempt to improve the performance and/or code size at the expense of compilation time and possibly the ability to debug the program. -If you use multiple :switch:`-O` switches, with or without level -numbers, the last such switch is the one that's used. - -You can use the -:switch:`-O` switch (the permitted forms are :switch:`-O0`, :switch:`-O1` -:switch:`-O2`, :switch:`-O3`, and :switch:`-Os`) -to ``gcc`` to control the optimization level: +You can pass the :switch:`-O` switch, with or without an operand +(the permitted forms with an operand are :switch:`-O0`, :switch:`-O1`, +:switch:`-O2`, :switch:`-O3`, :switch:`-Os`, :switch:`-Oz`, and +:switch:`-Og`) to ``gcc`` to control the optimization level. If you +pass multiple :switch:`-O` switches, with or without an operand, +the last such switch is the one that's used: * :switch:`-O0` - No optimization (the default); - generates unoptimized code but has + No optimization (the default); generates unoptimized code but has the fastest compilation time. Debugging is easiest with this switch. Note that many other compilers do substantial optimization even if @@ -1606,32 +1605,45 @@ to ``gcc`` to control the optimization level: mind when doing performance comparisons. * :switch:`-O1` - Moderate optimization; optimizes reasonably well but does not - degrade compilation time significantly. You may not be able to see - some variables in the debugger and changing the value of some - variables in the debugger may not have the effect you desire. + Moderate optimization (same as :switch:`-O` without an operand); + optimizes reasonably well but does not degrade compilation time + significantly. You may not be able to see some variables in the + debugger, and changing the value of some variables in the debugger + may not have the effect you desire. * :switch:`-O2` - Full optimization; - generates highly optimized code and has - the slowest compilation time. You may see significant impacts on + Extensive optimization; generates highly optimized code but has + an increased compilation time. You may see significant impacts on your ability to display and modify variables in the debugger. * :switch:`-O3` - Full optimization as in :switch:`-O2`; - also uses more aggressive automatic inlining of subprograms within a unit - (:ref:`Inlining_of_Subprograms`) and attempts to vectorize loops. - + Full optimization; attempts more sophisticated transformations, in + particular on loops, possibly at the cost of larger generated code. + You may be hardly able to use the debugger at this optimization level. * :switch:`-Os` - Optimize space usage (code and data) of resulting program. + Optimize for size (code and data) of resulting binary rather than + speed; based on the :switch:`-O2` optimization level, but disables + some of its transformations that often increase code size, as well + as performs further optimizations designed to reduce code size. + +* :switch:`-Oz` + Optimize aggressively for size (code and data) of resulting binary + rather than speed; may increase the number of instructions executed + if these instructions require fewer bytes to be encoded. + +* :switch:`-Og` + Optimize for debugging experience rather than speed; based on the + :switch:`-O1` optimization level, but attempts to eliminate all the + negative effects of optimization on debugging. + Higher optimization levels perform more global transformations on the program and apply more expensive analysis algorithms in order to generate faster and more compact code. The price in compilation time, and the -resulting improvement in execution time, -both depend on the particular application and the hardware environment. -You should experiment to find the best level for your application. +resulting improvement in execution time, both depend on the particular +application and the hardware environment. You should experiment to find +the best level for your application. Since the precise set of optimizations done at each level will vary from release to release (and sometime from target to target), it is best to think @@ -4122,3 +4134,325 @@ execution of this erroneous program: The allocation root #1 of the first example has been split in 2 roots #1 and #3, thanks to the more precise associated backtrace. + +.. _Sanitizers_for_Ada: + +Sanitizers for Ada +================== + +.. index:: Sanitizers + +This section explains how to use sanitizers with Ada code. Sanitizers offer code +instrumentation and run-time libraries that detect certain memory issues and +undefined behaviors during execution. They provide dynamic analysis capabilities +useful for debugging and testing. + +While many sanitizer capabilities overlap with Ada's built-in runtime checks, +they are particularly valuable for identifying issues that arise from unchecked +features or low-level operations. + +.. _AddressSanitizer: + +AddressSanitizer +---------------- + +.. index:: AddressSanitizer +.. index:: ASan +.. index:: -fsanitize=address + +AddressSanitizer (aka ASan) is a memory error detector activated with the +:switch:`-fsanitize=address` switch. Note that many of the typical memory errors, +such as use after free or buffer overflow, are detected by Ada’s ``Access_Check`` +and ``Index_Check``. + +It can detect the following types of problems: + +* Wrong memory overlay + + A memory overlay is a situation in which an object of one type is placed at the + same memory location as a distinct object of a different type, thus overlaying + one object over the other in memory. When there is an overflow because the + objects do not overlap (like in the following example), the sanitizer can signal + it. + + .. code-block:: ada + + procedure Wrong_Size_Overlay is + type Block is array (Natural range <>) of Integer; + + Block4 : aliased Block := (1 .. 4 => 4); + Block5 : Block (1 .. 5) with Address => Block4'Address; + begin + Block5 (Block5'Last) := 5; -- Outside the object + end Wrong_Size_Overlay; + + If the code is built with the :switch:`-fsanitize=address` and :switch:`-g` options, + the following error is shown at execution time: + + :: + + ... + SUMMARY: AddressSanitizer: stack-buffer-overflow wrong_size_overlay.adb:7 in _ada_wrong_size_overlay + ... + +* Buffer overflow + + Ada’s ``Index_Check`` detects buffer overflows caused by out-of-bounds array + access. If run-time checks are disabled, the sanitizer can still detect such + overflows at execution time the same way as it signalled the previous wrong + memory overlay. Note that if both the Ada run-time checks and the sanitizer + are enabled, the Ada run-time exception takes precedence. + + .. code-block:: ada + + procedure Buffer_Overrun is + Size : constant := 100; + Buffer : array (1 .. Size) of Integer := (others => 0); + Wrong_Index : Integer := Size + 1 with Export; + begin + -- Access outside the boundaries + Put_Line ("Value: " & Integer'Image (Buffer (Wrong_Index))); + end Buffer_Overrun; + +* Use after lifetime + + Ada’s ``Accessibility_Check`` helps prevent use-after-return and + use-after-scope errors by enforcing lifetime rules. When these checks are + bypassed using ``Unchecked_Access``, sanitizers can still detect such + violations during execution. + + .. code-block:: ada + + with Ada.Text_IO; use Ada.Text_IO; + + procedure Use_After_Return is + type Integer_Access is access all Integer; + Ptr : Integer_Access; + + procedure Inner; + + procedure Inner is + Local : aliased Integer := 42; + begin + Ptr := Local'Unchecked_Access; + end Inner; + + begin + Inner; + -- Accessing Local after it has gone out of scope + Put_Line ("Value: " & Integer'Image (Ptr.all)); + end Use_After_Return; + + If the code is built with the :switch:`-fsanitize=address` and :switch:`-g` + options, the following error is shown at execution time: + + :: + + ... + ==1793927==ERROR: AddressSanitizer: stack-use-after-return on address 0xf6fa1a409060 at pc 0xb20b6cb6cac0 bp 0xffffcc89c8b0 sp 0xffffcc89c8c8 + READ of size 4 at 0xf6fa1a409060 thread T0 + #0 0xb20b6cb6cabc in _ada_use_after_return use_after_return.adb:18 + ... + + Address 0xf6fa1a409060 is located in stack of thread T0 at offset 32 in frame + #0 0xb20b6cb6c794 in use_after_return__inner use_after_return.adb:9 + + This frame has 1 object(s): + [32, 36) 'local' (line 10) <== Memory access at offset 32 is inside this variable + SUMMARY: AddressSanitizer: stack-use-after-return use_after_return.adb:18 in _ada_use_after_return + ... + +* Memory leak + + A memory leak happens when a program allocates memory from the heap but fails + to release it after it is no longer needed and loses all references to it like + in the following example. + + .. code-block:: ada + + procedure Memory_Leak is + type Integer_Access is access Integer; + + procedure Allocate is + Ptr : Integer_Access := new Integer'(42); + begin + null; + end Allocate; + begin + -- Memory leak occurs in the following procedure + Allocate; + end Memory_Leak; + + If the code is built with the :switch:`-fsanitize=address` and :switch:`-g` + options, the following error is emitted at execution time showing the + location of the offending allocation. + + :: + + ==1810634==ERROR: LeakSanitizer: detected memory leaks + + Direct leak of 4 byte(s) in 1 object(s) allocated from: + #0 0xe3cbee4bb4a8 in __interceptor_malloc asan_malloc_linux.cpp:69 + #1 0xc15bb25d0af8 in __gnat_malloc (memory_leak+0x10af8) (BuildId: f5914a6eac10824f81d512de50b514e7d5f733be) + #2 0xc15bb25c9060 in memory_leak__allocate memory_leak.adb:5 + ... + + SUMMARY: AddressSanitizer: 4 byte(s) leaked in 1 allocation(s). + +.. _UndefinedBehaviorSanitizer: + +UndefinedBehaviorSanitizer +-------------------------- + +.. index:: UndefinedBehaviorSanitizer +.. index:: UBSan +.. index:: -fsanitize=undefined + +UndefinedBehaviorSanitizer (aka UBSan) modifies the program at compile-time to +catch various kinds of undefined behavior during program execution. + +Different sanitize options (:switch:`-fsanitize=alignment,float-cast-overflow,signed-integer-overflow`) +detect the following types of problems: + +* Wrong alignment + + The :switch:`-fsanitize=alignment` flag (included also in + :switch:`-fsanitize=undefined`) enables run-time checks for misaligned memory + accesses, ensuring that objects are accessed at addresses that conform to the + alignment constraints of their declared types. Violations may lead to crashes + or performance penalties on certain architectures. + + In the following example: + + .. code-block:: ada + + with Ada.Text_IO; use Ada.Text_IO; + with System.Storage_Elements; use System.Storage_Elements; + + procedure Misaligned_Address is + type Aligned_Integer is new Integer with + Alignment => 4; -- Ensure 4-byte alignment + + Reference : Aligned_Integer := 42; -- Properly aligned object + + -- Create a misaligned object by modifying the address manually + Misaligned : Aligned_Integer with Address => Reference'Address + 1; + + begin + -- This causes undefined behavior or an alignment exception on strict architectures + Put_Line ("Misaligned Value: " & Aligned_Integer'Image (Misaligned)); + end Misaligned_Address; + + If the code is built with the :switch:`-fsanitize=alignment` and :switch:`-g` + options, the following error is shown at execution time. + + :: + + misaligned_address.adb:15:51: runtime error: load of misaligned address 0xffffd836dd45 for type 'volatile misaligned_address__aligned_integer', which requires 4 byte alignment + +* Signed integer overflow + + Ada performs range checks at runtime in arithmetic operation on signed integers + to ensure the value is within the target type's bounds. If this check is removed, + the :switch:`-fsanitize=signed-integer-overflow` flag (included also in + :switch:`-fsanitize=undefined`) enables run-time checks for signed integer + overflows. + + In the following example: + + .. code-block:: ada + + procedure Signed_Integer_Overflow is + type Small_Int is range -128 .. 127; + X, Y, Z : Small_Int with Export; + begin + X := 100; + Y := 50; + -- This addition will exceed 127, causing an overflow + Z := X + Y; + end Signed_Integer_Overflow; + + If the code is built with the :switch:`-fsanitize=signed-integer-overflow` and + :switch:`-g` options, the following error is shown at execution time. + + :: + + signed_integer_overflow.adb:8:11: runtime error: signed integer overflow: 100 + 50 cannot be represented in type 'signed_integer_overflow__small_int' + +* Float to integer overflow + + When converting a floating-point value to an integer type, Ada performs a range + check at runtime to ensure the value is within the target type's bounds. If this + check is removed, the sanitizer can detect overflows in conversions from + floating point to integer types. + + In the following code: + + .. code-block:: ada + + procedure Float_Cast_Overflow is + Flt : Float := Float'Last with Export; + Int : Integer; + begin + Int := Integer (Flt); -- Overflow + end Float_Cast_Overflow; + + If the code is built with the :switch:`-fsanitize=float-cast-overflow` and + :switch:`-g` options, the following error is shown at execution time. + + :: + + float_cast_overflow.adb:5:20: runtime error: 3.40282e+38 is outside the range of representable values of type 'integer' + +Sanitizers in mixed-language applications +----------------------------------------- + +Most of the checks performed by sanitizers operate at a global level, which +means they can detect issues even when they span across language boundaries. +This applies notably to: + +* All checks performed by the AddressSanitizer: wrong memory overlays, buffer + overflows, uses after lifetime, memory leaks. These checks apply globally, + regardless of where the objects are allocated or defined, or where they are + destroyed + +* Wrong alignment checks performed by the UndefinedBehaviorSanitizer. It will + check whether an object created in a given language is accessed in another + with an incompatible alignment + +An interesting case that highlights the benefit of global sanitization is a +buffer overflow caused by a mismatch in language bindings. Consider the +following C function, which allocates an array of 4 characters: + + .. code-block:: c + + char *get_str (void) { + char *str = malloc (4 * sizeof (char)); + } + +This function is then bound to Ada code, which incorrectly assumes the buffer +is of size 5: + + .. code-block:: ada + + type Buffer is array (1 .. 5) of Character; + + function Get_Str return access Buffer + with Import => True, Convention => C, External_Name => "get_str"; + + Str : access Buffer := Get_Str; + Ch : Character := S (S'Last); -- Detected by AddressSanitizer as erroneous + +On the Ada side, accessing ``Str (5)`` appears valid because the array type +declares five elements. However, the actual memory allocated in C only holds +four. This mismatch is not detectable by Ada run-time checks, because Ada has +no visibility into how the memory was allocated. + +However, the AddressSanitizer will detect the heap buffer overflow at runtime, +halting execution and providing a clear diagnostic: + + :: + + ... + SUMMARY: AddressSanitizer: heap-buffer-overflow buffer_overflow.adb:20 in _ada_buffer_overflow + ... diff --git a/gcc/ada/doc/gnat_ugn/platform_specific_information.rst b/gcc/ada/doc/gnat_ugn/platform_specific_information.rst index f2fc737..6493a06 100644 --- a/gcc/ada/doc/gnat_ugn/platform_specific_information.rst +++ b/gcc/ada/doc/gnat_ugn/platform_specific_information.rst @@ -2212,11 +2212,12 @@ Setting Stack Size from ``gnatlink`` You can specify the program stack size at link time. On most versions of Windows, starting with XP, this is mostly useful to set the size of the main stack (environment task). The other task stacks are set with -pragma Storage_Size or with the *gnatbind -d* command. +pragma Storage_Size or with the *gnatbind -d* command. The specified size will +become the reserved memory size of the underlying thread. Since very old versions of Windows (2000, NT4, etc.) don't allow setting the -reserve size of individual tasks, the link-time stack size applies to all -tasks, and pragma Storage_Size has no effect. +reserve size of individual tasks, for those versions the link-time stack size +applies to all tasks, and pragma Storage_Size has no effect. In particular, Stack Overflow checks are made against this link-time specified size. diff --git a/gcc/ada/doc/gnat_ugn/the_gnat_compilation_model.rst b/gcc/ada/doc/gnat_ugn/the_gnat_compilation_model.rst index 64a3631..891886b 100644 --- a/gcc/ada/doc/gnat_ugn/the_gnat_compilation_model.rst +++ b/gcc/ada/doc/gnat_ugn/the_gnat_compilation_model.rst @@ -1477,6 +1477,10 @@ You can place configuration pragmas either appear at the start of a compilation unit or in a configuration pragma file that applies to all compilations performed in a given compilation environment. +Configuration pragmas placed before a library level package specification +are not propagated to the corresponding package body (see RM 10.1.5(8)); +they must be added explicitly to the package body. + GNAT includes the ``gnatchop`` utility to provide an automatic way to handle configuration pragmas that follows the semantics for compilations (that is, files with multiple units) described in the RM. |