Commit 2f31b362 by Eric Botcazou Committed by Pierre-Marie de Rodat

[Ada] Export the Ada version through the C interface

2019-12-16  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* fe.h (Ada_Version_Type): New typedef.
	(Ada_Version): Declare.
	* opt.ads (Ada_Version_Type): Add Convention C and WARNING line.
	(Ada_Version): Add WARNING line.
	(Exception_Mechanism_Type): Likewise.

From-SVN: r279426
parent ba58b776
2019-12-16 Eric Botcazou <ebotcazou@adacore.com>
* fe.h (Ada_Version_Type): New typedef.
(Ada_Version): Declare.
* opt.ads (Ada_Version_Type): Add Convention C and WARNING line.
(Ada_Version): Add WARNING line.
(Exception_Mechanism_Type): Likewise.
2019-12-16 Gary Dismukes <dismukes@adacore.com> 2019-12-16 Gary Dismukes <dismukes@adacore.com>
* checks.adb, sem_util.adb: Minor reformatting and U.S. spelling * checks.adb, sem_util.adb: Minor reformatting and U.S. spelling
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
"WARNING: There is a matching C declaration of this <entity_kind> in fe.h" "WARNING: There is a matching C declaration of this <entity_kind> in fe.h"
where <entity_kind> is either "subprogram" or "variable". where <entity_kind> is either "subprogram" or "variable" or "type".
WARNING: functions taking String_Pointer parameters must abide by the rule WARNING: functions taking String_Pointer parameters must abide by the rule
documented alongside the definition of String_Pointer in types.h. */ documented alongside the definition of String_Pointer in types.h. */
...@@ -187,6 +187,7 @@ extern Boolean In_Extended_Main_Code_Unit (Entity_Id); ...@@ -187,6 +187,7 @@ extern Boolean In_Extended_Main_Code_Unit (Entity_Id);
/* opt: */ /* opt: */
#define Ada_Version opt__ada_version
#define Back_End_Inlining opt__back_end_inlining #define Back_End_Inlining opt__back_end_inlining
#define Debug_Generated_Code opt__debug_generated_code #define Debug_Generated_Code opt__debug_generated_code
#define Exception_Extra_Info opt__exception_extra_info #define Exception_Extra_Info opt__exception_extra_info
...@@ -199,9 +200,14 @@ extern Boolean In_Extended_Main_Code_Unit (Entity_Id); ...@@ -199,9 +200,14 @@ extern Boolean In_Extended_Main_Code_Unit (Entity_Id);
#define Suppress_Checks opt__suppress_checks #define Suppress_Checks opt__suppress_checks
typedef enum { typedef enum {
Ada_83, Ada_95, Ada_2005, Ada_2012, Ada_2020
} Ada_Version_Type;
typedef enum {
Front_End_SJLJ, Back_End_ZCX, Back_End_SJLJ Front_End_SJLJ, Back_End_ZCX, Back_End_SJLJ
} Exception_Mechanism_Type; } Exception_Mechanism_Type;
extern Ada_Version_Type Ada_Version;
extern Boolean Back_End_Inlining; extern Boolean Back_End_Inlining;
extern Boolean Debug_Generated_Code; extern Boolean Debug_Generated_Code;
extern Boolean Exception_Extra_Info; extern Boolean Exception_Extra_Info;
......
...@@ -124,11 +124,14 @@ package Opt is ...@@ -124,11 +124,14 @@ package Opt is
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_2020);
pragma Ordered (Ada_Version_Type); pragma Ordered (Ada_Version_Type);
pragma Convention (C, Ada_Version_Type);
-- Versions of Ada for Ada_Version below. Note that these are ordered, -- Versions of Ada for Ada_Version below. Note that these are ordered,
-- so that tests like Ada_Version >= Ada_95 are legitimate and useful. -- so that tests like Ada_Version >= Ada_95 are legitimate and useful.
-- Think twice before using "="; Ada_Version >= Ada_2012 is more likely -- Think twice before using "="; Ada_Version >= Ada_2012 is more likely
-- what you want, because it will apply to future versions of the language. -- what you want, because it will apply to future versions of the language.
-- WARNING: There is a matching C declaration of this type in fe.h
Ada_Version_Default : constant Ada_Version_Type := Ada_2012; Ada_Version_Default : constant Ada_Version_Type := Ada_2012;
pragma Warnings (Off, Ada_Version_Default); pragma Warnings (Off, Ada_Version_Default);
-- GNAT -- GNAT
...@@ -141,6 +144,8 @@ package Opt is ...@@ -141,6 +144,8 @@ package Opt is
-- compiler switches, or implicitly (to Ada_Version_Runtime) when a -- compiler switches, or implicitly (to Ada_Version_Runtime) when a
-- predefined or internal file is compiled. -- predefined or internal file is compiled.
-- WARNING: There is a matching C declaration of this variable in fe.h
Ada_Version_Pragma : Node_Id := Empty; Ada_Version_Pragma : Node_Id := Empty;
-- Reflects the Ada_xxx pragma that resulted in setting Ada_Version. Used -- Reflects the Ada_xxx pragma that resulted in setting Ada_Version. Used
-- to specialize error messages complaining about the Ada version in use. -- to specialize error messages complaining about the Ada version in use.
...@@ -629,9 +634,10 @@ package Opt is ...@@ -629,9 +634,10 @@ package Opt is
-- Similar to Back_End_ZCX with respect to the front-end processing -- Similar to Back_End_ZCX with respect to the front-end processing
-- of regular and AT-END handlers. A setjmp/longjmp scheme is used to -- of regular and AT-END handlers. A setjmp/longjmp scheme is used to
-- propagate and setup handler contexts on regular execution paths. -- propagate and setup handler contexts on regular execution paths.
pragma Convention (C, Exception_Mechanism_Type); pragma Convention (C, Exception_Mechanism_Type);
-- WARNING: There is a matching C declaration of this type in fe.h
Exception_Mechanism : Exception_Mechanism_Type := Front_End_SJLJ; Exception_Mechanism : Exception_Mechanism_Type := Front_End_SJLJ;
-- GNAT -- GNAT
-- Set to the appropriate value depending on the flags in system.ads -- Set to the appropriate value depending on the flags in system.ads
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment