Skip to content

Commit 6245403

Browse files
authored
Address anonymous union initialization when extensions are disabled. (#257)
1 parent f9873de commit 6245403

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

loader/icd.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,13 @@ void khrIcdContextPropertiesGetPlatform(
181181
const cl_context_properties *properties,
182182
cl_platform_id *outPlatform);
183183

184+
// condition anonyous union initialization to usage
185+
#if __CL_HAS_ANON_STRUCT__
186+
#define ICD_ANON_UNION_INIT_MEMBER(a) {a}
187+
#else
188+
#define ICD_ANON_UNION_INIT_MEMBER(a) a
189+
#endif
190+
184191
// internal tracing macros
185192
#define KHR_ICD_TRACE(...) \
186193
do \

loader/icd_dispatch_generated.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6825,7 +6825,7 @@ static cl_int CL_API_CALL clGetKernelSubGroupInfoKHR_disp(
68256825

68266826
#if defined(CL_ENABLE_LAYERS)
68276827
struct _cl_icd_dispatch khrMasterDispatch = {
6828-
{&clGetPlatformIDs_disp},
6828+
ICD_ANON_UNION_INIT_MEMBER(&clGetPlatformIDs_disp),
68296829
&clGetPlatformInfo_disp,
68306830
&clGetDeviceIDs_disp,
68316831
&clGetDeviceInfo_disp,
@@ -6856,7 +6856,7 @@ struct _cl_icd_dispatch khrMasterDispatch = {
68566856
&clRetainProgram_disp,
68576857
&clReleaseProgram_disp,
68586858
&clBuildProgram_disp,
6859-
{&clUnloadCompiler_disp},
6859+
ICD_ANON_UNION_INIT_MEMBER(&clUnloadCompiler_disp),
68606860
&clGetProgramInfo_disp,
68616861
&clGetProgramBuildInfo_disp,
68626862
&clCreateKernel_disp,

scripts/icd_dispatch_generated.c.mako

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ ${("CL_API_ENTRY", "static")[disp]} ${api.RetType} CL_API_CALL ${api.Name + ("",
280280
%endfor
281281
#if defined(CL_ENABLE_LAYERS)
282282
struct _cl_icd_dispatch khrMasterDispatch = {
283-
{&clGetPlatformIDs_disp},
283+
ICD_ANON_UNION_INIT_MEMBER(&clGetPlatformIDs_disp),
284284
&clGetPlatformInfo_disp,
285285
&clGetDeviceIDs_disp,
286286
&clGetDeviceInfo_disp,
@@ -311,7 +311,7 @@ struct _cl_icd_dispatch khrMasterDispatch = {
311311
&clRetainProgram_disp,
312312
&clReleaseProgram_disp,
313313
&clBuildProgram_disp,
314-
{&clUnloadCompiler_disp},
314+
ICD_ANON_UNION_INIT_MEMBER(&clUnloadCompiler_disp),
315315
&clGetProgramInfo_disp,
316316
&clGetProgramBuildInfo_disp,
317317
&clCreateKernel_disp,

0 commit comments

Comments
 (0)