From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id 38277398B17D; Tue, 15 Jun 2021 10:20:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 38277398B17D MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-1453] [Ada] Rename Ada 202* to Ada 2022 X-Act-Checkin: gcc X-Git-Author: Arnaud Charlet X-Git-Refname: refs/heads/master X-Git-Oldrev: 4dbdeeb889dfd4dcce214e1525b56a7464128a3c X-Git-Newrev: 81e68a1954366f6b1730d75c932814121d743aa3 Message-Id: <20210615102056.38277398B17D@sourceware.org> Date: Tue, 15 Jun 2021 10:20:56 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jun 2021 10:20:56 -0000 https://gcc.gnu.org/g:81e68a1954366f6b1730d75c932814121d743aa3 commit r12-1453-g81e68a1954366f6b1730d75c932814121d743aa3 Author: Arnaud Charlet Date: Mon Mar 1 05:45:25 2021 -0500 [Ada] Rename Ada 202* to Ada 2022 gcc/ada/ * einfo.ads, errout.adb, errout.ads, exp_aggr.adb, exp_ch5.adb, exp_ch6.adb, exp_ch8.adb, exp_ch9.adb, exp_imgv.adb, exp_put_image.adb, fe.h, impunit.adb, impunit.ads, libgnat/a-cobove.ads, libgnat/a-convec.ads, opt.ads, par-ch12.adb, par-ch3.adb, par-ch4.adb, par-ch5.adb, par-ch6.adb, par-prag.adb, par-util.adb, scans.ads, scng.adb, sem_aggr.adb, sem_attr.adb, sem_ch10.adb, sem_ch12.adb, sem_ch13.adb, sem_ch3.adb, sem_ch5.adb, sem_ch6.adb, sem_ch8.adb, sem_elab.adb, sem_eval.adb, sem_prag.adb, sem_res.adb, sem_type.adb, sem_util.adb, sem_util.ads, sinfo.ads, snames.ads-tmpl, sprint.adb, switch-c.adb, usage.adb, doc/gnat_ugn/building_executable_programs_with_gnat.rst, doc/gnat_rm/implementation_defined_aspects.rst, gcc-interface/trans.c: Update all references to Ada 2020 to Ada 2022. Rename pragma Ada_2020 to Ada_2022. Update documentation accordingly. * gnat_ugn.texi, gnat_rm.texi: Regenerate. Diff: --- .../doc/gnat_rm/implementation_defined_aspects.rst | 2 +- .../building_executable_programs_with_gnat.rst | 18 ++++++++- gcc/ada/einfo.ads | 12 +++--- gcc/ada/errout.adb | 12 +++--- gcc/ada/errout.ads | 4 +- gcc/ada/exp_aggr.adb | 2 +- gcc/ada/exp_ch5.adb | 6 +-- gcc/ada/exp_ch6.adb | 8 ++-- gcc/ada/exp_ch8.adb | 2 +- gcc/ada/exp_ch9.adb | 14 +++---- gcc/ada/exp_imgv.adb | 4 +- gcc/ada/exp_put_image.adb | 6 +-- gcc/ada/fe.h | 2 +- gcc/ada/gcc-interface/trans.c | 8 ++-- gcc/ada/gnat_rm.texi | 2 +- gcc/ada/gnat_ugn.texi | 27 ++++++++++++- gcc/ada/impunit.adb | 14 +++---- gcc/ada/impunit.ads | 2 +- gcc/ada/libgnat/a-cobove.ads | 2 +- gcc/ada/libgnat/a-convec.ads | 2 +- gcc/ada/opt.ads | 12 +++--- gcc/ada/par-ch12.adb | 2 +- gcc/ada/par-ch3.adb | 2 +- gcc/ada/par-ch4.adb | 22 +++++------ gcc/ada/par-ch5.adb | 4 +- gcc/ada/par-ch6.adb | 2 +- gcc/ada/par-prag.adb | 8 ++-- gcc/ada/par-util.adb | 4 +- gcc/ada/scans.ads | 2 +- gcc/ada/scng.adb | 8 ++-- gcc/ada/sem_aggr.adb | 4 +- gcc/ada/sem_attr.adb | 28 +++++++------- gcc/ada/sem_ch10.adb | 8 ++-- gcc/ada/sem_ch12.adb | 20 +++++----- gcc/ada/sem_ch13.adb | 44 +++++++++++----------- gcc/ada/sem_ch3.adb | 8 ++-- gcc/ada/sem_ch5.adb | 2 +- gcc/ada/sem_ch6.adb | 12 +++--- gcc/ada/sem_ch8.adb | 2 +- gcc/ada/sem_elab.adb | 12 +++--- gcc/ada/sem_eval.adb | 30 +++++++-------- gcc/ada/sem_prag.adb | 44 +++++++++++----------- gcc/ada/sem_res.adb | 20 +++++----- gcc/ada/sem_type.adb | 6 +-- gcc/ada/sem_util.adb | 32 ++++++++-------- gcc/ada/sem_util.ads | 6 +-- gcc/ada/sinfo.ads | 10 ++--- gcc/ada/snames.ads-tmpl | 6 +-- gcc/ada/sprint.adb | 2 +- gcc/ada/switch-c.adb | 6 ++- gcc/ada/usage.adb | 24 ++++++------ 51 files changed, 290 insertions(+), 251 deletions(-) diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_aspects.rst b/gcc/ada/doc/gnat_rm/implementation_defined_aspects.rst index 6f39de69df0..313e8c49d2f 100644 --- a/gcc/ada/doc/gnat_rm/implementation_defined_aspects.rst +++ b/gcc/ada/doc/gnat_rm/implementation_defined_aspects.rst @@ -566,7 +566,7 @@ Aspect Unreferenced This boolean aspect is equivalent to :ref:`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. 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 0906a6819d6..3da03dfd307 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 @@ -1380,6 +1380,12 @@ Alphabetical List of All Switches 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. @@ -5502,15 +5508,23 @@ indicate Ada 83 compatibility mode. 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: diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index bd4998f95a3..362e665b372 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -88,10 +88,10 @@ package Einfo is -- 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: @@ -118,7 +118,7 @@ package Einfo is -- 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 @@ -157,7 +157,7 @@ package Einfo is -- 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, @@ -2335,7 +2335,7 @@ package Einfo is -- 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. @@ -3377,7 +3377,7 @@ package Einfo is -- 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. diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb index bacfa1fd054..09092f93d30 100644 --- a/gcc/ada/errout.adb +++ b/gcc/ada/errout.adb @@ -670,22 +670,22 @@ package body Errout is 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 -- diff --git a/gcc/ada/errout.ads b/gcc/ada/errout.ads index e91c0c5f603..0a4ad621f5f 100644 --- a/gcc/ada/errout.ads +++ b/gcc/ada/errout.ads @@ -939,8 +939,8 @@ package Errout is -- 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 diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 8331b00101f..345baaf5b69 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -2466,7 +2466,7 @@ package body Exp_Aggr is 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. diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb index d7a4a28f531..c8866071ab8 100644 --- a/gcc/ada/exp_ch5.adb +++ b/gcc/ada/exp_ch5.adb @@ -3900,7 +3900,7 @@ package body Exp_Ch5 is 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)); @@ -4201,7 +4201,7 @@ package body Exp_Ch5 is 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)); @@ -4701,7 +4701,7 @@ package body Exp_Ch5 is 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), diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 9cab86a83b8..f03eb486a40 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -2665,7 +2665,7 @@ package body Exp_Ch6 is -- 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 @@ -6244,7 +6244,7 @@ package body Exp_Ch6 is (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). @@ -6700,7 +6700,7 @@ package body Exp_Ch6 is (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) @@ -7650,7 +7650,7 @@ package body Exp_Ch6 is 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) diff --git a/gcc/ada/exp_ch8.adb b/gcc/ada/exp_ch8.adb index a50c8ed9a85..dba21edc089 100644 --- a/gcc/ada/exp_ch8.adb +++ b/gcc/ada/exp_ch8.adb @@ -76,7 +76,7 @@ package body Exp_Ch8 is -- 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 diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb index 5f2d1df24a6..fa2d84d089c 100644 --- a/gcc/ada/exp_ch9.adb +++ b/gcc/ada/exp_ch9.adb @@ -841,7 +841,7 @@ package body Exp_Ch9 is 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) @@ -864,7 +864,7 @@ package body Exp_Ch9 is 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) @@ -917,7 +917,7 @@ package body Exp_Ch9 is 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) @@ -6209,11 +6209,11 @@ package body Exp_Ch9 is 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; @@ -6668,7 +6668,7 @@ package body Exp_Ch9 is Analyze (N); - -- Ada 2020 (AI12-0279) + -- Ada 2022 (AI12-0279) if Has_Yield_Aspect (Eent) and then RTE_Available (RE_Yield) @@ -11005,7 +11005,7 @@ package body Exp_Ch9 is 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) diff --git a/gcc/ada/exp_imgv.adb b/gcc/ada/exp_imgv.adb index b03dca7059d..3e7336aaf8c 100644 --- a/gcc/ada/exp_imgv.adb +++ b/gcc/ada/exp_imgv.adb @@ -1041,7 +1041,7 @@ package body Exp_Imgv is 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 @@ -1259,7 +1259,7 @@ package body Exp_Imgv is 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 diff --git a/gcc/ada/exp_put_image.adb b/gcc/ada/exp_put_image.adb index 07124ff1956..a41b71f1795 100644 --- a/gcc/ada/exp_put_image.adb +++ b/gcc/ada/exp_put_image.adb @@ -925,13 +925,13 @@ package body Exp_Put_Image is 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))); diff --git a/gcc/ada/fe.h b/gcc/ada/fe.h index ec2956b3ac5..46531bf7f8e 100644 --- a/gcc/ada/fe.h +++ b/gcc/ada/fe.h @@ -203,7 +203,7 @@ extern Boolean In_Extended_Main_Code_Unit (Entity_Id); #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 { diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index ee014a35cc2..feb3a7e15c4 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -4237,7 +4237,7 @@ node_is_component (Node_Id gnat_node) 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. */ @@ -4284,7 +4284,7 @@ get_atomic_access (Node_Id gnat_node, atomic_acces_t *type, bool *sync) 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)) @@ -4295,7 +4295,7 @@ get_atomic_access (Node_Id gnat_node, atomic_acces_t *type, bool *sync) 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; @@ -4314,7 +4314,7 @@ get_atomic_access (Node_Id gnat_node, atomic_acces_t *type, bool *sync) 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; diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 569b9812eff..68729da05df 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -9944,7 +9944,7 @@ This boolean aspect is equivalent to @ref{10b,,pragma Unmodified}. 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. diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index fefba9c57cb..e6078e67e9b 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -8794,6 +8794,16 @@ Allow full Ada 2005 features (same as @code{-gnat05}) @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} @@ -14340,6 +14350,19 @@ may generally be compiled using this switch (see the description of the 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 @@ -14352,9 +14375,9 @@ for further information). @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 diff --git a/gcc/ada/impunit.adb b/gcc/ada/impunit.adb index 04d94baf0d3..75b50467a0a 100644 --- a/gcc/ada/impunit.adb +++ b/gcc/ada/impunit.adb @@ -618,12 +618,12 @@ package body Impunit is ); -- 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 @@ -767,11 +767,11 @@ package body Impunit is 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; diff --git a/gcc/ada/impunit.ads b/gcc/ada/impunit.ads index 2a7da047cab..7caa1ba27a0 100644 --- a/gcc/ada/impunit.ads +++ b/gcc/ada/impunit.ads @@ -47,7 +47,7 @@ package Impunit is 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, diff --git a/gcc/ada/libgnat/a-cobove.ads b/gcc/ada/libgnat/a-cobove.ads index a151e374b57..e808d85cd0f 100644 --- a/gcc/ada/libgnat/a-cobove.ads +++ b/gcc/ada/libgnat/a-cobove.ads @@ -85,7 +85,7 @@ package Ada.Containers.Bounded_Vectors is 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; diff --git a/gcc/ada/libgnat/a-convec.ads b/gcc/ada/libgnat/a-convec.ads index f40d058eb77..53dc6716c57 100644 --- a/gcc/ada/libgnat/a-convec.ads +++ b/gcc/ada/libgnat/a-convec.ads @@ -332,7 +332,7 @@ is 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; diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads index e4be0961d2e..429bd423474 100644 --- a/gcc/ada/opt.ads +++ b/gcc/ada/opt.ads @@ -72,7 +72,7 @@ package Opt is -- 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, @@ -108,7 +108,7 @@ package Opt is -- 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. @@ -1726,11 +1726,11 @@ package Opt is -- 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 diff --git a/gcc/ada/par-ch12.adb b/gcc/ada/par-ch12.adb index 8ccefe40a10..ba11a990ba9 100644 --- a/gcc/ada/par-ch12.adb +++ b/gcc/ada/par-ch12.adb @@ -960,7 +960,7 @@ package body Ch12 is -- 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; diff --git a/gcc/ada/par-ch3.adb b/gcc/ada/par-ch3.adb index 9b12ccbda08..2a7959939d0 100644 --- a/gcc/ada/par-ch3.adb +++ b/gcc/ada/par-ch3.adb @@ -1486,7 +1486,7 @@ package body Ch3 is -- 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 diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb index 2867bc90e1a..ba128ec687b 100644 --- a/gcc/ada/par-ch4.adb +++ b/gcc/ada/par-ch4.adb @@ -1280,7 +1280,7 @@ package body Ch4 is 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); @@ -1399,7 +1399,7 @@ package body Ch4 is 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 ] @@ -1601,7 +1601,7 @@ package body Ch4 is -- 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 @@ -2928,7 +2928,7 @@ package body Ch4 is 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; @@ -3396,7 +3396,7 @@ package body Ch4 is 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. ---------------------------------------- @@ -3432,7 +3432,7 @@ package body Ch4 is 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: @@ -3463,7 +3463,7 @@ package body Ch4 is 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 @@ -3471,7 +3471,7 @@ package body Ch4 is 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. @@ -3481,7 +3481,7 @@ package body Ch4 is 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); @@ -3504,7 +3504,7 @@ package body Ch4 is 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; @@ -3689,7 +3689,7 @@ package body Ch4 is 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; diff --git a/gcc/ada/par-ch5.adb b/gcc/ada/par-ch5.adb index 7a2c29be12a..a7024317b55 100644 --- a/gcc/ada/par-ch5.adb +++ b/gcc/ada/par-ch5.adb @@ -1714,7 +1714,7 @@ package body Ch5 is (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 @@ -1775,7 +1775,7 @@ package body Ch5 is 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 diff --git a/gcc/ada/par-ch6.adb b/gcc/ada/par-ch6.adb index 98d6a8d1e84..9d4f736a61f 100644 --- a/gcc/ada/par-ch6.adb +++ b/gcc/ada/par-ch6.adb @@ -1620,7 +1620,7 @@ package body Ch6 is -- 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); diff --git a/gcc/ada/par-prag.adb b/gcc/ada/par-prag.adb index 011ca427bf3..33182ccd6ce 100644 --- a/gcc/ada/par-prag.adb +++ b/gcc/ada/par-prag.adb @@ -385,13 +385,13 @@ begin 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; diff --git a/gcc/ada/par-util.adb b/gcc/ada/par-util.adb index 14045123e92..149b1a1f223 100644 --- a/gcc/ada/par-util.adb +++ b/gcc/ada/par-util.adb @@ -276,10 +276,10 @@ package body Util is -- 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; diff --git a/gcc/ada/scans.ads b/gcc/ada/scans.ads index 169bbdaffcb..0e9ccd2f905 100644 --- a/gcc/ada/scans.ads +++ b/gcc/ada/scans.ads @@ -81,7 +81,7 @@ package Scans is -- 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 diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb index 5a698e6e773..66b11055dd1 100644 --- a/gcc/ada/scng.adb +++ b/gcc/ada/scng.adb @@ -1303,7 +1303,7 @@ package body Scng is -- 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; @@ -1707,7 +1707,7 @@ package body Scng is -- "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 @@ -1827,10 +1827,10 @@ package body Scng is 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 diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index dd29e80b8cf..ae0c2be6e6a 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -907,7 +907,7 @@ package body Sem_Aggr is 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); @@ -3140,7 +3140,7 @@ package body Sem_Aggr is 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); diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 080cabd8cba..17aa577addc 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -168,11 +168,11 @@ package body Sem_Attr is 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); @@ -1486,11 +1486,11 @@ package body Sem_Attr is -- 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; @@ -2870,17 +2870,17 @@ package body Sem_Attr is 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))" @@ -2957,13 +2957,13 @@ package body Sem_Attr is -- 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; @@ -5202,7 +5202,7 @@ package body Sem_Attr is 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) @@ -11497,9 +11497,9 @@ package body Sem_Attr is 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 diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb index 68b030a0160..9ec584439b9 100644 --- a/gcc/ada/sem_ch10.adb +++ b/gcc/ada/sem_ch10.adb @@ -2708,11 +2708,11 @@ package body Sem_Ch10 is 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; diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 3bd30a0e627..b835befc646 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -502,7 +502,7 @@ package body Sem_Ch12 is 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 @@ -1104,7 +1104,7 @@ package body Sem_Ch12 is -- 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 @@ -3589,7 +3589,7 @@ package body Sem_Ch12 is 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). @@ -11011,7 +11011,7 @@ package body Sem_Ch12 is -- 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 @@ -11435,9 +11435,9 @@ package body Sem_Ch12 is 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 @@ -12681,7 +12681,7 @@ package body Sem_Ch12 is 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; @@ -12712,7 +12712,7 @@ package body Sem_Ch12 is -- 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 @@ -12723,7 +12723,7 @@ package body Sem_Ch12 is 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); @@ -13413,7 +13413,7 @@ package body Sem_Ch12 is -- 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) diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 1a414fdc43d..5e2611fb096 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -247,7 +247,7 @@ package body Sem_Ch13 is -- 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 @@ -258,7 +258,7 @@ package body Sem_Ch13 is 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 @@ -1033,7 +1033,7 @@ package body Sem_Ch13 is 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. @@ -1049,8 +1049,8 @@ package body Sem_Ch13 is 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); @@ -1863,7 +1863,7 @@ package body Sem_Ch13 is -- 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; @@ -2521,8 +2521,8 @@ package body Sem_Ch13 is 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; @@ -2558,14 +2558,14 @@ package body Sem_Ch13 is 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 @@ -2936,7 +2936,7 @@ package body Sem_Ch13 is -- 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); @@ -4326,7 +4326,7 @@ package body Sem_Ch13 is 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; @@ -4643,7 +4643,7 @@ package body Sem_Ch13 is 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 @@ -4656,18 +4656,18 @@ package body Sem_Ch13 is 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; @@ -14497,7 +14497,7 @@ package body Sem_Ch13 is 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; @@ -14619,7 +14619,7 @@ package body Sem_Ch13 is 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. @@ -14639,7 +14639,7 @@ package body Sem_Ch13 is 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; @@ -15252,7 +15252,7 @@ package body Sem_Ch13 is 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)) @@ -15371,7 +15371,7 @@ package body Sem_Ch13 is -- 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 " diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 1eac9057c41..8bcfe40b628 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -3195,7 +3195,7 @@ package body Sem_Ch3 is -- 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); @@ -11100,7 +11100,7 @@ package body Sem_Ch3 is 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. @@ -15816,7 +15816,7 @@ package body Sem_Ch3 is -- 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 @@ -15973,7 +15973,7 @@ package body Sem_Ch3 is 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. diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index b6ec88b5492..453b50e6463 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -1113,7 +1113,7 @@ package body Sem_Ch5 is -- 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. diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 7341cebc64e..ed6b09aac2d 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -579,7 +579,7 @@ package body Sem_Ch6 is -- 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 @@ -744,7 +744,7 @@ package body Sem_Ch6 is -- 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); @@ -1450,13 +1450,13 @@ package body Sem_Ch6 is 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 @@ -1550,10 +1550,10 @@ package body Sem_Ch6 is 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 diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 8d77ada9da4..8a1a13cada1 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -1530,7 +1530,7 @@ package body Sem_Ch8 is -- 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); diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb index 518b15e1959..f6edcac2c02 100644 --- a/gcc/ada/sem_elab.adb +++ b/gcc/ada/sem_elab.adb @@ -3762,10 +3762,10 @@ package body Sem_Elab is 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); @@ -8877,10 +8877,10 @@ package body Sem_Elab is 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 ("<= Ada_2020 + and then not (Ada_Version >= Ada_2022 and then Is_Preelaborable_Construct (N)) then Error_Preelaborated_Call (N); diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index c3790a30586..a67688d20df 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -140,7 +140,7 @@ package body Sem_Eval is 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 -- @@ -2303,7 +2303,7 @@ package body Sem_Eval is 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 @@ -2594,7 +2594,7 @@ package body Sem_Eval is 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) @@ -3436,7 +3436,7 @@ package body Sem_Eval is -- 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 @@ -3777,12 +3777,12 @@ package body Sem_Eval is 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; @@ -3802,16 +3802,16 @@ package body Sem_Eval is (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 @@ -4107,7 +4107,7 @@ package body Sem_Eval is 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 @@ -4269,13 +4269,13 @@ package body Sem_Eval is -- 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 @@ -6597,7 +6597,7 @@ package body Sem_Eval is -- 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; diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 7d9b2b272ec..67b2f25edf5 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -4818,10 +4818,10 @@ package body Sem_Prag is 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; @@ -7258,7 +7258,7 @@ package body Sem_Prag is 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 @@ -7430,7 +7430,7 @@ package body Sem_Prag is -- 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 @@ -7541,14 +7541,14 @@ package body Sem_Prag is 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) @@ -11334,7 +11334,7 @@ package body Sem_Prag is 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 @@ -12529,15 +12529,15 @@ package body Sem_Prag is 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); @@ -12546,8 +12546,8 @@ package body Sem_Prag is -- 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; ------------------------------------- @@ -13507,7 +13507,7 @@ package body Sem_Prag is 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 @@ -19793,7 +19793,7 @@ package body Sem_Prag is 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); @@ -19801,10 +19801,10 @@ package body Sem_Prag is 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 @@ -19896,7 +19896,7 @@ package body Sem_Prag is 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); @@ -30656,17 +30656,17 @@ package body Sem_Prag is 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; @@ -31140,7 +31140,7 @@ package body Sem_Prag is 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, diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 554551cc32e..25badeead45 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -2120,7 +2120,7 @@ package body Sem_Res is 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); @@ -2786,7 +2786,7 @@ package body Sem_Res is 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); @@ -4830,9 +4830,9 @@ package body Sem_Res is 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 @@ -6699,7 +6699,7 @@ package body Sem_Res is 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 @@ -7130,7 +7130,7 @@ package body Sem_Res is 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 @@ -9401,7 +9401,7 @@ package body Sem_Res is 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. @@ -9412,7 +9412,7 @@ package body Sem_Res is 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)); @@ -10982,7 +10982,7 @@ package body Sem_Res is 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. @@ -10990,7 +10990,7 @@ package body Sem_Res is 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", diff --git a/gcc/ada/sem_type.adb b/gcc/ada/sem_type.adb index 52f33f82f05..2998d2f8eb1 100644 --- a/gcc/ada/sem_type.adb +++ b/gcc/ada/sem_type.adb @@ -1020,10 +1020,10 @@ package body Sem_Type is 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 diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 73a6f79f36f..8448efeec34 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -149,7 +149,7 @@ package body Sem_Util is -- 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 @@ -10146,7 +10146,7 @@ package body Sem_Util 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)) @@ -10185,13 +10185,13 @@ package body Sem_Util is -- 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 " & @@ -15517,7 +15517,7 @@ package body Sem_Util is 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 @@ -18362,10 +18362,10 @@ package body Sem_Util is 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))) @@ -18597,7 +18597,7 @@ package body Sem_Util is 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)); @@ -19291,8 +19291,8 @@ package body Sem_Util is 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; @@ -19705,10 +19705,10 @@ package body Sem_Util is 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))) @@ -20210,11 +20210,11 @@ package body Sem_Util is 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)) @@ -30845,7 +30845,7 @@ package body Sem_Util is -- 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; diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index 2e26c283d71..a8f8e0bd9c1 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -380,7 +380,7 @@ package Sem_Util is -- 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 @@ -2002,7 +2002,7 @@ package Sem_Util is 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 @@ -3374,7 +3374,7 @@ package Sem_Util is -- (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; diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index 9101abbb71d..880c8f596e9 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -1756,7 +1756,7 @@ package Sinfo is -- 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. @@ -4252,7 +4252,7 @@ package Sinfo is -- 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. @@ -4938,7 +4938,7 @@ package Sinfo is -- 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. @@ -5101,7 +5101,7 @@ package Sinfo is -- 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 @@ -8020,7 +8020,7 @@ package Sinfo is -- 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 diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl index 706a56216c0..c0182a9a9c2 100644 --- a/gcc/ada/snames.ads-tmpl +++ b/gcc/ada/snames.ads-tmpl @@ -402,7 +402,7 @@ package Snames is 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 @@ -1741,8 +1741,8 @@ package Snames is 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, diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb index d8c04038f7d..2eeea52d8bd 100644 --- a/gcc/ada/sprint.adb +++ b/gcc/ada/sprint.adb @@ -2493,7 +2493,7 @@ package body Sprint is -- AI12-0275: Object_Renaming_Declaration without explicit subtype - elsif Ada_Version >= Ada_2020 then + elsif Ada_Version >= Ada_2022 then null; else diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb index 1e94aded085..10f5f771764 100644 --- a/gcc/ada/switch-c.adb +++ b/gcc/ada/switch-c.adb @@ -1581,8 +1581,10 @@ package body Switch.C is 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)); diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb index c85d6107914..c88ccece83a 100644 --- a/gcc/ada/usage.adb +++ b/gcc/ada/usage.adb @@ -698,22 +698,12 @@ begin -- 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 @@ -726,6 +716,16 @@ begin 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");