aboutsummaryrefslogtreecommitdiff
path: root/include/CL/cl_platform.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/CL/cl_platform.h')
-rw-r--r--include/CL/cl_platform.h38
1 files changed, 23 insertions, 15 deletions
diff --git a/include/CL/cl_platform.h b/include/CL/cl_platform.h
index 8ae655d143..e7a0d6f476 100644
--- a/include/CL/cl_platform.h
+++ b/include/CL/cl_platform.h
@@ -135,6 +135,11 @@ extern "C" {
#if (defined (_WIN32) && defined(_MSC_VER))
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wlanguage-extension-token"
+#endif
+
/* intptr_t is used in cl.h and provided by stddef.h in Visual C++, but not in clang */
/* stdint.h was missing before Visual Studio 2010, include it for later versions and for clang */
#if defined(__clang__) || _MSC_VER >= 1600
@@ -155,6 +160,10 @@ typedef unsigned __int16 cl_half;
typedef float cl_float;
typedef double cl_double;
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
+
/* Macro names and corresponding values defined by OpenCL */
#define CL_CHAR_BIT 8
#define CL_SCHAR_MAX 127
@@ -501,25 +510,26 @@ typedef unsigned int cl_GLenum;
#if !defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#define __CL_HAS_ANON_STRUCT__ 1
#define __CL_ANON_STRUCT__
-#elif defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#elif defined(_WIN32) && defined(_MSC_VER) && !defined(__STDC__)
+#define __CL_HAS_ANON_STRUCT__ 1
+#define __CL_ANON_STRUCT__
+#elif defined(__GNUC__) && ! defined(__STRICT_ANSI__)
+#define __CL_HAS_ANON_STRUCT__ 1
+#define __CL_ANON_STRUCT__ __extension__
+#elif defined(__clang__)
#define __CL_HAS_ANON_STRUCT__ 1
#define __CL_ANON_STRUCT__ __extension__
-#elif defined( _WIN32) && defined(_MSC_VER) && ! defined(__STDC__)
- #if _MSC_VER >= 1500
- /* Microsoft Developer Studio 2008 supports anonymous structs, but
- * complains by default. */
- #define __CL_HAS_ANON_STRUCT__ 1
- #define __CL_ANON_STRUCT__
- /* Disable warning C4201: nonstandard extension used : nameless
- * struct/union */
- #pragma warning( push )
- #pragma warning( disable : 4201 )
- #endif
#else
#define __CL_HAS_ANON_STRUCT__ 0
#define __CL_ANON_STRUCT__
#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
+
/* Define alignment keys */
#if defined( __GNUC__ ) || defined(__INTEGRITY)
#define CL_ALIGNED(_x) __attribute__ ((aligned(_x)))
@@ -1395,10 +1405,8 @@ typedef union
}
#endif
-#if defined( _WIN32) && defined(_MSC_VER) && ! defined(__STDC__)
- #if _MSC_VER >=1500
+#if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__
#pragma warning( pop )
- #endif
#endif
#endif /* __CL_PLATFORM_H */