[COMMITTED] ada: Add typedefs to snames.h-tmpl

Message ID 20230710124429.2263694-1-poulhies@adacore.com
State Accepted
Headers
Series [COMMITTED] ada: Add typedefs to snames.h-tmpl |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Marc Poulhiès July 10, 2023, 12:44 p.m. UTC
  From: Tom Tromey <tromey@adacore.com>

A future patch will change sname.h-tmpl to use enums rather than
preprocessor defines.  In order to do this, first introduce some
typedefs that can be used in gcc-interface.

gcc/ada/

	* snames.h-tmpl (Name_Id, Attribute_Id, Convention_Id)
	(Pragma_Id): New typedefs.
	(Get_Attribute_Id, Get_Pragma_Id): Use typedef.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/snames.h-tmpl | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
  

Patch

diff --git a/gcc/ada/snames.h-tmpl b/gcc/ada/snames.h-tmpl
index b15792a5724..95b3c776197 100644
--- a/gcc/ada/snames.h-tmpl
+++ b/gcc/ada/snames.h-tmpl
@@ -28,6 +28,7 @@ 
 
 /* Name_Id values */
 
+typedef Int Name_Id;
 #define  Name_ !! TEMPLATE INSERTION POINT
 
 /* Define the function to return one of the numeric values below. Note
@@ -35,8 +36,9 @@ 
    than 256 entries is represented that way in Ada.  The operand is a Chars
    field value.  */
 
+typedef Byte Attribute_Id;
 #define Get_Attribute_Id snames__get_attribute_id
-extern unsigned char Get_Attribute_Id (int);
+extern Attribute_Id Get_Attribute_Id (int);
 
 /* Define the numeric values for attributes.  */
 
@@ -44,6 +46,7 @@  extern unsigned char Get_Attribute_Id (int);
 
 /* Define the numeric values for the conventions.  */
 
+typedef Byte Convention_Id;
 #define  Convention_ !! TEMPLATE INSERTION POINT
 
 /* Define the function to check if a Name_Id value is a valid pragma */
@@ -56,8 +59,9 @@  extern Boolean Is_Pragma_Name (Name_Id);
    than 256 entries is represented that way in Ada.  The operand is a Chars
    field value.  */
 
+typedef Byte Pragma_Id;
 #define Get_Pragma_Id snames__get_pragma_id
-extern unsigned char Get_Pragma_Id (int);
+extern Pragma_Id Get_Pragma_Id (int);
 
 /* Define the numeric values for the pragmas. */