[gcc r14-1032] ada: update Ada_Version_Type in fe.h to match opt.ads

Marc Poulhi?s dkm@gcc.gnu.org
Mon May 22 08:48:22 GMT 2023


https://gcc.gnu.org/g:e7f7018c2a5f07e6e8a045b6ba18c023daed7010

commit r14-1032-ge7f7018c2a5f07e6e8a045b6ba18c023daed7010
Author: Bob Duff <duff@adacore.com>
Date:   Mon Jan 30 16:56:08 2023 -0500

    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.

Diff:
---
 gcc/ada/fe.h    |  5 ++++-
 gcc/ada/opt.ads | 27 ++++++++++++++++-----------
 2 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/gcc/ada/fe.h b/gcc/ada/fe.h
index dd1ee51aadc..2d8f299903d 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 7e5919d4635..bcafba9e57d 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


More information about the Gcc-cvs mailing list