diff options
author | Steve Baird <baird@adacore.com> | 2022-10-05 15:16:26 -0700 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2022-11-04 14:47:23 +0100 |
commit | c07da8567bfc67bd28191f63a9247566260063ad (patch) | |
tree | 991be92d777e00b06fef8b82a8c6106291036559 /gcc | |
parent | ffcd1921e0aa37cf6b0fc6926bcadb0e988e4a2a (diff) | |
download | gcc-c07da8567bfc67bd28191f63a9247566260063ad.zip gcc-c07da8567bfc67bd28191f63a9247566260063ad.tar.gz gcc-c07da8567bfc67bd28191f63a9247566260063ad.tar.bz2 |
ada: Generate missing object decls for adainit/adafinal registration calls
A previous change on this ticket introduced calls to CUDA_Register_Function
for adainit and adafinal, but failed to introduce declarations for the
C string variables that are initialized and then passed as actual parameters
in this call. Provide the missing declarations (and, incidentally, change
the names of the two variables).
gcc/ada/
* bindgen.adb: Introduce two new string constants for the names of
the C-String variables that are assigned the names for adainit and
adafinal. Replace string literals in Gen_CUDA_Init with references
to these constants. In Gen_CUDA_Defs, generate C-String variable
declarations where these constants are the names of the variables.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/bindgen.adb | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb index 1daa03d..4e89918 100644 --- a/gcc/ada/bindgen.adb +++ b/gcc/ada/bindgen.adb @@ -114,6 +114,11 @@ package body Bindgen is -- For CodePeer, introduce a wrapper subprogram which calls the -- user-defined main subprogram. + -- Names for local C-String variables + + Adainit_String_Obj_Name : constant String := "Adainit_Name_C_String"; + Adafinal_String_Obj_Name : constant String := "Adafinal_Name_C_String"; + -- Names and link_names for CUDA device adainit/adafinal procs. Device_Subp_Name_Prefix : constant String := "imported_device_"; @@ -131,9 +136,6 @@ package body Bindgen is function Device_Ada_Init_Subp_Name return String is (Device_Subp_Name_Prefix & Ada_Init_Name.all); - -- Text for aspect specifications (if any) given as part of the - -- Adainit and Adafinal spec declarations. - ---------------------------------- -- Interface_State Pragma Table -- ---------------------------------- @@ -1366,6 +1368,13 @@ package body Bindgen is WBI (" pragma Import (C, " & Device_Ada_Final_Subp_Name & ", Link_Name => """ & Device_Ada_Final_Link_Name & """);"); + -- C-string declarations for adainit and adafinal + WBI (" " & Adainit_String_Obj_Name + & " : Interfaces.C.Strings.Chars_Ptr;"); + WBI (" " & Adafinal_String_Obj_Name + & " : Interfaces.C.Strings.Chars_Ptr;"); + WBI (""); + WBI (""); end Gen_CUDA_Defs; @@ -1449,11 +1458,11 @@ package body Bindgen is -- Register device-side Adainit and Adafinal Gen_CUDA_Register_Function_Call (Kernel_Name => Device_Ada_Init_Link_Name, - Kernel_String => "Adainit_Name_String", + Kernel_String => Adainit_String_Obj_Name, Kernel_Proc => Device_Ada_Init_Subp_Name); Gen_CUDA_Register_Function_Call (Kernel_Name => Device_Ada_Final_Link_Name, - Kernel_String => "Adafinal_Name_String", + Kernel_String => Adafinal_String_Obj_Name, Kernel_Proc => Device_Ada_Final_Subp_Name); WBI (" CUDA_Register_Fat_Binary_End (Fat_Binary_Handle);"); |