Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 13 additions & 28 deletions CL/cl.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
extern "C" {
#endif

#if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__
/* Disable warning C4201: nonstandard extension used : nameless struct/union */
#pragma warning( push )
#pragma warning( disable : 4201 )
#endif

/******************************************************************************/

typedef struct _cl_platform_id * cl_platform_id;
Expand Down Expand Up @@ -133,39 +139,14 @@ typedef struct _cl_image_desc {
size_t image_slice_pitch;
cl_uint num_mip_levels;
cl_uint num_samples;
#ifdef CL_VERSION_2_0
#if defined(__GNUC__)
__extension__ /* Prevents warnings about anonymous union in -pedantic builds */
#endif
#if defined(_MSC_VER) && !defined(__STDC__)
#pragma warning( push )
#pragma warning( disable : 4201 ) /* Prevents warning about nameless struct/union in /W4 builds */
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wc11-extensions" /* Prevents warning about nameless union being C11 extension*/
#endif
#if defined(_MSC_VER) && defined(__STDC__)
/* Anonymous unions are not supported in /Za builds */
#else
union {
#endif
#if defined(CL_VERSION_2_0) && __CL_HAS_ANON_STRUCT__
__CL_ANON_STRUCT__ union {
#endif
cl_mem buffer;
#ifdef CL_VERSION_2_0
#if defined(_MSC_VER) && defined(__STDC__)
/* Anonymous unions are not supported in /Za builds */
#else
#if defined(CL_VERSION_2_0) && __CL_HAS_ANON_STRUCT__
cl_mem mem_object;
};
#endif
#if defined(_MSC_VER) && !defined(__STDC__)
#pragma warning( pop )
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif
} cl_image_desc;

#endif
Expand Down Expand Up @@ -1932,4 +1913,8 @@ clEnqueueTask(cl_command_queue command_queue,
}
#endif

#if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__
#pragma warning( pop )
#endif

#endif /* __OPENCL_CL_H */
31 changes: 29 additions & 2 deletions CL/cl_icd.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,20 @@
#include <CL/cl_egl.h>
#include <CL/cl_ext.h>
#include <CL/cl_gl.h>
#include <CL/cl_platform.h>

#if defined(_WIN32)
#include <CL/cl_d3d11.h>
#include <CL/cl_d3d10.h>
#include <CL/cl_dx9_media_sharing.h>
#endif

#if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__
/* Disable warning C4201: nonstandard extension used : nameless struct/union */
#pragma warning( push )
#pragma warning( disable : 4201 )
#endif

#ifdef __cplusplus
extern "C" {
#endif
Expand All @@ -37,7 +44,15 @@ extern "C" {

typedef struct _cl_icd_dispatch {
/* OpenCL 1.0 */
clGetPlatformIDs_t *clGetPlatformIDs;
#if __CL_HAS_ANON_STRUCT__
__CL_ANON_STRUCT__ union {
#endif
clGetPlatformIDs_t *clGetPlatformIDs;
#if __CL_HAS_ANON_STRUCT__
/* Set to CL_ICD2_TAG_KHR for cl_khr_icd 2.0.0 */
intptr_t clGetPlatformIDs_icd2_tag;
};
#endif
clGetPlatformInfo_t *clGetPlatformInfo;
clGetDeviceIDs_t *clGetDeviceIDs;
clGetDeviceInfo_t *clGetDeviceInfo;
Expand Down Expand Up @@ -68,7 +83,15 @@ typedef struct _cl_icd_dispatch {
clRetainProgram_t *clRetainProgram;
clReleaseProgram_t *clReleaseProgram;
clBuildProgram_t *clBuildProgram;
clUnloadCompiler_t *clUnloadCompiler;
#if __CL_HAS_ANON_STRUCT__
__CL_ANON_STRUCT__ union {
#endif
clUnloadCompiler_t *clUnloadCompiler;
#if __CL_HAS_ANON_STRUCT__
/* Set to CL_ICD2_TAG_KHR for cl_khr_icd 2.0.0 */
intptr_t clUnloadCompiler_icd2_tag;
};
#endif
clGetProgramInfo_t *clGetProgramInfo;
clGetProgramBuildInfo_t *clGetProgramBuildInfo;
clCreateKernel_t *clCreateKernel;
Expand Down Expand Up @@ -312,4 +335,8 @@ typedef struct _cl_icd_dispatch {
}
#endif

#if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__
#pragma warning( pop )
#endif

#endif /* #ifndef OPENCL_CL_ICD_H */