https://gcc.gnu.org/g:440450e5b15976e1f1e3b3694cbfd0657f9b2ea9
commit r17-6530-g440450e5b15976e1f1e3b3694cbfd0657f9b2ea9 Author: Thomas Schwinge <[email protected]> Date: Wed Nov 11 11:15:23 2026 +0100 Align GCC's 'cuda.h' better to CUDA's: name 'enum's, name aliased types (opaque) in 'typedef's GCC's 'cuda.h' currently doesn't name 'enum's, and uses plain 'void *' instead of naming aliased types (opaque) in 'typedef's. That's in contrast to the corresponding CUDA 8.0 'cuda.h', and makes a difference, for example, when in C++ code using GCC's 'cuda.h' vs. a CUDA 'cuda.h' in '-DPLUGIN_NVPTX_INCLUDE_SYSTEM_CUDA_H' configurations. include/ * cuda/cuda.h: Name 'enum's, name aliased types (opaque) in 'typedef's. Diff: --- include/cuda/cuda.h | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/include/cuda/cuda.h b/include/cuda/cuda.h index 5fe04792ecf8..3c3e00dc4d7b 100644 --- a/include/cuda/cuda.h +++ b/include/cuda/cuda.h @@ -36,22 +36,22 @@ the proprietary CUDA toolkit. */ extern "C" { #endif -typedef void *CUcontext; +typedef struct CUctx_st *CUcontext; typedef int CUdevice; #if defined(__LP64__) || defined(_WIN64) typedef unsigned long long CUdeviceptr; #else typedef unsigned CUdeviceptr; #endif -typedef void *CUevent; -typedef void *CUfunction; -typedef void *CUlinkState; -typedef void *CUmodule; -typedef void *CUarray; +typedef struct CUevent_st *CUevent; +typedef struct CUfunc_st *CUfunction; +typedef struct CUlinkState_st *CUlinkState; +typedef struct CUmod_st *CUmodule; +typedef struct CUarray_st *CUarray; typedef size_t (*CUoccupancyB2DSize)(int); -typedef void *CUstream; +typedef struct CUstream_st *CUstream; -typedef enum { +typedef enum cudaError_enum { CUDA_SUCCESS = 0, CUDA_ERROR_INVALID_VALUE = 1, CUDA_ERROR_OUT_OF_MEMORY = 2, @@ -68,7 +68,7 @@ typedef enum { CUDA_ERROR_UNKNOWN = 999 } CUresult; -typedef enum { +typedef enum CUdevice_attribute_enum { CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 1, CU_DEVICE_ATTRIBUTE_WARP_SIZE = 10, CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK = 12, @@ -86,21 +86,21 @@ typedef enum { CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS = 88 } CUdevice_attribute; -typedef enum { +typedef enum CUmemAttach_flags_enum { CU_MEM_ATTACH_GLOBAL = 0x1 } CUmemAttach_flags; -enum { +typedef enum CUevent_flags_enum { CU_EVENT_DEFAULT = 0, CU_EVENT_DISABLE_TIMING = 2 -}; +} CUevent_flags; -typedef enum { +typedef enum CUfunction_attribute_enum { CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 0, CU_FUNC_ATTRIBUTE_NUM_REGS = 4 } CUfunction_attribute; -typedef enum { +typedef enum CUjit_option_enum { CU_JIT_WALL_TIME = 2, CU_JIT_INFO_LOG_BUFFER = 3, CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES = 4, @@ -112,13 +112,13 @@ typedef enum { CU_JIT_GENERATE_LINE_INFO = 13, } CUjit_option; -typedef enum { +typedef enum CUjitInputType_enum { CU_JIT_INPUT_PTX = 1 } CUjitInputType; -enum { +typedef enum CUctx_flags_enum { CU_CTX_SCHED_AUTO = 0 -}; +} CUctx_flags; #define CU_LAUNCH_PARAM_END ((void *) 0) #define CU_LAUNCH_PARAM_BUFFER_POINTER ((void *) 1) @@ -126,31 +126,31 @@ enum { #define CU_MEMHOSTALLOC_DEVICEMAP 0x02 -enum { +typedef enum CUstream_flags_enum { CU_STREAM_DEFAULT = 0, CU_STREAM_NON_BLOCKING = 1 -}; +} CUstream_flags; -typedef enum { +typedef enum CUlimit_enum { CU_LIMIT_STACK_SIZE = 0x00, CU_LIMIT_MALLOC_HEAP_SIZE = 0x02, } CUlimit; -typedef enum { +typedef enum CUmemorytype_enum { CU_MEMORYTYPE_HOST = 0x01, CU_MEMORYTYPE_DEVICE = 0x02, CU_MEMORYTYPE_ARRAY = 0x03, CU_MEMORYTYPE_UNIFIED = 0x04 } CUmemorytype; -typedef enum { +typedef enum CUpointer_attribute_enum { CU_POINTER_ATTRIBUTE_CONTEXT = 0x01, CU_POINTER_ATTRIBUTE_MEMORY_TYPE = 0x02, CU_POINTER_ATTRIBUTE_DEVICE_POINTER = 0x03, CU_POINTER_ATTRIBUTE_HOST_POINTER = 0x04 } CUpointer_attribute; -typedef struct { +typedef struct CUDA_MEMCPY2D_st { size_t srcXInBytes, srcY; CUmemorytype srcMemoryType; const void *srcHost; @@ -168,7 +168,7 @@ typedef struct { size_t WidthInBytes, Height; } CUDA_MEMCPY2D; -typedef struct { +typedef struct CUDA_MEMCPY3D_st { size_t srcXInBytes, srcY, srcZ; size_t srcLOD; CUmemorytype srcMemoryType; @@ -190,7 +190,7 @@ typedef struct { size_t WidthInBytes, Height, Depth; } CUDA_MEMCPY3D; -typedef struct { +typedef struct CUDA_MEMCPY3D_PEER_st { size_t srcXInBytes, srcY, srcZ; size_t srcLOD; CUmemorytype srcMemoryType; @@ -212,7 +212,7 @@ typedef struct { size_t WidthInBytes, Height, Depth; } CUDA_MEMCPY3D_PEER; -typedef struct { +typedef struct CUuuid_st { char bytes[16]; } CUuuid;
