This boolean aspect is equivalent to :ref:`pragma Unreferenced<Pragma-Unreferenced>`.
-When using the ``-gnat2020`` switch, this aspect is also supported on formal
+When using the ``-gnat2022`` switch, this aspect is also supported on formal
parameters, which is in particular the only form possible for expression
functions.
Allow full Ada 2012 features (same as :switch:`-gnat12`)
+.. index:: -gnat2022 (gcc)
+
+:switch:`-gnat2022`
+ Allow full Ada 2022 features
+
+
:switch:`-gnat83`
Enforce Ada 83 restrictions.
for further information).
+.. index:: -gnat2022 (gcc)
+.. index:: Ada 2022 mode
+
+:switch:`-gnat2022` (Ada 2022 mode)
+ This switch directs the compiler to implement the Ada 2022 version of the
+ language.
+
+
.. index:: -gnatX (gcc)
.. index:: Ada language extensions
.. index:: GNAT extensions
:switch:`-gnatX` (Enable GNAT Extensions)
This switch directs the compiler to implement the latest version of the
- language (currently Ada 2012) and also to enable certain GNAT implementation
+ language (currently Ada 2022) and also to enable certain GNAT implementation
extensions that are not part of any Ada standard. For a full list of these
- extensions, see the GNAT reference manual.
+ extensions, see the GNAT reference manual, ``Pragma Extensions_Allowed``.
.. _Character_Set_Control:
-- default size of objects, creates chaos, and major incompatibilities in
-- existing code.
--- The Ada 2020 RM acknowledges it and adopts GNAT's Object_Size attribute
+-- The Ada 2022 RM acknowledges it and adopts GNAT's Object_Size attribute
-- for determining the default size of objects, but stops short of applying
-- it universally like GNAT. Indeed the notable exceptions are nonaliased
--- stand-alone objects, which are not covered by Object_Size in Ada 2020.
+-- stand-alone objects, which are not covered by Object_Size in Ada 2022.
-- We proceed as follows, for discrete and fixed-point subtypes, we have
-- two separate sizes for each subtype:
-- base type, and the Object_Size of a derived first subtype is copied
-- from the parent first subtype.
--- The Ada 2020 RM defined attribute Object_Size uses this implementation.
+-- The Ada 2022 RM defined attribute Object_Size uses this implementation.
-- The Value_Size, which is the number of bits required to store a value
-- of the type. This size can be referred to using the Value_Size
-- Value_Size and Object_Size may be explicitly set for any subtype using
-- an attribute definition clause. Note that the use of such a clause can
--- cause the RM 13.1(14) rule to be violated, in Ada 95 and 2020 for the
+-- cause the RM 13.1(14) rule to be violated, in Ada 95 and 2022 for the
-- Value_Size attribute, but only in Ada 95 for the Object_Size attribute.
-- If access types reference aliased objects whose subtypes have differing
-- Object_Size values as a result of explicit attribute definition clauses,
-- Is_Full_Access (synth)
-- Defined in all type entities, and also in constants, components and
-- variables. Set if an aspect/pragma Atomic/Shared, or an aspect/pragma
--- Volatile_Full_Access or an Ada 2020 aspect Full_Access_Only applies
+-- Volatile_Full_Access or an Ada 2022 aspect Full_Access_Only applies
-- to the entity. In the case of private and incomplete types, the flag
-- applies to both the partial view and the full view.
-- Is_Volatile_Full_Access (Flag285)
-- Defined in all type entities, and also in constants, components, and
--- variables. Set if an aspect/pragma Volatile_Full_Access or an Ada 2020
+-- variables. Set if an aspect/pragma Volatile_Full_Access or an Ada 2022
-- aspect Full_Access_Only applies to the entity. In the case of private
-- and incomplete types, this flag is set in both the partial view and
-- the full view.
end Error_Msg_Ada_2012_Feature;
--------------------------------
- -- Error_Msg_Ada_2020_Feature --
+ -- Error_Msg_Ada_2022_Feature --
--------------------------------
- procedure Error_Msg_Ada_2020_Feature (Feature : String; Loc : Source_Ptr) is
+ procedure Error_Msg_Ada_2022_Feature (Feature : String; Loc : Source_Ptr) is
begin
- if Ada_Version < Ada_2020 then
- Error_Msg (Feature & " is an Ada 2020 feature", Loc);
+ if Ada_Version < Ada_2022 then
+ Error_Msg (Feature & " is an Ada 2022 feature", Loc);
if No (Ada_Version_Pragma) then
- Error_Msg ("\unit must be compiled with -gnat2020 switch", Loc);
+ Error_Msg ("\unit must be compiled with -gnat2022 switch", Loc);
else
Error_Msg_Sloc := Sloc (Ada_Version_Pragma);
Error_Msg ("\incompatible with Ada version set#", Loc);
end if;
end if;
- end Error_Msg_Ada_2020_Feature;
+ end Error_Msg_Ada_2022_Feature;
------------------
-- Error_Msg_AP --
-- contain error message insertion characters in the normal manner, and in
-- particular may start with | to flag a non-serious error.
- procedure Error_Msg_Ada_2020_Feature (Feature : String; Loc : Source_Ptr);
- -- Analogous to Error_Msg_Ada_2012_Feature
+ procedure Error_Msg_Ada_2022_Feature (Feature : String; Loc : Source_Ptr);
+ -- Analogous to Error_Msg_Ada_2012_Feature, for Ada 2022
procedure dmsg (Id : Error_Msg_Id) renames Erroutc.dmsg;
-- Debugging routine to dump an error message
Assoc := Last (Component_Associations (N));
if Nkind (Assoc) = N_Iterated_Component_Association then
- -- Ada 2020: generate a loop to have a proper scope for
+ -- Ada 2022: generate a loop to have a proper scope for
-- the identifier that typically appears in the expression.
-- The lower bound of the loop is the position after all
-- previous positional components.
begin
if Present (Iterator_Filter (I_Spec)) then
- pragma Assert (Ada_Version >= Ada_2020);
+ pragma Assert (Ada_Version >= Ada_2022);
Stats := New_List (Make_If_Statement (Loc,
Condition => Iterator_Filter (I_Spec),
Then_Statements => Stats));
begin
if Present (Iterator_Filter (I_Spec)) then
- pragma Assert (Ada_Version >= Ada_2020);
+ pragma Assert (Ada_Version >= Ada_2022);
Stats := New_List (Make_If_Statement (Loc,
Condition => Iterator_Filter (I_Spec),
Then_Statements => Stats));
end if;
if Present (Iterator_Filter (LPS)) then
- pragma Assert (Ada_Version >= Ada_2020);
+ pragma Assert (Ada_Version >= Ada_2022);
Set_Statements (N,
New_List (Make_If_Statement (Loc,
Condition => Iterator_Filter (LPS),
-- itself must not be rewritten, to prevent infinite recursion).
Must_Rewrite_Indirect_Call : constant Boolean :=
- Ada_Version >= Ada_2020
+ Ada_Version >= Ada_2022
and then Nkind (Name (N)) = N_Explicit_Dereference
and then Ekind (Etype (Name (N))) = E_Subprogram_Type
and then Present
(Postconditions_Proc (Spec_Id), Loc)))));
end if;
- -- Ada 2020 (AI12-0279): append the call to 'Yield unless this is
+ -- Ada 2022 (AI12-0279): append the call to 'Yield unless this is
-- a generic subprogram (since in such case it will be added to
-- the instantiations).
(Postconditions_Proc (Scope_Id), Loc)))));
end if;
- -- Ada 2020 (AI12-0279)
+ -- Ada 2022 (AI12-0279)
if Has_Yield_Aspect (Scope_Id)
and then RTE_Available (RE_Yield)
Analyze_And_Resolve (Exp);
end if;
- -- Ada 2020 (AI12-0279)
+ -- Ada 2022 (AI12-0279)
if Has_Yield_Aspect (Scope_Id)
and then RTE_Available (RE_Yield)
-- clause applies (that can specify an arbitrary bit boundary), or where
-- the enclosing record itself has a non-standard representation.
- -- In Ada 2020, a third case arises when the renamed object is a nonatomic
+ -- In Ada 2022, a third case arises when the renamed object is a nonatomic
-- subcomponent of an atomic object, because reads of or writes to it must
-- access the enclosing atomic object. That's also the case for an object
-- subject to the Volatile_Full_Access GNAT aspect/pragma in any language
Insert_Before (Last (Statements (Stats)), Call);
Analyze (Call);
- -- Ada 2020 (AI12-0279)
+ -- Ada 2022 (AI12-0279)
if Has_Yield_Aspect (Entity (Entry_Direct_Name (Astat)))
and then RTE_Available (RE_Yield)
Append (Call, Statements (Hand));
Analyze (Call);
- -- Ada 2020 (AI12-0279)
+ -- Ada 2022 (AI12-0279)
if Has_Yield_Aspect (Entity (Entry_Direct_Name (Astat)))
and then RTE_Available (RE_Yield)
Statements => New_List (Call))));
- -- Ada 2020 (AI12-0279)
+ -- Ada 2022 (AI12-0279)
if Has_Yield_Aspect (Entity (Entry_Direct_Name (Astat)))
and then RTE_Available (RE_Yield)
begin
if Is_Static_Expression (N) then
return True;
- elsif Ada_Version >= Ada_2020
+ elsif Ada_Version >= Ada_2022
and then Nkind (N) in N_Selected_Component | N_Indexed_Component
and then Statically_Names_Object (N)
then
- -- Restriction relaxed in Ada2020 to allow statically named
+ -- Restriction relaxed in Ada 2022 to allow statically named
-- subcomponents.
return Is_Simple_Barrier (Prefix (N));
end if;
Analyze (N);
- -- Ada 2020 (AI12-0279)
+ -- Ada 2022 (AI12-0279)
if Has_Yield_Aspect (Eent)
and then RTE_Available (RE_Yield)
Entry_Id : constant Entity_Id :=
Entity (Entry_Direct_Name (Accept_Statement (Alt)));
begin
- -- Ada 2020 (AI12-0279)
+ -- Ada 2022 (AI12-0279)
if Has_Yield_Aspect (Entry_Id)
and then RTE_Available (RE_Yield)
Ptyp := Underlying_Type (Entity (Pref));
- -- Ada 2020 allows 'Image on private types, so fetch the underlying
+ -- Ada 2022 allows 'Image on private types, so fetch the underlying
-- type to obtain the structure of the type. We use the base type,
-- not the root type for discrete types, to handle properly derived
-- types, but we use the root type for enumeration types, because the
Prefix => New_Occurrence_Of (Ptyp, Loc),
Expressions => New_List (Expr)));
- -- AI12-0020: Ada 2020 allows 'Image for all types, including private
+ -- AI12-0020: Ada 2022 allows 'Image for all types, including private
-- types. If the full type is not a fixed-point type, then it is enough
-- to set the Conversion_OK flag. However, that would not work for
-- fixed-point types, because that flag changes the run-time semantics
function Image_Should_Call_Put_Image (N : Node_Id) return Boolean is
begin
- if Ada_Version < Ada_2020 then
+ if Ada_Version < Ada_2022 then
return False;
end if;
- -- In Ada 2020, T'Image calls T'Put_Image if there is an explicit
+ -- In Ada 2022, T'Image calls T'Put_Image if there is an explicit
-- aspect_specification for Put_Image, or if U_Type'Image is illegal
- -- in pre-2020 versions of Ada.
+ -- in pre-2022 versions of Ada.
declare
U_Type : constant Entity_Id := Underlying_Type (Entity (Prefix (N)));
#define Suppress_Checks opt__suppress_checks
typedef enum {
- Ada_83, Ada_95, Ada_2005, Ada_2012, Ada_2020
+ Ada_83, Ada_95, Ada_2005, Ada_2012, Ada_2022
} Ada_Version_Type;
typedef enum {
We implement 3 different semantics of atomicity in this function:
1. the Ada 95/2005/2012 semantics of the Atomic aspect/pragma,
- 2. the Ada 2020 semantics of the Atomic aspect/pragma,
+ 2. the Ada 2022 semantics of the Atomic aspect/pragma,
3. the semantics of the Volatile_Full_Access GNAT aspect/pragma.
They are mutually exclusive and the FE should have rejected conflicts. */
gnat_node = Expression (gnat_node);
/* Up to Ada 2012, for Atomic itself, only reads and updates of the object as
- a whole require atomic access (RM C.6(15)). But, starting with Ada 2020,
+ a whole require atomic access (RM C.6(15)). But, starting with Ada 2022,
reads of or writes to a nonatomic subcomponent of the object also require
atomic access (RM C.6(19)). */
if (node_is_atomic (gnat_node))
for (gnat_temp = gnat_node, gnat_parent = Parent (gnat_temp);
node_is_component (gnat_parent) && Prefix (gnat_parent) == gnat_temp;
gnat_temp = gnat_parent, gnat_parent = Parent (gnat_temp))
- if (Ada_Version < Ada_2020 || node_is_atomic (gnat_parent))
+ if (Ada_Version < Ada_2022 || node_is_atomic (gnat_parent))
goto not_atomic;
else
as_a_whole = false;
for (gnat_temp = gnat_node;
node_is_component (gnat_temp);
gnat_temp = Prefix (gnat_temp))
- if ((Ada_Version >= Ada_2020 && node_is_atomic (Prefix (gnat_temp)))
+ if ((Ada_Version >= Ada_2022 && node_is_atomic (Prefix (gnat_temp)))
|| node_is_volatile_full_access (Prefix (gnat_temp)))
{
*type = OUTER_ATOMIC;
This boolean aspect is equivalent to @ref{10c,,pragma Unreferenced}.
-When using the @code{-gnat2020} switch, this aspect is also supported on formal
+When using the @code{-gnat2022} switch, this aspect is also supported on formal
parameters, which is in particular the only form possible for expression
functions.
@item @code{-gnat2012}
Allow full Ada 2012 features (same as @code{-gnat12})
+@end table
+
+@geindex -gnat2022 (gcc)
+
+
+@table @asis
+
+@item @code{-gnat2022}
+
+Allow full Ada 2022 features
@item @code{-gnat83}
for further information).
@end table
+@geindex -gnat2022 (gcc)
+
+@geindex Ada 2022 mode
+
+
+@table @asis
+
+@item @code{-gnat2022} (Ada 2022 mode)
+
+This switch directs the compiler to implement the Ada 2022 version of the
+language.
+@end table
+
@geindex -gnatX (gcc)
@geindex Ada language extensions
@item @code{-gnatX} (Enable GNAT Extensions)
This switch directs the compiler to implement the latest version of the
-language (currently Ada 2012) and also to enable certain GNAT implementation
+language (currently Ada 2022) and also to enable certain GNAT implementation
extensions that are not part of any Ada standard. For a full list of these
-extensions, see the GNAT reference manual.
+extensions, see the GNAT reference manual, @code{Pragma Extensions_Allowed}.
@end table
@node Character Set Control,File Naming Control,Compiling Different Versions of Ada,Compiler Switches
); -- GNATCOLL.OMP
--------------------
- -- Ada 202X Units --
+ -- Ada 2022 Units --
--------------------
- -- The following units should be used only in Ada 202X mode
+ -- The following units should be used only in Ada 2022 mode
- Non_Imp_File_Names_2X : constant File_List := (
+ Non_Imp_File_Names_22 : constant File_List := (
("a-nubinu", T), -- Ada.Numerics.Big_Numbers
("a-nbnbin", T), -- Ada.Numerics.Big_Numbers.Big_Integers
("a-nbnbre", T), -- Ada.Numerics.Big_Numbers.Big_Reals
end if;
end loop;
- -- See if name is in 202X list
+ -- See if name is in 2022 list
- for J in Non_Imp_File_Names_2X'Range loop
- if Buffer (1 .. 8) = Non_Imp_File_Names_2X (J).Fname then
- return Ada_202X_Unit;
+ for J in Non_Imp_File_Names_22'Range loop
+ if Buffer (1 .. 8) = Non_Imp_File_Names_22 (J).Fname then
+ return Ada_2022_Unit;
end if;
end loop;
Ada_95_Unit,
Ada_2005_Unit,
Ada_2012_Unit,
- Ada_202X_Unit);
+ Ada_2022_Unit);
-- This unit is defined in the Ada RM of the given year. This is used to
-- give a warning when withing a unit from a wrong mode (e.g. withing an
-- Ada_2012_Unit when compiling with -gnat95). Note that in Ada 83 mode,
function New_Vector (First, Last : Index_Type) return Vector
with Pre => First = Index_Type'First;
- -- Ada_2020 aggregate operation.
+ -- Ada 2022 aggregate operation.
function To_Vector (Length : Count_Type) return Vector;
function New_Vector (First, Last : Index_Type) return Vector
with Pre => First = Index_Type'First;
- -- Ada_2020 aggregate operation.
+ -- Ada 2022 aggregate operation.
procedure Insert_Vector
(Container : in out Vector;
-- trying to specify other values will be ignored (in case of pragma
-- Ada_xxx) or generate an error (in case of -gnat83/95/xx switches).
- type Ada_Version_Type is (Ada_83, Ada_95, Ada_2005, Ada_2012, Ada_2020);
+ type Ada_Version_Type is (Ada_83, Ada_95, Ada_2005, Ada_2012, Ada_2022);
pragma Ordered (Ada_Version_Type);
pragma Convention (C, Ada_Version_Type);
-- Versions of Ada for Ada_Version below. Note that these are ordered,
-- remains set to Ada_Version_Default). This is used in the rare cases
-- (notably pragma Obsolescent) where we want the explicit version set.
- Ada_Version_Runtime : Ada_Version_Type := Ada_2020;
+ Ada_Version_Runtime : Ada_Version_Type := Ada_2022;
-- GNAT
-- Ada version used to compile the runtime. Used to set Ada_Version (but
-- not Ada_Version_Explicit) when compiling predefined or internal units.
-- including warnings on Ada 2012 obsolescent features used in Ada 2012
-- mode. Modified by use of -gnatwy/Y.
- Warn_On_Ada_202X_Compatibility : Boolean := True;
+ Warn_On_Ada_2022_Compatibility : Boolean := True;
-- GNAT
- -- Set to True to generate all warnings on Ada 202X compatibility issues,
- -- including warnings on Ada 202X obsolescent features used in Ada 202X
- -- mode. ???There is no warning switch for this yet.
+ -- Set to True to generate all warnings on Ada 2022 compatibility issues,
+ -- including warnings on Ada 2022 obsolescent features used in Ada 2022
+ -- mode.
Warn_On_All_Unread_Out_Parameters : Boolean := False;
-- GNAT
-- type DT is new T with private with Atomic;
- Error_Msg_Ada_2020_Feature
+ Error_Msg_Ada_2022_Feature
("formal type with aspect specification", Token_Ptr);
return Def_Node;
-- access_definition
elsif Token = Tok_Renames then
- Error_Msg_Ada_2020_Feature
+ Error_Msg_Ada_2022_Feature
("object renaming without subtype", Token_Ptr);
Scan; -- past renames
if Nkind (Aggr_Node) /= N_Aggregate
and then
Nkind (Aggr_Node) /= N_Extension_Aggregate
- and then Ada_Version < Ada_2020
+ and then Ada_Version < Ada_2022
then
Error_Msg
("aggregate may not have single positional component", Aggr_Sloc);
if Token = Tok_Left_Bracket then
Scan;
- -- Special case for null aggregate in Ada 2020
+ -- Special case for null aggregate in Ada 2022
if Token = Tok_Right_Bracket then
Scan; -- past ]
-- identifier or OTHERS follows (the latter cases are missing
-- comma cases). Also assume positional if a semicolon follows,
-- which can happen if there are missing parens.
- -- In Ada_2012 and Ada_2020 an iterated association can appear.
+ -- In Ada 2012 and 2022 an iterated association can appear.
elsif Nkind (Expr_Node) in
N_Iterated_Component_Association | N_Iterated_Element_Association
Scan; -- past minus
when Tok_At_Sign => -- AI12-0125 : target_name
- Error_Msg_Ada_2020_Feature ("target name", Token_Ptr);
+ Error_Msg_Ada_2022_Feature ("target name", Token_Ptr);
Node1 := P_Name;
return Node1;
procedure Build_Iterated_Element_Association;
-- If the iterator includes a key expression or a filter, it is
- -- an Ada_2020 Iterator_Element_Association within a container
+ -- an Ada 2022 Iterator_Element_Association within a container
-- aggregate.
----------------------------------------
Save_Scan_State (State);
-- A lookahead is necessary to differentiate between the
- -- Ada 2012 form with a choice list, and the Ada 202x element
+ -- Ada 2012 form with a choice list, and the Ada 2022 element
-- iterator form, recognized by the presence of "OF". Other
-- disambiguation requires context and is done during semantic
-- analysis. Note that "for X in E" is syntactically ambiguous:
if Token = Tok_Use then
- -- Ada_2020 Key-expression is present, rewrite node as an
+ -- Ada 2022 Key-expression is present, rewrite node as an
-- Iterated_Element_Association.
Scan; -- past USE
Set_Key_Expression (Assoc_Node, P_Expression);
elsif Present (Filter) then
- -- A loop_parameter_specification also indicates an Ada_2020
+ -- A loop_parameter_specification also indicates an Ada 2022
-- construct, in contrast with a subtype indication used in
-- array aggregates.
TF_Arrow;
Set_Expression (Assoc_Node, P_Expression);
- elsif Ada_Version >= Ada_2020
+ elsif Ada_Version >= Ada_2022
and then Token = Tok_Of
then
Restore_Scan_State (State);
Set_Expression (Assoc_Node, P_Expression);
end if;
- Error_Msg_Ada_2020_Feature ("iterated component", Token_Ptr);
+ Error_Msg_Ada_2022_Feature ("iterated component", Token_Ptr);
return Assoc_Node;
end P_Iterated_Component_Association;
Result : constant Node_Id :=
Make_Expression_With_Actions (Loc, Actions, Expression);
begin
- Error_Msg_Ada_2020_Feature ("declare expression", Loc);
+ Error_Msg_Ada_2022_Feature ("declare expression", Loc);
return Result;
end;
(Loop_Param_Specification_Node, P_Discrete_Subtype_Definition);
if Token = Tok_When then
- Error_Msg_Ada_2020_Feature ("iterator filter", Token_Ptr);
+ Error_Msg_Ada_2022_Feature ("iterator filter", Token_Ptr);
Scan; -- past WHEN
Set_Iterator_Filter
Set_Name (Node1, P_Name);
if Token = Tok_When then
- Error_Msg_Ada_2020_Feature ("iterator filter", Token_Ptr);
+ Error_Msg_Ada_2022_Feature ("iterator filter", Token_Ptr);
Scan; -- past WHEN
Set_Iterator_Filter
-- the time being.
elsif Token = Tok_With then
- Error_Msg_Ada_2020_Feature
+ Error_Msg_Ada_2022_Feature
("aspect on formal parameter", Token_Ptr);
P_Aspect_Specifications (Specification_Node, False);
end if;
--------------
- -- Ada_2020 --
+ -- Ada_2022 --
--------------
- when Pragma_Ada_2020 =>
+ when Pragma_Ada_2022 =>
if Arg_Count = 0 then
- Ada_Version := Ada_2020;
- Ada_Version_Explicit := Ada_2020;
+ Ada_Version := Ada_2022;
+ Ada_Version_Explicit := Ada_2022;
Ada_Version_Pragma := Pragma_Node;
end if;
-- If we have a right paren, then that is taken as ending the list
-- i.e. no comma is present.
- -- Ditto for a right bracket in Ada 2020.
+ -- Ditto for a right bracket in Ada 2022.
elsif Token = Tok_Right_Paren
- or else (Token = Tok_Right_Bracket and then Ada_Version >= Ada_2020)
+ or else (Token = Tok_Right_Bracket and then Ada_Version >= Ada_2022)
then
return False;
-- exception-name". This degrades error recovery slightly, and perhaps
-- we could do better, but not worth the effort.
- -- Ada 2020 introduces square brackets as delimiters for array and
+ -- Ada 2022 introduces square brackets as delimiters for array and
-- container aggregates.
Tok_Raise, -- RAISE
-- AI12-0125-03 : @ is target_name
when '@' =>
- Error_Msg_Ada_2020_Feature ("target name", Token_Ptr);
+ Error_Msg_Ada_2022_Feature ("target name", Token_Ptr);
Accumulate_Checksum ('@');
Scan_Ptr := Scan_Ptr + 1;
-- "abs"'Address. Other literals are included to give better error
-- behavior for illegal cases like 123'Img.
--
- -- In Ada 2020, a target name (i.e. @) is a valid prefix of an
+ -- In Ada 2022, a target name (i.e. @) is a valid prefix of an
-- attribute, and functions like a name.
if Prev_Token = Tok_All
return;
-- Right bracket or right brace, treated as right paren but proper
- -- aggregate delimiter in Ada 2020.
+ -- aggregate delimiter in Ada 2022.
when ']' | '}' =>
- if Ada_Version >= Ada_2020 then
+ if Ada_Version >= Ada_2022 then
Token := Tok_Right_Bracket;
else
elsif Present (Find_Aspect (Typ, Aspect_Aggregate))
and then Ekind (Typ) /= E_Record_Type
- and then Ada_Version >= Ada_2020
+ and then Ada_Version >= Ada_2022
then
Resolve_Container_Aggregate (N, Typ);
Base : constant Node_Id := Expression (N);
begin
- Error_Msg_Ada_2020_Feature ("delta aggregate", Sloc (N));
+ Error_Msg_Ada_2022_Feature ("delta aggregate", Sloc (N));
if not Is_Composite_Type (Typ) then
Error_Msg_N ("not a composite type", N);
Attribute_Max_Alignment_For_Allocation => True,
others => False);
- -- The following array is the list of attributes defined in the Ada 2020
+ -- The following array is the list of attributes defined in the Ada 2022
-- RM which are not defined in Ada 2012. These are recognized in Ada
-- 95/2005/2012 modes, but are considered to be implementation defined.
- Attribute_20 : constant Attribute_Class_Array := Attribute_Class_Array'(
+ Attribute_22 : constant Attribute_Class_Array := Attribute_Class_Array'(
Attribute_Enum_Rep |
Attribute_Enum_Val => True,
others => False);
-- Image_Type may be empty in case of another error detected,
-- or if an N_Raise_xxx_Error node is a parent of N.
- if Ada_Version < Ada_2020
+ if Ada_Version < Ada_2022
and then Present (Image_Type)
and then not Is_Scalar_Type (Image_Type)
then
- Error_Msg_Ada_2020_Feature ("nonscalar ''Image", Sloc (P));
+ Error_Msg_Ada_2022_Feature ("nonscalar ''Image", Sloc (P));
Error_Attr;
end if;
end Check_Image_Type;
case Uneval_Old_Setting is
when 'E' =>
- -- ??? In the case where Ada_Version is < Ada_2020 and
- -- an illegal 'Old prefix would be legal in Ada_2020,
- -- we'd like to call Error_Msg_Ada_2020_Feature.
+ -- ??? In the case where Ada_Version is < Ada_2022 and
+ -- an illegal 'Old prefix would be legal in Ada_2022,
+ -- we'd like to call Error_Msg_Ada_2022_Feature.
-- Identifying that case involves some work.
Error_Attr_P
("prefix of attribute % that is potentially "
& "unevaluated must statically name an entity"
- -- further text needed for accuracy if Ada_2020
- & (if Ada_Version >= Ada_2020
+ -- further text needed for accuracy if Ada_2022
+ & (if Ada_Version >= Ada_2022
and then Attr_Id = Attribute_Old
then " or be eligible for conditional evaluation"
& " (RM 6.1.1 (27))"
-- Deal with Ada 2005 attributes that are implementation attributes
-- because they appear in a version of Ada before Ada 2005, ditto for
- -- Ada 2012 and Ada 2020 attributes appearing in an earlier version.
+ -- Ada 2012 and Ada 2022 attributes appearing in an earlier version.
if (Attribute_05 (Attr_Id) and then Ada_Version < Ada_2005)
or else
(Attribute_12 (Attr_Id) and then Ada_Version < Ada_2012)
or else
- (Attribute_20 (Attr_Id) and then Ada_Version < Ada_2020)
+ (Attribute_22 (Attr_Id) and then Ada_Version < Ada_2022)
then
Check_Restriction (No_Implementation_Attributes, N);
end if;
else
-- Ensure that the prefix of attribute 'Old is an entity when it
-- is potentially unevaluated (6.1.1 (27/3)). This rule is
- -- relaxed in Ada2020 - this relaxation is reflected in the
+ -- relaxed in Ada 2022 - this relaxation is reflected in the
-- call (below) to Eligible_For_Conditional_Evaluation.
if Is_Potentially_Unevaluated (N)
end if;
-- Check for nonatomic subcomponent of a full access object
- -- in Ada 2020 (RM C.6 (12)).
+ -- in Ada 2022 (RM C.6 (12)).
- if Ada_Version >= Ada_2020
+ if Ada_Version >= Ada_2022
and then Is_Subcomponent_Of_Full_Access_Object (P)
and then not Is_Atomic_Object (P)
then
Error_Msg_N ("& is an Ada 2012 unit?i?", Name (N));
end if;
- when Ada_202X_Unit =>
- if Ada_Version < Ada_2020
- and then Warn_On_Ada_202X_Compatibility
+ when Ada_2022_Unit =>
+ if Ada_Version < Ada_2022
+ and then Warn_On_Ada_2022_Compatibility
then
- Error_Msg_N ("& is an Ada 202x unit?i?", Name (N));
+ Error_Msg_N ("& is an Ada 2022 unit?i?", Name (N));
end if;
end case;
end if;
function Build_Subprogram_Decl_Wrapper
(Formal_Subp : Entity_Id) return Node_Id;
- -- Ada 2020 allows formal subprograms to carry pre/postconditions.
+ -- Ada 2022 allows formal subprograms to carry pre/postconditions.
-- At the point of instantiation these contracts apply to uses of
-- the actual subprogram. This is implemented by creating wrapper
-- subprograms instead of the renamings previously used to link
-- package. As usual an other association must be last in the list.
procedure Build_Subprogram_Wrappers;
- -- Ada 2020: AI12-0272 introduces pre/postconditions for formal
+ -- Ada 2022: AI12-0272 introduces pre/postconditions for formal
-- subprograms. The implementation of making the formal into a renaming
-- of the actual does not work, given that subprogram renaming cannot
-- carry aspect specifications. Instead we must create subprogram
Generate_Reference_To_Generic_Formals (Current_Scope);
- -- For Ada 2020, some formal parameters can carry aspects, which must
+ -- For Ada 2022, some formal parameters can carry aspects, which must
-- be name-resolved at the end of the list of formal parameters (which
-- has the semantics of a declaration list).
-- constructed wrapper contains a call to the entity in the renaming.
-- This is an expansion activity, as is the wrapper creation.
- if Ada_Version >= Ada_2020
+ if Ada_Version >= Ada_2022
and then Has_Contracts (Analyzed_Formal)
and then not Is_Entity_Name (Actual)
and then Expander_Active
end if;
-- Check for instantiation on nonatomic subcomponent of a full access
- -- object in Ada 2020 (RM C.6 (12)).
+ -- object in Ada 2022 (RM C.6 (12)).
- if Ada_Version >= Ada_2020
+ if Ada_Version >= Ada_2022
and then Is_Subcomponent_Of_Full_Access_Object (Actual)
and then not Is_Atomic_Object (Actual)
then
Subt : Entity_Id;
procedure Check_Shared_Variable_Control_Aspects;
- -- Ada 2020: Verify that shared variable control aspects (RM C.6)
+ -- Ada 2022: Verify that shared variable control aspects (RM C.6)
-- that may be specified for a formal type are obeyed by the actual.
procedure Diagnose_Predicated_Actual;
-- Check_Shared_Variable_Control_Aspects --
--------------------------------------------
- -- Ada 2020: Verify that shared variable control aspects (RM C.6)
+ -- Ada 2022: Verify that shared variable control aspects (RM C.6)
-- that may be specified for the formal are obeyed by the actual.
-- If the formal is a derived type the aspect specifications must match.
-- NOTE: AI12-0282 implies that matching of aspects is required between
procedure Check_Shared_Variable_Control_Aspects is
begin
- if Ada_Version >= Ada_2020 then
+ if Ada_Version >= Ada_2022 then
if Is_Atomic (A_Gen_T) and then not Is_Atomic (Act_T) then
Error_Msg_NE
("actual for& must have Atomic aspect", Actual, A_Gen_T);
-- Perform atomic/volatile checks (RM C.6(12)). Note that AI05-0218-1
-- removes the second instance of the phrase "or allow pass by copy".
- -- For Ada 2020, the aspect may be specified explicitly for the
+ -- For Ada 2022, the aspect may be specified explicitly for the
-- formal regardless of whether an ancestor obeys it.
if Is_Atomic (Act_T)
-- are in keeping with the components of Address_Clause_Check_Record below.
procedure Validate_Aspect_Aggregate (N : Node_Id);
- -- Check legality of operations given in the Ada 202x Aggregate aspect for
+ -- Check legality of operations given in the Ada 2022 Aggregate aspect for
-- containers.
procedure Resolve_Aspect_Aggregate
procedure Validate_Aspect_Stable_Properties
(E : Entity_Id; N : Node_Id; Class_Present : Boolean);
- -- Check legality of functions given in the Ada 202x Stable_Properties
+ -- Check legality of functions given in the Ada 2022 Stable_Properties
-- (or Stable_Properties'Class) aspect.
procedure Resolve_Aspect_Stable_Properties
end if;
-- For representation aspects, check for case of untagged derived
- -- type whose parent either has primitive operations (pre Ada 202x),
+ -- type whose parent either has primitive operations (pre Ada 2022),
-- or is a by-reference type (RM 13.1(10)).
-- Strictly speaking the check also applies to Ada 2012 but it is
-- really too constraining for existing code already, so relax it.
and then Has_Primitive_Operations (Parent_Type)
then
Error_Msg_N
- ("|representation aspect not permitted before Ada 202x: " &
- "use -gnat2020!", N);
+ ("|representation aspect not permitted before Ada 2022: " &
+ "use -gnat2022!", N);
Error_Msg_NE
("\parent type & has primitive operations!", N, Parent_Type);
-- Perform analysis of aspect Yield
procedure Analyze_Aspect_Static;
- -- Ada 202x (AI12-0075): Perform analysis of aspect Static
+ -- Ada 2022 (AI12-0075): Perform analysis of aspect Static
procedure Check_Expr_Is_OK_Static_Expression
(Expr : Node_Id;
Is_Imported_Intrinsic : Boolean;
begin
- if Ada_Version < Ada_2020 then
- Error_Msg_Ada_2020_Feature ("aspect %", Sloc (Aspect));
+ if Ada_Version < Ada_2022 then
+ Error_Msg_Ada_2022_Feature ("aspect %", Sloc (Aspect));
return;
end if;
return;
- -- Ada 202x (AI12-0075): Check that the function satisfies
+ -- Ada 2022 (AI12-0075): Check that the function satisfies
-- several requirements of static functions as specified in
-- RM 6.8(5.1-5.8). Note that some of the requirements given
-- there are checked elsewhere.
else
-- The expression of the expression function must be a
- -- potentially static expression (RM 202x 6.8(3.2-3.4)).
+ -- potentially static expression (RM 2022 6.8(3.2-3.4)).
-- That's checked in Sem_Ch6.Analyze_Expression_Function.
-- The function must not contain any calls to itself, which
-- as is the case with generic derived types.
if Nkind (Original_Node (N)) = N_Formal_Type_Declaration then
- if Ada_Version < Ada_2020 then
+ if Ada_Version < Ada_2022 then
Error_Msg_N
("aspect % not allowed for formal type declaration",
Aspect);
goto Continue;
end if;
- if Ada_Version < Ada_2020 then
+ if Ada_Version < Ada_2022 then
Check_Restriction
(No_Implementation_Aspect_Specifications, N);
end if;
Analyze_Aspect_Disable_Controlled;
goto Continue;
- -- Ada 202x (AI12-0129): Exclusive_Functions
+ -- Ada 2022 (AI12-0129): Exclusive_Functions
elsif A_Id = Aspect_Exclusive_Functions then
if Ekind (E) /= E_Protected_Type then
goto Continue;
- -- Ada 202x (AI12-0363): Full_Access_Only
+ -- Ada 2022 (AI12-0363): Full_Access_Only
elsif A_Id = Aspect_Full_Access_Only then
- Error_Msg_Ada_2020_Feature ("aspect %", Sloc (Aspect));
+ Error_Msg_Ada_2022_Feature ("aspect %", Sloc (Aspect));
- -- Ada 202x (AI12-0075): static expression functions
+ -- Ada 2022 (AI12-0075): static expression functions
elsif A_Id = Aspect_Static then
Analyze_Aspect_Static;
goto Continue;
- -- Ada 2020 (AI12-0279)
+ -- Ada 2022 (AI12-0279)
elsif A_Id = Aspect_Yield then
Analyze_Aspect_Yield;
and then (Nkind (N) /= N_Pragma
or else Get_Pragma_Id (N) /= Pragma_Convention)
then
- if Ada_Version < Ada_2020 then
+ if Ada_Version < Ada_2022 then
Error_Msg_N
("representation item not allowed for generic type", N);
return True;
return True;
-- Check for case of untagged derived type whose parent either has
- -- primitive operations (pre Ada 202x), or is a by-reference type (RM
+ -- primitive operations (pre Ada 2022), or is a by-reference type (RM
-- 13.1(10)). In this case we do not output a Too_Late message, since
-- there is no earlier point where the rep item could be placed to make
-- it legal.
and then Has_Primitive_Operations (Parent_Type)
then
Error_Msg_N
- ("|representation item not permitted before Ada 202x!", N);
+ ("|representation item not permitted before Ada 2022!", N);
Error_Msg_NE
("\parent type & has primitive operations!", N, Parent_Type);
return True;
Assign_Indexed_Subp : Node_Id := Empty;
begin
- Error_Msg_Ada_2020_Feature ("aspect Aggregate", Sloc (N));
+ Error_Msg_Ada_2022_Feature ("aspect Aggregate", Sloc (N));
if Nkind (N) /= N_Aggregate
or else Present (Expressions (N))
-- Start of processing for Validate_Aspect_Stable_Properties
begin
- Error_Msg_Ada_2020_Feature ("aspect Stable_Properties", Sloc (N));
+ Error_Msg_Ada_2022_Feature ("aspect Stable_Properties", Sloc (N));
if (not Is_Aspect_Of_Type) and then (not Is_Subprogram (E)) then
Error_Msg_N ("Stable_Properties aspect can only be specified for "
-- so that pre/postconditions can be handled directly on the
-- generated wrapper.
- if Ada_Version >= Ada_2020
+ if Ada_Version >= Ada_2022
and then Present (Aspect_Specifications (N))
then
Build_Access_Subprogram_Wrapper (N);
end if;
end if;
- -- Ada 2005 (AI95-0414) and Ada 2020 (AI12-0269): Diagnose failure to
+ -- Ada 2005 (AI95-0414) and Ada 2022 (AI12-0269): Diagnose failure to
-- match No_Return in parent, but do it unconditionally in Ada 95 too
-- for procedures, since this is our pragma.
-- that functions with controlling access results of record extensions
-- with a null extension part require overriding (AI95-00391/06).
- -- Ada 202x (AI12-0042): Similarly, set those properties for
+ -- Ada 2022 (AI12-0042): Similarly, set those properties for
-- implementing the rule of RM 7.3.2(6.1/4).
-- A subprogram subject to pragma Extensions_Visible with value False
Set_Mechanism (New_Subp, Mechanism (Parent_Subp));
end if;
- -- Ada 2020 (AI12-0279): If a Yield aspect is specified True for a
+ -- Ada 2022 (AI12-0279): If a Yield aspect is specified True for a
-- primitive subprogram S of a type T, then the aspect is inherited
-- by the corresponding primitive subprogram of each descendant of T.
-- assignment, and gets tied up with itself.
-- We also omit the warning if the RHS includes target names,
- -- that is to say the Ada2020 "@" that denotes an instance of
+ -- that is to say the Ada 2022 "@" that denotes an instance of
-- the LHS, which indicates that the current value is being
-- used. Note that this implicit reference to the entity on
-- the RHS is not treated as a source reference.
-- the global flag Checking_Potentially_Static_Expression
-- enabled. If the resulting expression is static, then it's
-- OK, but if not, that means the expression violates the
- -- requirements of the Ada 202x RM in 4.9(3.2/5-3.4/5) and
+ -- requirements of the Ada 2022 RM in 4.9(3.2/5-3.4/5) and
-- we flag an error.
if Is_Static_Function (Def_Id) then
-- Function result subtype
procedure Check_No_Return_Expression (Return_Expr : Node_Id);
- -- Ada 2020: Check that the return expression in a No_Return function
+ -- Ada 2022: Check that the return expression in a No_Return function
-- meets the conditions specified by RM 6.5.1(5.1/5).
procedure Check_Return_Construct_Accessibility (Return_Stmt : Node_Id);
Check_Return_Construct_Accessibility (N);
- -- Ada 2020 (AI12-0269): Any return statement that applies to a
+ -- Ada 2022 (AI12-0269): Any return statement that applies to a
-- nonreturning function shall be a simple_return_statement with
-- an expression that is a raise_expression, or else a call on a
-- nonreturning function, or else a parenthesized expression of
-- one of these.
- if Ada_Version >= Ada_2020
+ if Ada_Version >= Ada_2022
and then No_Return (Scope_Id)
and then Comes_From_Source (N)
then
end if;
end if;
- -- Ada 2020 (AI12-0269): Any return statement that applies to a
+ -- Ada 2022 (AI12-0269): Any return statement that applies to a
-- nonreturning function shall be a simple_return_statement.
- if Ada_Version >= Ada_2020
+ if Ada_Version >= Ada_2022
and then No_Return (Scope_Id)
and then Comes_From_Source (N)
then
-- Ignore (accept) N_Raise_xxx_Error nodes in this context.
elsif No_Raise_xxx_Error (Nam) = OK then
- Error_Msg_Ada_2020_Feature ("value in renaming", Sloc (Nam));
+ Error_Msg_Ada_2022_Feature ("value in renaming", Sloc (Nam));
end if;
Set_Etype (Id, T2);
Set_Is_SPARK_Mode_On_Node (Marker, Is_SPARK_Mode_On_Node (N));
Set_Target (Marker, Subp_Id);
- -- Ada 2020 (AI12-0175): Calls to certain functions that are essentially
+ -- Ada 2022 (AI12-0175): Calls to certain functions that are essentially
-- unchecked conversions are preelaborable.
- if Ada_Version >= Ada_2020 then
+ if Ada_Version >= Ada_2022 then
Set_Is_Preelaborable_Call (Marker, Is_Preelaborable_Construct (N));
else
Set_Is_Preelaborable_Call (Marker, False);
Error_Msg_Warn := GNAT_Mode;
- -- Ada 2020 (AI12-0175): Calls to certain functions that are essentially
+ -- Ada 2022 (AI12-0175): Calls to certain functions that are essentially
-- unchecked conversions are preelaborable.
- if Ada_Version >= Ada_2020 then
+ if Ada_Version >= Ada_2022 then
Error_Msg_N
("<<non-preelaborable call not allowed in preelaborated unit", N);
else
-- Complain if ref that comes from source in preelaborated unit
-- and we are not inside a subprogram (i.e. we are in elab code).
- -- Ada 2020 (AI12-0175): Calls to certain functions that are
+ -- Ada 2022 (AI12-0175): Calls to certain functions that are
-- essentially unchecked conversions are preelaborable.
if Comes_From_Source (N)
and then In_Preelaborated_Unit
and then not In_Inlined_Body
and then Nkind (N) /= N_Attribute_Reference
- and then not (Ada_Version >= Ada_2020
+ and then not (Ada_Version >= Ada_2022
and then Is_Preelaborable_Construct (N))
then
Error_Preelaborated_Call (N);
Checking_For_Potentially_Static_Expression : Boolean := False;
-- Global flag that is set True during Analyze_Static_Expression_Function
-- in order to verify that the result expression of a static expression
- -- function is a potentially static function (see RM202x 6.8(5.3)).
+ -- function is a potentially static function (see RM2022 6.8(5.3)).
-----------------------
-- Local Subprograms --
then
Eval_Intrinsic_Call (N, Entity (Name (N)));
- -- Ada 202x (AI12-0075): If checking for potentially static expressions
+ -- Ada 2022 (AI12-0075): If checking for potentially static expressions
-- is enabled and we have a call to a static function, substitute a
-- static value for the call, to allow folding the expression. This
-- supports checking the requirement of RM 6.8(5.3/5) in
return;
end if;
- -- Ada 202x (AI12-0075): If checking for potentially static expressions
+ -- Ada 2022 (AI12-0075): If checking for potentially static expressions
-- is enabled and we have a reference to a formal parameter of mode in,
-- substitute a static value for the reference, to allow folding the
-- expression. This supports checking the requirement of RM 6.8(5.3/5)
-- Relational operations are static functions, so the result is static if
-- both operands are static (RM 4.9(7), 4.9(20)), except that up to Ada
-- 2012, for strings the result is never static, even if the operands are.
- -- The string case was relaxed in Ada 2020, see AI12-0201.
+ -- The string case was relaxed in Ada 2022, see AI12-0201.
-- However, for internally generated nodes, we allow string equality and
-- inequality to be static. This is because we rewrite A in "ABC" as an
and then Right_Len /= Uint_Minus_1
and then Left_Len /= Right_Len
then
- -- AI12-0201: comparison of string is static in Ada 202x
+ -- AI12-0201: comparison of string is static in Ada 2022
Fold_Uint
(N,
Test (Nkind (N) = N_Op_Ne),
- Static => Ada_Version >= Ada_2020
+ Static => Ada_Version >= Ada_2022
and then Is_String_Type (Left_Typ));
Warn_On_Known_Condition (N);
return;
(N, Left, Right, Is_Static_Expression, Fold);
-- Comparisons of scalars can give static results.
- -- In addition starting with Ada 202x (AI12-0201), comparison of strings
+ -- In addition starting with Ada 2022 (AI12-0201), comparison of strings
-- can also give static results, and as noted above, we also allow for
-- earlier Ada versions internally generated equality and inequality for
-- strings.
- -- ??? The Comes_From_Source test below isn't correct and will accept
- -- some cases that are illegal in Ada 2012. and before. Now that Ada
- -- 202x has relaxed the rules, this doesn't really matter.
+ -- The Comes_From_Source test below isn't correct and will accept
+ -- some cases that are illegal in Ada 2012 and before. Now that Ada
+ -- 2022 has relaxed the rules, this doesn't really matter.
if Is_String_Type (Left_Typ) then
- if Ada_Version < Ada_2020
+ if Ada_Version < Ada_2022
and then (Comes_From_Source (N)
or else Nkind (N) not in N_Op_Eq | N_Op_Ne)
then
end if;
-- If original node was a type conversion, then result if non-static
- -- up to Ada 2012. AI12-0201 changes that with Ada 202x.
+ -- up to Ada 2012. AI12-0201 changes that with Ada 2022.
if Nkind (Original_Node (N)) = N_Type_Conversion
and then Ada_Version <= Ada_2012
-- Conversion_OK is set, in which case it counts as integer.
-- Fold conversion, case of string type. The result is static starting
- -- with Ada 202x (AI12-0201).
+ -- with Ada 2022 (AI12-0201).
if Is_String_Type (Target_Type) then
Fold_Str
(N,
Strval (Get_String_Val (Operand)),
- Static => Ada_Version >= Ada_2020);
+ Static => Ada_Version >= Ada_2022);
return;
-- Fold conversion, case of integer target type
-- match if they are set (unless checking an actual for a formal derived
-- type). The use of 'Object_Size can cause this to be false even if the
-- types would otherwise match in the Ada 95 RM sense, but this deviation
- -- is adopted by AI12-059 which introduces Object_Size in Ada 2020.
+ -- is adopted by AI12-059 which introduces Object_Size in Ada 2022.
function Subtypes_Statically_Match
(T1 : Entity_Id;
then
null;
- -- For Ada 2020, pre/postconditions can appear on formal subprograms
+ -- For Ada 2022, pre/postconditions can appear on formal subprograms
elsif Nkind (Subp_Decl) = N_Formal_Concrete_Subprogram_Declaration
- and then Ada_Version >= Ada_2020
+ and then Ada_Version >= Ada_2022
then
null;
procedure Process_Atomic_Independent_Shared_Volatile is
procedure Check_Full_Access_Only (Ent : Entity_Id);
-- Apply legality checks to type or object Ent subject to the
- -- Full_Access_Only aspect in Ada 2020 (RM C.6(8.2)).
+ -- Full_Access_Only aspect in Ada 2022 (RM C.6(8.2)).
procedure Mark_Component_Or_Object (Ent : Entity_Id);
-- Appropriately set flags on the given entity, either an array or
-- Attribute belongs on the base type. If the view of the type is
-- currently private, it also belongs on the underlying type.
- -- In Ada 2020, the pragma can apply to a formal type, for which
+ -- In Ada 2022, the pragma can apply to a formal type, for which
-- there may be no underlying type.
if Prag_Id = Pragma_Atomic
Check_Duplicate_Pragma (E);
- -- Check the constraints of Full_Access_Only in Ada 2020. Note that
+ -- Check the constraints of Full_Access_Only in Ada 2022. Note that
-- they do not apply to GNAT's Volatile_Full_Access because 1) this
-- aspect subsumes the Volatile aspect and 2) nesting is supported
-- for this aspect and the outermost enclosing VFA object prevails.
-- Note also that we used to forbid specifying both Atomic and VFA on
-- the same type or object, but the restriction has been lifted in
- -- light of the semantics of Full_Access_Only and Atomic in Ada 2020.
+ -- light of the semantics of Full_Access_Only and Atomic in Ada 2022.
if Prag_Id = Pragma_Volatile_Full_Access
and then From_Aspect_Specification (N)
Warn => Treat_Restrictions_As_Warnings,
Profile => Ravenscar);
- -- Set the following restriction which was added to Ada 2020,
+ -- Set the following restriction which was added to Ada 2022,
-- but as a binding interpretation:
-- No_Dependence => Ada.Synchronous_Barriers
-- for Ravenscar (and therefore for Ravenscar variants) but not
end;
--------------
- -- Ada_2020 --
+ -- Ada_2022 --
--------------
- -- pragma Ada_2020;
+ -- pragma Ada_2022;
-- Note: this pragma also has some specific processing in Par.Prag
- -- because we want to set the Ada 2020 version mode during parsing.
+ -- because we want to set the Ada 2022 version mode during parsing.
- when Pragma_Ada_2020 =>
+ when Pragma_Ada_2022 =>
GNAT_Pragma;
Check_Arg_Count (0);
-- Now set appropriate Ada mode
- Ada_Version := Ada_2020;
- Ada_Version_Explicit := Ada_2020;
+ Ada_Version := Ada_2022;
+ Ada_Version_Explicit := Ada_2022;
Ada_Version_Pragma := N;
-------------------------------------
and then Nkind (Object_Definition (D)) =
N_Constrained_Array_Definition)
or else
- (Ada_Version >= Ada_2020
+ (Ada_Version >= Ada_2022
and then Nkind (D) = N_Formal_Type_Declaration)
then
-- The flag is set on the base type, or on the object
raise Pragma_Exit;
end if;
- -- Loop to find matching procedures or functions (Ada 2020)
+ -- Loop to find matching procedures or functions (Ada 2022)
E := Entity (Id);
while Present (E)
and then Scope (E) = Current_Scope
loop
- -- Ada 2020 (AI12-0269): A function can be No_Return
+ -- Ada 2022 (AI12-0269): A function can be No_Return
if Ekind (E) in E_Generic_Procedure | E_Procedure
- or else (Ada_Version >= Ada_2020
+ or else (Ada_Version >= Ada_2022
and then
Ekind (E) in E_Generic_Function | E_Function)
then
then
Set_No_Return (Entity (Id));
- elsif Ada_Version >= Ada_2020 then
+ elsif Ada_Version >= Ada_2022 then
Error_Pragma_Arg
("no subprogram& found for pragma%", Arg);
elsif Present (Generic_Parent (Specification (Stmt))) then
return Stmt;
- -- Ada 2020: contract on formal subprogram or on generated
+ -- Ada 2022: contract on formal subprogram or on generated
-- Access_Subprogram_Wrapper, which appears after the related
-- Access_Subprogram declaration.
elsif Is_Generic_Actual_Subprogram (Defining_Entity (Stmt))
- and then Ada_Version >= Ada_2020
+ and then Ada_Version >= Ada_2022
then
return Stmt;
elsif Is_Access_Subprogram_Wrapper (Defining_Entity (Stmt))
- and then Ada_Version >= Ada_2020
+ and then Ada_Version >= Ada_2022
then
return Stmt;
end if;
Pragma_Ada_2005 => -1,
Pragma_Ada_12 => -1,
Pragma_Ada_2012 => -1,
- Pragma_Ada_2020 => -1,
+ Pragma_Ada_2022 => -1,
Pragma_Aggregate_Individually_Assign => 0,
Pragma_All_Calls_Remote => -1,
Pragma_Allow_Integer_Address => -1,
end loop;
end if;
- -- Additional message and hint if the ambiguity involves an Ada2020
+ -- Additional message and hint if the ambiguity involves an Ada 2022
-- container aggregate.
Check_Ambiguous_Aggregate (N);
elsif Nkind (N) = N_Aggregate
and then Etype (N) = Any_Composite
then
- if Ada_Version >= Ada_2020
+ if Ada_Version >= Ada_2022
and then Has_Aspect (Typ, Aspect_Aggregate)
then
Resolve_Container_Aggregate (N, Typ);
end if;
-- Check for nonatomic subcomponent of a full access object
- -- in Ada 2020 (RM C.6 (12)).
+ -- in Ada 2022 (RM C.6 (12)).
- if Ada_Version >= Ada_2020
+ if Ada_Version >= Ada_2022
and then Is_Subcomponent_Of_Full_Access_Object (A)
and then not Is_Atomic_Object (A)
then
Scope_Loop : while Scop /= Standard_Standard loop
if Same_Or_Aliased_Subprograms (Nam, Scop) then
- -- Ada 202x (AI12-0075): Static functions are never allowed
+ -- Ada 2022 (AI12-0075): Static functions are never allowed
-- to make a recursive call, as specified by 6.8(5.4/5).
if Is_Static_Function (Scop) then
Warn_On_Overlapping_Actuals (Nam, N);
- -- Ada 202x (AI12-0075): If the call is a static call to a static
+ -- Ada 2022 (AI12-0075): If the call is a static call to a static
-- expression function, then we want to "inline" the call, replacing
-- it with the folded static result. This is not done if the checking
-- for a potentially static expression is enabled or if an error has
end if;
-- If the array type is atomic and the component is not, then this is
- -- worth a warning before Ada 2020, since we have a situation where the
+ -- worth a warning before Ada 2022, since we have a situation where the
-- access to the component may cause extra read/writes of the atomic
-- object, or partial word accesses, both of which may be unexpected.
and then Has_Atomic_Components
(Entity (Prefix (N)))))
and then not Is_Atomic (Component_Type (Array_Type))
- and then Ada_Version < Ada_2020
+ and then Ada_Version < Ada_2022
then
Error_Msg_N
("??access to non-atomic component of atomic array", Prefix (N));
if Nkind (N) = N_Selected_Component then
-- If the record type is atomic and the component is not, then this
- -- is worth a warning before Ada 2020, since we have a situation
+ -- is worth a warning before Ada 2022, since we have a situation
-- where the access to the component may cause extra read/writes of
-- the atomic object, or partial word accesses, both of which may be
-- unexpected.
if Is_Atomic_Ref_With_Address (N)
and then not Is_Atomic (Entity (S))
and then not Is_Atomic (Etype (Entity (S)))
- and then Ada_Version < Ada_2020
+ and then Ada_Version < Ada_2022
then
Error_Msg_N
("??access to non-atomic component of atomic record",
elsif T2 = Any_Composite and then Is_Aggregate_Type (T1) then
return True;
- -- In Ada_2020, an aggregate is compatible with the type that
- -- as the ccorrespoding aspect.
+ -- In Ada_2022, an aggregate is compatible with the type that
+ -- as the corresponding aspect.
- elsif Ada_Version >= Ada_2020
+ elsif Ada_Version >= Ada_2022
and then T2 = Any_Composite
and then Present (Find_Aspect (T1, Aspect_Aggregate))
then
-- have a default.
function Is_Preelaborable_Function (Id : Entity_Id) return Boolean;
- -- Ada 2020: Determine whether the specified function is suitable as the
+ -- Ada 2022: Determine whether the specified function is suitable as the
-- name of a call in a preelaborable construct (RM 10.2.1(7/5)).
type Null_Status_Kind is
then
Discrim_Value_Status := Static_Expr;
else
- if Ada_Version >= Ada_2020 then
+ if Ada_Version >= Ada_2022 then
if Original_Node (Discrim_Value) /= Discrim_Value
and then Nkind (Discrim_Value) = N_Type_Conversion
and then Etype (Original_Node (Discrim_Value))
-- components are being gathered for an aggregate, in which case
-- the caller must check Report_Errors.
--
- -- In Ada 2020 the above rules are relaxed. A nonstatic governing
+ -- In Ada 2022 the above rules are relaxed. A nonstatic governing
-- discriminant is OK as long as it has a static subtype and
-- every value of that subtype (and there must be at least one)
-- selects the same variant.
if OK_Scope_For_Discrim_Value_Error_Messages then
- if Ada_Version >= Ada_2020 then
+ if Ada_Version >= Ada_2022 then
Error_Msg_FE
("value for discriminant & must be static or " &
"discriminant's nominal subtype must be static " &
return Is_Tagged_Type (Etype (Obj))
and then Is_Aliased_View (Expression (Obj));
- -- Ada 202x AI12-0228
+ -- Ada 2022 AI12-0228
elsif Nkind (Obj) = N_Qualified_Expression
and then Ada_Version >= Ada_2012
when N_Function_Call =>
- -- Ada 2020 (AI12-0175): Calls to certain functions that are
+ -- Ada 2022 (AI12-0175): Calls to certain functions that are
-- essentially unchecked conversions are preelaborable.
- if Ada_Version >= Ada_2020
+ if Ada_Version >= Ada_2022
and then Nkind (Expr) = N_Function_Call
and then Is_Entity_Name (Name (Expr))
and then Is_Preelaborable_Function (Entity (Name (Expr)))
and then Is_Object_Reference (Expression (N));
else
- -- AI12-0226: In Ada 202x a value conversion of an object is
+ -- AI12-0226: In Ada 2022 a value conversion of an object is
-- an object.
return Is_Object_Reference (Expression (N));
and then Aggregate_Type /= Any_Composite
then
if Is_Array_Type (Aggregate_Type) then
- if Ada_Version >= Ada_2020 then
- -- For Ada_2020, this predicate returns True for
+ if Ada_Version >= Ada_2022 then
+ -- For Ada 2022, this predicate returns True for
-- any "repeatedly evaluated" expression.
return True;
end if;
elsif Nkind (N) = N_Null then
return True;
- -- Ada 2020 (AI12-0175): Calls to certain functions that are essentially
+ -- Ada 2022 (AI12-0175): Calls to certain functions that are essentially
-- unchecked conversions are preelaborable.
- elsif Ada_Version >= Ada_2020
+ elsif Ada_Version >= Ada_2022
and then Nkind (N) = N_Function_Call
and then Is_Entity_Name (Name (N))
and then Is_Preelaborable_Function (Entity (Name (N)))
function Is_Static_Function (Subp : Entity_Id) return Boolean is
begin
- -- Always return False for pre Ada 2020 to e.g. ignore the Static
- -- aspect in package Interfaces for Ada_Version < 2020 and also
+ -- Always return False for pre Ada 2022 to e.g. ignore the Static
+ -- aspect in package Interfaces for Ada_Version < 2022 and also
-- for efficiency.
- return Ada_Version >= Ada_2020
+ return Ada_Version >= Ada_2022
and then Has_Aspect (Subp, Aspect_Static)
and then
(No (Find_Value_Of_Aspect (Subp, Aspect_Static))
-- type case correctly, so we avoid that problem by
-- returning True here.
return True;
- elsif Ada_Version < Ada_2020 then
+ elsif Ada_Version < Ada_2022 then
return False;
elsif not Is_Conditionally_Evaluated (Expr) then
return False;
-- means that for sure CE cannot be raised.
procedure Check_Ambiguous_Aggregate (Call : Node_Id);
- -- Additional information on an ambiguous call in Ada_2020 when a
+ -- Additional information on an ambiguous call in Ada_2022 when a
-- subprogram call has an actual that is an aggregate, and the
-- presence of container aggregates (or types with the correwponding
-- aspect) provides an additional interpretation. Message indicates
function Is_Full_Access_Object (N : Node_Id) return Boolean;
-- Determine whether arbitrary node N denotes a reference to a full access
- -- object as per Ada 2020 RM C.6(8.2).
+ -- object as per Ada 2022 RM C.6(8.2).
function Is_Fully_Initialized_Type (Typ : Entity_Id) return Boolean;
-- Typ is a type entity. This function returns true if this type is fully
-- (typically a 'Old attribute reference), returns True if
-- - the expression is conditionally evaluated; and
-- - its determining expressions are all known on entry; and
- -- - Ada_Version >= Ada_2020.
+ -- - Ada_Version >= Ada_2022.
-- See RM 6.1.1 for definitions of these terms.
--
-- Also returns True if Expr is of an anonymous access type;
-- Test_Case
-- Is_Homogeneous_Aggregate (Flag14)
- -- A flag set on an Ada 2020 aggregate that uses square brackets as
+ -- A flag set on an Ada 2022 aggregate that uses square brackets as
-- delimiters, and thus denotes an array or container aggregate, or
-- the prefix of a reduction attribute.
-- the construct is parsed as an Iterated_Component_Association,
-- and legality checks are performed during semantic analysis.
- -- Both iterated associations are Ada2020 features that are
+ -- Both iterated associations are Ada 2022 features that are
-- expanded during aggregate construction, and do not appear in
-- expanded code.
-- Sloc points to @
-- Etype (Node5-Sem)
- -- Note (Ada 2020): node is used during analysis as a placeholder for
+ -- Note (Ada 2022): node is used during analysis as a placeholder for
-- the value of the LHS of the enclosing assignment statement. Node is
-- eventually rewritten together with enclosing assignment, and backends
-- are not aware of it.
-- DEFINING_IDENTIFIER in [reverse] DISCRETE_SUBTYPE_DEFINITION
-- [Iterator_Filter]
- -- Note; the optional Iterator_Filter is an Ada_2020 construct.
+ -- Note: the optional Iterator_Filter is an Ada 2022 construct.
-- N_Loop_Parameter_Specification
-- Sloc points to first identifier
-- If the actions contain declarations, then these declarations may
-- be referenced within the expression.
- -- (AI12-0236-1): In Ada 2020, for a declare_expression, the parser
+ -- (AI12-0236-1): In Ada 2022, for a declare_expression, the parser
-- generates an N_Expression_With_Actions. Declare_expressions have
-- various restrictions, which we do not enforce on
-- N_Expression_With_Actions nodes that are generated by the
Name_Ada_2005 : constant Name_Id := N + $; -- GNAT
Name_Ada_12 : constant Name_Id := N + $; -- GNAT
Name_Ada_2012 : constant Name_Id := N + $; -- GNAT
- Name_Ada_2020 : constant Name_Id := N + $; -- GNAT
+ Name_Ada_2022 : constant Name_Id := N + $; -- GNAT
Name_Aggregate_Individually_Assign : constant Name_Id := N + $; -- GNAT
Name_Allow_Integer_Address : constant Name_Id := N + $; -- GNAT
Name_Annotate : constant Name_Id := N + $; -- GNAT
Pragma_Ada_2005,
Pragma_Ada_12,
Pragma_Ada_2012,
- Pragma_Ada_2020,
- -- Note that there is no Pragma_Ada_20. Pragma_Ada_05/12 are for
+ Pragma_Ada_2022,
+ -- Note that there is no Pragma_Ada_22. Pragma_Ada_05/12 are for
-- compatibility reasons only; the full year names are preferred.
Pragma_Aggregate_Individually_Assign,
Pragma_Allow_Integer_Address,
-- AI12-0275: Object_Renaming_Declaration without explicit subtype
- elsif Ada_Version >= Ada_2020 then
+ elsif Ada_Version >= Ada_2022 then
null;
else
elsif Switch_Chars (Ptr .. Ptr + 3) = "2012" then
Ada_Version := Ada_2012;
- elsif Switch_Chars (Ptr .. Ptr + 3) = "2020" then
- Ada_Version := Ada_2020;
+ elsif Switch_Chars (Ptr .. Ptr + 3) = "2020"
+ or else Switch_Chars (Ptr .. Ptr + 3) = "2022"
+ then
+ Ada_Version := Ada_2022;
else
Bad_Switch ("-gnat" & Switch_Chars (Ptr .. Ptr + 3));
-- Line for -gnat95 switch
Write_Switch_Char ("95");
-
- if Ada_Version_Default = Ada_95 then
- Write_Line ("Ada 95 mode (default)");
- else
- Write_Line ("Ada 95 mode");
- end if;
+ Write_Line ("Ada 95 mode");
-- Line for -gnat2005 switch
Write_Switch_Char ("2005");
-
- if Ada_Version_Default = Ada_2005 then
- Write_Line ("Ada 2005 mode (default)");
- else
- Write_Line ("Ada 2005 mode");
- end if;
+ Write_Line ("Ada 2005 mode");
end if;
-- Line for -gnat2012 switch
Write_Line ("Ada 2012 mode");
end if;
+ -- Line for -gnat2022 switch
+
+ Write_Switch_Char ("2022");
+
+ if Ada_Version_Default = Ada_2022 then
+ Write_Line ("Ada 2022 mode (default)");
+ else
+ Write_Line ("Ada 2022 mode");
+ end if;
+
-- Line for -gnat-p switch
Write_Switch_Char ("-p");