=========================
GNAT 22 NEW FEATURES LIST
=========================

Copyright (C) 2021, AdaCore

This file contains a complete list of new features in version 22 of GNAT. A
full description of all GNAT features can be found in the GNAT User's Guide
and GNAT Reference Manual.

An ISO date (YYYY-MM-DD) appears in parentheses after the description line.
This date shows the implementation date of the feature. Any 22.0w wavefront
subsequent to this date will contain the indicated feature, as will any
subsequent 22 or later release.

NF-UB03-047 Warn for bidirectional characters (2021-12-03)

  Bidirectional characters can cause security vulnerabilities. The
  GNAT compiler now warns if such characters appear in
  string_literals, character_literals, or comments.

NF-UB01-029 Task-specific watchpoints in debugger (2021-09-14)

  A watchpoint in the debugger can now be restricted to a certain
  Ada task by using the "task" modifier when creating it.

NF-UA26-064 Debugger can disable ASLR on Windows (2021-10-07)

  The debugger can now disable ASLR on Windows. This is done using
  the "set disable-randomization" command. This feature is enabled
  by default; that is, programs started in the debugger will not use
  ASLR.

NF-U901-003 Better compatibility of C/C++ bindings with warnings (2021-09-01)

  The C/C++ bindings generated by means of the -fdump-ada-spec
  option are now more compatible with style checking as well as the
  -gnatwu warning.

NF-U822-002 Add handling functions for Wide_Wide_Characters (2021-09-17)

  RM A.3.6 states that `Wide_Wide_Characters.Handling` shall provide
  the same interface as `Wide_Characters.Handling`. Missing
  functions `Character_Set_Version, Is_Basic, and To_Basic` have now
  been added to the package.

NF-U813-002 GNATpp switches to control constant casing (2021-09-13)

  GNATpp provides four new switches allowing the user to control the
  casing of constant object declarations:

    --constant-case-as-non-constant, -cN (default)
    --constant-case-as-declared, -cD
    --constant-mixed-case, -cM
    --constant-lower-case, and -cL
    --constant-upper-case. -cU

  Number_declarations are also constants, so they are affected by
  these new switches. However, they also remain affected by the
  already existing number_declaration switches. In order to preserve
  backwards compatibility, the number_declaration switches have
  changed as follows:

    --number-case-as-constant, -nnC (default)
    --number-case-as-declared, -nnD
    --number-mixed-case, -nnM
    --number-lower-case, -nnL
    --number-upper-case, -nnU

NF-U807-001 Support for no_stack_protector machine attribute (2021-08-11)

  The compiler now supports the no_stack_protector machine attribute
  to disable stack-smashing protection on a per-subprogram basis.

NF-U804-005 Source selection harmonized across different tools (2021-08-26)

  GNAT tools such as gnatpp, gnatmetric, and gnatstub now select
  sources differently. By default, if a root project has Ada mains,
  closure of those mains is processed. If there are no mains, or a
  non-Ada main is declared, all sources of the project tree are
  processed recursively. The switch --no-subprojects now allows
  processing the sources of the root project only.

NF-U730-009 Support for load address in gnatsymbolize (2021-08-02)

  The gnatsymbolize tool now supports specifying the load address of
  position-independent executables as the first address when the
  --load option is passed.

NF-U723-003 Improved error message for compiler version mismatch (2021-08-05)

  When the binder encounters .ali files with differing versions, an
  error message is emitted. The two version numbers are now included
  in that message text.

NF-U709-013 Switch -gnatwe automatically enabled by -Werror (2021-07-09)

  The switch -Werror now enables -gnatwe by default. That is, all
  front-end and back-end warnings are treated as errors.

NF-U705-003 Strengthened compatibility warning for GCC builtins (2021-07-05)

  The warning given by the compiler on signature compatibility
  issues for bindings of GCC builtins by means of pragma Import
  (Intrinsic) has been strengthened and now reports signedness
  mismatches for integers.

NF-U629-019 Improved packed record layout with -fdump-ada-spec (2021-06-29)

  The C/C++ bindings generated by means of -fdump-ada-spec now
  support simple cases of packed record layout.

NF-U629-011 Suppression of hiding warnings on instantiations (2021-08-12)

  The compiler no longer warns about hidden declarations on generic
  instantiations when compiling with -gnatwh. Such warnings can
  occur for generic units, but are extraneous on instantiations.

NF-U621-006 Compiler speed-up in case of many homonyms (2021-08-17)

  Compile-time efficiency is now improved in the following special
  case: The unit being compiled, plus the transitive closure of all
  the with'ed units, contains many declarations with the same name.
  For example, when there are thousands of types, and each one has
  an Image function. It doesn't matter whether the declarations are
  overloadable, and it doesn't matter whether use-visibility is
  used, versus Package_Name.X notation.

NF-U618-045 Faster sorting for doubly-linked-list containers (2021-07-01)

  In earlier work, a performance problem in
  Ada.Containers.Doubly_Linked_Lists.Generic_Sorting was addressed.
  The sorting algorithm formerly used there, which was very slow in
  some cases, was also used in in four other doubly-linked-list
  container packages: the Bounded, Formal, Indefinite, and
  Restricted versions. The faster sorting algorithm is now used in
  those four packages as well.

NF-U615-015 Iterator specifications in Ada 2022 array aggregates (2021-08-11)

  The compiler now implements the two-pass algorithm described in
  RM2022 4.3.3 (20.2/5) for the construction of an array aggregate,
  all of whose component associations are iterated component
  associations with iterator specifications.

NF-U614-034 Performance improvement in GNAT.RegPat package (2021-07-15)

  In the implementation of the GNAT.RegPat package, an existing
  optimization substantially improves performance in the case of
  checking for pattern matches where all possible matches are known
  to start with the same character. This optimization is now
  generalized to also apply in the case of a case-insensitive
  comparison (so that there are two possible initial characters to
  check for, for example 'z' and 'Z').

NF-U610-073 More OS constants are defined on Linux (2021-06-16)

  Constants IPPROTO_DCCP, IPPROTO_BEETPH, IPPROTO_UDPLITE,
  IPPROTO_MPLS, SO_REUSEPORT, SO_BUSY_POLL, IPV6_FLOWINFO, and
  IF_NAMESIZE are now defined for Linux.

NF-U607-025 Improve performance of Doubly_Linked_Lists Sort (2021-06-15)

  The previous implementation of the procedure
  Doubly_Linked_Lists.Generic_Sorting.Sort in the Ada.Containers
  hierarchy could exhibit quadratic behavior in some cases (for
  example, if the input was already sorted or almost sorted). The
  new implementation uses an N log N worst-case algorithm.

NF-U528-012 -gnatX support for casing on discriminated values (2021-06-14)

  The existing support for the Ada extension feature of casing on
  composite values is improved by adding support for casing on
  values that are discriminated or have discriminated subcomponents.

NF-U519-038 New warning for duplicate Size and Value_Size (2021-06-18)

  GNAT now gives a warning if an attribute definition clause is
  given for both Size and Value_Size for the same subtype.

NF-U503-004 No predicate check on assignment to view conversion (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.

NF-U402-028 Improved support for enumeral types in C/C++ binding (2021-04-02)

  The C and C++ bindings generated by means of the -fdump-ada-spec
  option now reuse the subtype to declare the constants generated in
  the case of an enumeral type with explicit values for its
  enumeration constants.

NF-U312-050 Improved object code for imported constants (2021-03-16)

  The object code generated for constants declared with an
  aspect/pragma Import has been improved.

NF-U305-056 Warn on param containing access in predef type (2021-03-12)

  Normally the warnings saying that an in out parameter could be of
  mode in are disabled when the type contains components of an
  access type. This patch enables such warnings if the only such
  components are in internal private types.

NF-U228-002 Extension allowing "when" in certain statements (2021-04-06)

  As a language extension, the compiler now supports the inclusion
  of a "when" condition as part of return, goto, and raise
  statements, enabled by using the -gnatX switch.

NF-U226-007 Improved implementation advice documentation (2021-03-01)

  Previously, the GNAT RM said nothing about the extent to which
  GNAT follows the Ada RM's implementation advice regarding
  Ada.Containers and its predefined child units. The missing
  documentation is now provided.

NF-U224-030 Ada 2022: Handling of types derived from runtime (2021-03-15)

  The compiler has been enhanced to not report errors on Ada 2022
  runtime-library primitives that require overriding when compiling
  for an Ada version earlier than Ada 2022.

NF-U216-002 Disambiguation for raise expressions (AI12-0152) (2021-02-18)

  AI12-0152 specifies that a raise_expression must be parenthesized
  when it appears in certain contexts, in particular in declarations
  that may include aspect specifications, which may render the
  keyword "with" ambiguous, given that it can appear both in a
  raise_expression and at the head of a list of aspect
  specifications. The revised syntax rules are now supported.

NF-U202-032 Extension of prefixed-call syntax to untagged types (2021-05-04)

  As a language extension, the compiler now allows calls to
  subprograms that are primitives of untagged types to be written
  using prefixed notation (for example, Object.Op (...)). The
  prefixed call syntax, which was already supported in Ada for
  tagged types, applies in the case of primitives of an untagged
  type T whose first formal is of type T or of an anonymous access
  type designating T. This feature is enabled by using the -gnatX
  switch or pragma Extensions_Allowed.

NF-U127-015 New warning on statically known empty loops (2021-05-12)

  The compiler now emits warnings for empty loops caused by adding a
  null range constraint to the subtype in a loop parameter
  specification.

NF-U127-005 New warning for negative literals of modular type (2021-02-02)

  Under the warning switch -gnatw.m (also enabled by default), GNAT
  now warns when the code refers to negative literals of a modular
  type, which correspond in fact to large positive integers due to
  wraparound semantics, unless the literal has the special value -1
  or is the argument of a type qualification or type conversion.

NF-U121-036 Support for Ada 202x target name in ASIS (2021-02-11)

  A new A_Target_Name value is added to the ASIS Expression_Kinds
  type, and ASIS structural queries have been updated to support the
  Ada 202x target name feature.

NF-U121-005 Abstract Pre/Post'Class on abstract type primitives (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.

NF-U103-001 No_Task_Parts aspect (2021-02-13)

  The No_Task_Parts aspect may be applied to a type. This GNAT-
  specific aspect is analogous to the language-defined
  No_Controlled_Parts aspect, except that instead of forbidding
  controlled parts, it forbids task parts. If it applies to a type
  T, then the compiler can optimize T'Class accordingly.

NF-U101-004 Preelaborable_Initialization attribute (2021-06-23)

  As defined by AI12-0409, the Preelaborable_Initialization 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.

NF-TC28-005 Tiered support for floating-point exponentiation (2021-01-15)

  The implementation of floating-point exponentiation has been
  changed to use only the precision corresponding to the root type
  of the floating-point type, and its accuracy has been improved for
  Long_Float, Long_Long_Float, and types rooted at them. This also
  means that the x87 FPU is no longer used for Float and Long_Float
  on native x86 and x86-64 platforms.

NF-TC19-003 Tiered support of output for floating-point types (2021-01-08)

  The implementation of the Image attribute for floating-point types
  and of the output routines in Ada.Text_IO.Float_IO has been
  changed to use only the precision corresponding to the root type
  of the floating-point type, and they can now output up to twice
  the number of significant digits specified by the Digits attribute
  of the floating-point type. In particular, this means that the x87
  FPU is no longer used for Image of Float, Long_Float, and types
  rooted at them, on native x86 and x86-64 platforms.

NF-TC18-042 Better rounding for static Machine of floating point (2020-12-19)

  The static evaluation of the Machine attribute of floating-point
  types now uses exactly the same rounding mode as the one used for
  the static evaluation of other real expressions.

NF-TC04-036 Option to output compilation messages as JSON (2021-03-15)

  The compiler now accepts a -fdiagnostics-format=json command-line
  option that enables outputting compilation messages in the JSON
  format.

NF-TC01-002 Gnatmetric support for sources with multiple units (2020-12-16)

  Gnatmetric now supports source code files with multiple
  compilation units, as well as empty files. For files with multiple
  compilation units, gnatmetric will process each unit individually,
  and for empty files, it will simply ignore them.

NF-TB23-013 Improved support of simple bitfield in C/C++ binding (2020-10-24)

  The C and C++ bindings generated by means of the -fdump-ada-spec
  option can now support more cases of simple bit-fields.

NF-TB20-050 Unattended installation under Linux (2020-11-25)

  All installers under Linux (the doinstall script) now easily
  support running unattended via simply: ./doinstall install-dir
  (for example, ./doinstall /opt/gnat).

NF-TB17-023 More efficient attributes for floating-point types (2020-11-20)

  The implementation of the floating-point attributes specified by
  the Ada RM in A.5.3 is now more efficient at run time.

NF-TB04-032 Improved efficiency of slice assignments (2021-04-01)

  The efficiency of small slice assignment of packed arrays is
  improved in cases where the relevant bounds are known at compile
  time. A benchmark showed a factor of 5.8 improvement.

NF-TB03-038 Casing on composite values (2021-03-11)

  As a language extension (enabled by the -gnatX switch), initial
  support is provided for case statements where the selector
  expression is of a composite type. Aggregate notation is used for
  case choices; pattern bindings are supported. For details, see the
  GNAT RM documentation for pragma Extensions_Allowed.

NF-TA25-005 Aspect specifications on more constructs (AI12-0398) (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 202x by
  AI12-0398.

NF-TA21-023 Full runtime built with checks on (2020-11-04)

  The full Ada runtime is now built with checks enabled by default,
  providing additional safety and security guarantees to end users,
  who have the option to catch any unexpected exception if needed.

NF-TA16-009 Valid_Value attribute (2021-03-31)

  The Valid_Value attribute for enumeration types is implemented.
  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_Image (S) returns
  True if and only if T'Value (S) would not raise Constraint_Error.

NF-TA13-006 New warning on potentially confusing op precedence (2020-10-21)

  The expression "X = Y op Z", when op is one of and/or/xor, is
  interpreted as "(X = Y) op Z", due to Ada's precedence of
  operators, while the user may have meant "X = (Y op Z)". Cases are
  now detected where there is possible confusion and a warning
  message is issued, controlled by switches -gnatwq/-gnatwQ. This
  warning is enabled by default.

NF-TA08-021 gnat2xml on Long Term Support (2020-10-10)

  The gnat2xml tool is now removed from the GNAT 22 development and
  will remain available via GNAT versions 21 and below. Going
  forward, Libadalang is the recommended replacement for gnat2xml.

NF-TA01-021 New gnatcheck rule Profile_Discrepancies (2021-01-11)

  The new gnatcheck rule Profile_Discrepancies checks that the
  parameter profile structure of a subprogram or entry body is
  consistent with the parameter profile structure in the
  corresponding subprogram or entry declaration.

NF-T910-020 No_Unrecognized_Aspects/Pragmas restrictions (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.

NF-T910-019 Default_Initial_Condition for derived types (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
  AI12-097. 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.

NF-T910-018 Named numbers and user-defined numeric literals (2020-10-05)

  Ada 202x AI12-0394 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.

NF-T826-020 Support for 128-bit fixed point on 64-bit platforms (2020-11-13)

  Support for 128-bit fixed-point types on 64-bit platforms has been
  implemented in the compiler. Moreover, on all platforms, the
  implementation now uses only integer instructions for the vast
  majority of supported fixed-point types; for inexact conversions
  to ordinary fixed-point types, this may result in selecting the
  other member of the perfect result set, as allowed by the LRM.

NF-T608-025 Faster implementation of Value for enumeration types (2021-01-09)

  The compiler can now generate a perfect hash function for
  enumeration types with more than three values in order to speed up
  the implementation of the Value attribute.

NF-T528-033 New compiler messages format (2021-03-28)

  The compiler now prepends error messages with "error:" and appends
  the name of the option that caused the warning to warning
  messages.

NF-T519-039 Large reduction of GNAT encodings in debug info (2021-06-04)

  The use of GNAT-specific encodings in the debugging information
  generated by the compiler has been greatly reduced, mostly for
  discrete and array types with dynamic bounds, as well as for
  record types with variable-length components. In particular, the
  custom DWARF extension DW_AT_GNAT_descriptive_type is no longer
  generated.

NF-T430-009 Ada 2022: Defaults for formal types (AI12-0205) (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.

NF-T426-004 Tiered support of input for floating-point types (2020-12-04)

  The implementation of the Value attribute for floating-point types
  and of the input routines in Ada.Text_IO.Float_IO has been changed
  to use only the precision corresponding to the root type of the
  floating-point type, and results may exhibit a difference of 1 ULP
  with regard to previous releases when the value of the literal is
  not exactly representable in the floating-point type. In
  particular, this means that the x87 FPU is no longer used for
  Value of Float, Long_Float, and types rooted at them, on native
  x86 and x86-64 platforms.

NF-T312-041 gnatpp: "is" gets new line in expression function (2021-05-04)

  In gnatpp, for an expression function, a new line is now added
  before the "is" keyword when the switch --par-threshold=0 is
  present and the --no-separate-is switch is not used.

NF-T303-033 Extension feature for arrays with fixed lower bounds (2021-03-12)

  As a language extension, the compiler now allows array types and
  subtypes to be declared with index ranges specified with a fixed
  lower bound (using the syntax notation "<expression> .. <>"). Such
  a range fixes the lower bound of all objects of the type or
  subtype to the specified lower-bound value, and sliding of bounds
  is performed in certain contexts, such as when passing a slice to
  a formal parameter of an unconstrained array type with a fixed
  lower bound for an index range. Use of such array types can
  simplify code and improve indexing performance.

NF-T114-014 New gnatcheck rules (2020-11-06)

  The following new rules are added to gnatcheck:

    * Access_To_Local_Objects
    * Address_Attribute_For_Non_Volatile_Objects
    * Constant_Overlays
    * Generic_IN_OUT_Objects
    * Nonoverlay_Address_Specifications
    * Non_Constant_Overlays
    * Not_Imported_Overlays
    * Outside_References_From_Subprograms
    * Renamings
    * Size_Attribute_For_Types
    * USE_Clauses

  The existing rules EXIT_Statements_With_No_Loop_Name and
  Metrics_Cyclomatic_Complexity have got parameters that allow fine
  tuning for these rules.
  See GNATcheck Reference Manual for full details.

NF-S911-017 Obsolescent use of 'Class on incomplete types (2020-12-12)

  Applying Class to an incomplete type not marked as tagged is
  legal, but classified as obsolescent in Annex J of the AdaRM, and
  is now flagged with a warning when the -gnatwj switch applies, and
  is reported as a violation of No_Obsolescent_Features when that
  restriction is enabled.

NF-S904-037 Ada 2022: Inherited body and overriding precondition (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. This feature is documented in AI12-0195.

NF-S820-052 Aspect Default_Initial_Condition (AI12-0265) (2020-11-13)

  The aspect Default_Initial_Condition, originally proposed by SPARK
  and supported in GNAT, is now also included in Ada 202x (see
  AI2-0265). 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.

NF-S816-027 Aspect No_Controlled_Parts (2021-01-26)

  The compiler now supports the Ada 202x 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.

NF-S815-005 GNATstack adds the cycle size to the stack size (2020-12-21)

  When printing the used stack size, GNATstack now adds the cycle
  size, which makes the switch \`-c X\` more useful.

NF-S805-027 Runtime library improvements to elementary functions (2020-10-20)

  Specializations of Ada.Numerics.Generic_Elementary_Functions now
  select the intrinsic implementations appropriate for each real
  base type, avoiding the implicit conversions to/from Long_Float or
  Long_Long_Float, unless lower-precision library functions do not
  meet Ada precision requirements. This enables the use of
  additional hardware instructions and C math library functions. On
  x86 and x86_64 target systems that have SSE floating-point
  selected, this avoids the implicit use of the x87 floating-point
  register stack for types other than Long_Long_Float. Further
  improvements have enabled the automatic combination of Sin and Cos
  calls into sincos or cexp on target systems whose C math libraries
  support them, when optimization and front-end inlining are
  enabled, for example with -O -gnatn.

NF-S729-062 Support for Ada 202x Stable_Properties aspect (2020-11-04)

  Ada 202x (AI12-0187) defines a new aspect, Stable_Properties, for
  use in generating additional postcondition checks for subprograms.

NF-S318-083 Ada 202x 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.

NF-S228-029 Improved accuracy of 'Value for 64-bit fixed-point (2020-10-05)

  The accuracy of the results of the Value attribute for 64-bit
  fixed-point types has been improved.

NF-N224-026 Decoded type names provided by debugger Python API (2021-06-16)

  The debugger Python API now provides the Ada type name, rather
  than the encoded form.
