aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2023-01-30 16:56:08 -0500
committerMarc Poulhiès <poulhies@adacore.com>2023-05-22 10:44:07 +0200
commite7f7018c2a5f07e6e8a045b6ba18c023daed7010 (patch)
tree79dac7fea3ae46595901287f9d423bc8fa9de58f
parentdf0ac6e158727064dd089be9051a82c26bd66880 (diff)
downloadgcc-e7f7018c2a5f07e6e8a045b6ba18c023daed7010.zip
gcc-e7f7018c2a5f07e6e8a045b6ba18c023daed7010.tar.gz
gcc-e7f7018c2a5f07e6e8a045b6ba18c023daed7010.tar.bz2
ada: update Ada_Version_Type in fe.h to match opt.ads
Remove Ada_With_Extensions, which is not used on the C side. Do not add Ada_With_Core_Extensions and Ada_With_All_Extensions, which are also not used on the C side, and on the Ada side are always used via functions All_Extensions_Allowed and Core_Extensions_Allowed. Explain this in comments. Move the functions closer to the type declaration, so the usage style is clearer. Cleanup only -- no change in compiler behavior. gcc/ada/ * fe.h: Remove Ada_With_Extensions and add commentary. * opt.ads: Rearrange code and add commentary.
-rw-r--r--gcc/ada/fe.h5
-rw-r--r--gcc/ada/opt.ads27
2 files changed, 20 insertions, 12 deletions
diff --git a/gcc/ada/fe.h b/gcc/ada/fe.h
index dd1ee51..2d8f299 100644
--- a/gcc/ada/fe.h
+++ b/gcc/ada/fe.h
@@ -220,8 +220,11 @@ extern Boolean In_Extended_Main_Code_Unit (Entity_Id);
#define Unnest_Subprogram_Mode opt__unnest_subprogram_mode
typedef enum {
- Ada_83, Ada_95, Ada_2005, Ada_2012, Ada_2022, Ada_With_Extensions
+ Ada_83, Ada_95, Ada_2005, Ada_2012, Ada_2022
} Ada_Version_Type;
+// Ada_With_Core_Extensions and Ada_With_All_Extensions (see opt.ads) are not
+// used on the C side for now. If we decide to use them, we should import
+// All_Extensions_Allowed and Core_Extensions_Allowed functions.
extern Ada_Version_Type Ada_Version;
extern Boolean Back_End_Inlining;
diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads
index 7e5919d..bcafba9 100644
--- a/gcc/ada/opt.ads
+++ b/gcc/ada/opt.ads
@@ -81,8 +81,13 @@ package Opt is
-- 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_All_Extensions should always be last since it should
- -- always be a superset of the other Ada versions.
+ -- always be a superset of the other Ada versions. Likewise, the
+ -- penultimate one should be Ada_With_Core_Extensions.
+ --
+ -- Use the ..._Extensions_Allowed functions below instead of referring
+ -- directly to Ada_With_..._Extensions.
-- WARNING: There is a matching C declaration of this type in fe.h
@@ -100,6 +105,16 @@ package Opt is
-- WARNING: There is a matching C declaration of this variable in fe.h
+ function All_Extensions_Allowed return Boolean is
+ (Ada_Version = Ada_With_All_Extensions);
+ -- True if GNAT specific language extensions are allowed. See GNAT RM for
+ -- details.
+
+ function Core_Extensions_Allowed return Boolean is
+ (Ada_Version >= Ada_With_Core_Extensions);
+ -- True if some but not all GNAT specific language extensions are allowed.
+ -- See GNAT RM for details.
+
Ada_Version_Pragma : Node_Id := Empty;
-- Reflects the Ada_xxx pragma that resulted in setting Ada_Version. Used
-- to specialize error messages complaining about the Ada version in use.
@@ -594,16 +609,6 @@ package Opt is
-- Set to True to convert nonbinary modular additions into code
-- that relies on the front-end expansion of operator Mod.
- function All_Extensions_Allowed return Boolean is
- (Ada_Version = Ada_With_All_Extensions);
- -- True if GNAT specific language extensions are allowed. See GNAT RM for
- -- details.
-
- function Core_Extensions_Allowed return Boolean is
- (Ada_Version >= Ada_With_Core_Extensions);
- -- True if some but not all 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
Uppercase, -- External names forced to all uppercase letters