[Ada] Replace Opt.Extensions_Allowed by Ada_Version
gcc/ada/ * fe.h, opt.adb, opt.ads, par-prag.adb, sem_prag.adb, switch-c.adb (Extensions_Allowed): Replace by a function. (Ada_Version_Type): Add new value Ada_With_Extensions, to replace setting of Extensions_Allowed. Update setting of Extensions_Allowed.
This commit is contained in:
parent
4153c75471
commit
5ddd01d6d4
|
@ -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_2022
|
||||
Ada_83, Ada_95, Ada_2005, Ada_2012, Ada_2022, Ada_With_Extensions
|
||||
} Ada_Version_Type;
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -84,7 +84,6 @@ package body Opt is
|
|||
Default_SSO_Config := Default_SSO;
|
||||
Dynamic_Elaboration_Checks_Config := Dynamic_Elaboration_Checks;
|
||||
Exception_Locations_Suppressed_Config := Exception_Locations_Suppressed;
|
||||
Extensions_Allowed_Config := Extensions_Allowed;
|
||||
External_Name_Exp_Casing_Config := External_Name_Exp_Casing;
|
||||
External_Name_Imp_Casing_Config := External_Name_Imp_Casing;
|
||||
Fast_Math_Config := Fast_Math;
|
||||
|
@ -123,7 +122,6 @@ package body Opt is
|
|||
Default_SSO := Save.Default_SSO;
|
||||
Dynamic_Elaboration_Checks := Save.Dynamic_Elaboration_Checks;
|
||||
Exception_Locations_Suppressed := Save.Exception_Locations_Suppressed;
|
||||
Extensions_Allowed := Save.Extensions_Allowed;
|
||||
External_Name_Exp_Casing := Save.External_Name_Exp_Casing;
|
||||
External_Name_Imp_Casing := Save.External_Name_Imp_Casing;
|
||||
Fast_Math := Save.Fast_Math;
|
||||
|
@ -165,7 +163,6 @@ package body Opt is
|
|||
Default_SSO => Default_SSO,
|
||||
Dynamic_Elaboration_Checks => Dynamic_Elaboration_Checks,
|
||||
Exception_Locations_Suppressed => Exception_Locations_Suppressed,
|
||||
Extensions_Allowed => Extensions_Allowed,
|
||||
External_Name_Exp_Casing => External_Name_Exp_Casing,
|
||||
External_Name_Imp_Casing => External_Name_Imp_Casing,
|
||||
Fast_Math => Fast_Math,
|
||||
|
@ -204,7 +201,6 @@ package body Opt is
|
|||
Ada_Version_Pragma := Empty;
|
||||
Default_SSO := ' ';
|
||||
Dynamic_Elaboration_Checks := False;
|
||||
Extensions_Allowed := True;
|
||||
External_Name_Exp_Casing := As_Is;
|
||||
External_Name_Imp_Casing := Lowercase;
|
||||
No_Component_Reordering := False;
|
||||
|
@ -263,7 +259,6 @@ package body Opt is
|
|||
Check_Policy_List := Check_Policy_List_Config;
|
||||
Default_SSO := Default_SSO_Config;
|
||||
Dynamic_Elaboration_Checks := Dynamic_Elaboration_Checks_Config;
|
||||
Extensions_Allowed := Extensions_Allowed_Config;
|
||||
External_Name_Exp_Casing := External_Name_Exp_Casing_Config;
|
||||
External_Name_Imp_Casing := External_Name_Imp_Casing_Config;
|
||||
Fast_Math := Fast_Math_Config;
|
||||
|
|
|
@ -68,17 +68,20 @@ package Opt is
|
|||
-- the default values.
|
||||
|
||||
Latest_Ada_Only : Boolean := False;
|
||||
-- If True, the only value valid for Ada_Version is Ada_Version_Type'Last,
|
||||
-- trying to specify other values will be ignored (in case of pragma
|
||||
-- If True, the only value valid for Ada_Version is Ada_2012 or later.
|
||||
-- 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_2022);
|
||||
type Ada_Version_Type is
|
||||
(Ada_83, Ada_95, Ada_2005, Ada_2012, Ada_2022, Ada_With_Extensions);
|
||||
pragma Ordered (Ada_Version_Type);
|
||||
pragma Convention (C, Ada_Version_Type);
|
||||
-- Versions of Ada for Ada_Version below. Note that these are ordered,
|
||||
-- so that tests like Ada_Version >= Ada_95 are legitimate and useful.
|
||||
-- Think twice before using "="; Ada_Version >= Ada_2012 is more likely
|
||||
-- what you want, because it will apply to future versions of the language.
|
||||
-- Note that Ada_With_Extensions should always be last since it should
|
||||
-- always be a superset of the latest Ada version.
|
||||
|
||||
-- WARNING: There is a matching C declaration of this type in fe.h
|
||||
|
||||
|
@ -108,7 +111,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_2022;
|
||||
Ada_Version_Runtime : Ada_Version_Type := Ada_With_Extensions;
|
||||
-- GNAT
|
||||
-- Ada version used to compile the runtime. Used to set Ada_Version (but
|
||||
-- not Ada_Version_Explicit) when compiling predefined or internal units.
|
||||
|
@ -623,10 +626,10 @@ package Opt is
|
|||
-- Set to True to convert nonbinary modular additions into code
|
||||
-- that relies on the front-end expansion of operator Mod.
|
||||
|
||||
Extensions_Allowed : Boolean := False;
|
||||
-- GNAT
|
||||
-- Set to True by switch -gnatX if GNAT specific language extensions
|
||||
-- are allowed. See GNAT RM for details.
|
||||
function Extensions_Allowed return Boolean is
|
||||
(Ada_Version = Ada_With_Extensions);
|
||||
-- True if GNAT specific language extensions are allowed. See GNAT RM for
|
||||
-- details.
|
||||
|
||||
type External_Casing_Type is (
|
||||
As_Is, -- External names cased as they appear in the Ada source
|
||||
|
@ -2040,14 +2043,6 @@ package Opt is
|
|||
-- GNAT
|
||||
-- Set True by use of the configuration pragma Suppress_Exception_Messages
|
||||
|
||||
Extensions_Allowed_Config : Boolean;
|
||||
-- GNAT
|
||||
-- This is the flag that indicates whether extensions are allowed. It can
|
||||
-- be set True either by use of the -gnatX switch, or by use of the
|
||||
-- configuration pragma Extensions_Allowed (On). It is always set to True
|
||||
-- for internal GNAT units, since extensions are always permitted in such
|
||||
-- units.
|
||||
|
||||
External_Name_Exp_Casing_Config : External_Casing_Type;
|
||||
-- GNAT
|
||||
-- This is the value of the configuration switch that controls casing of
|
||||
|
@ -2331,7 +2326,6 @@ private
|
|||
Default_SSO : Character;
|
||||
Dynamic_Elaboration_Checks : Boolean;
|
||||
Exception_Locations_Suppressed : Boolean;
|
||||
Extensions_Allowed : Boolean;
|
||||
External_Name_Exp_Casing : External_Casing_Type;
|
||||
External_Name_Imp_Casing : External_Casing_Type;
|
||||
Fast_Math : Boolean;
|
||||
|
|
|
@ -443,10 +443,8 @@ begin
|
|||
Check_Arg_Is_On_Or_Off (Arg1);
|
||||
|
||||
if Chars (Expression (Arg1)) = Name_On then
|
||||
Extensions_Allowed := True;
|
||||
Ada_Version := Ada_Version_Type'Last;
|
||||
Ada_Version := Ada_With_Extensions;
|
||||
else
|
||||
Extensions_Allowed := False;
|
||||
Ada_Version := Ada_Version_Explicit;
|
||||
end if;
|
||||
|
||||
|
|
|
@ -16456,11 +16456,8 @@ package body Sem_Prag is
|
|||
Check_Arg_Is_One_Of (Arg1, Name_On, Name_Off);
|
||||
|
||||
if Chars (Get_Pragma_Arg (Arg1)) = Name_On then
|
||||
Extensions_Allowed := True;
|
||||
Ada_Version := Ada_Version_Type'Last;
|
||||
|
||||
Ada_Version := Ada_With_Extensions;
|
||||
else
|
||||
Extensions_Allowed := False;
|
||||
Ada_Version := Ada_Version_Explicit;
|
||||
Ada_Version_Pragma := Empty;
|
||||
end if;
|
||||
|
|
|
@ -1392,9 +1392,8 @@ package body Switch.C is
|
|||
|
||||
when 'X' =>
|
||||
Ptr := Ptr + 1;
|
||||
Extensions_Allowed := True;
|
||||
Ada_Version := Ada_Version_Type'Last;
|
||||
Ada_Version_Explicit := Ada_Version_Type'Last;
|
||||
Ada_Version := Ada_With_Extensions;
|
||||
Ada_Version_Explicit := Ada_With_Extensions;
|
||||
Ada_Version_Pragma := Empty;
|
||||
|
||||
-- -gnaty (style checks)
|
||||
|
|
Loading…
Reference in New Issue