[PATCH 2/3] Introduce CLC_VERSION macros

Add these out-of-order in clc.h so we can use these in other headers.

CLC_VERSION_1_2 is only conditionally defined, as officially we implement OpenCL 1.1,
while this define is only introduced with OpenCL 1.2.

Add these out-of-order in clc.h so we can use these in other headers.

CLC_VERSION_1_2 is only conditionally defined, as officially we implement OpenCL 1.1,
while this define is only introduced with OpenCL 1.2.
---
generic/include/clc/clc.h | 3 +++
generic/include/clc/clcversion.h | 5 +++++
2 files changed, 8 insertions(+)
create mode 100644 generic/include/clc/clcversion.h

diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h
index c7c8dfb..e93a8c0 100644
--- a/generic/include/clc/clc.h
+++ b/generic/include/clc/clc.h
@@ -11,6 +11,9 @@
/* Function Attributes */
#include <clc/clcfunc.h>

+/* 6.9 Preprocessor Directives and Macros */
+#include <clc/clcversion.h>
+
/* 6.1 Supported Data Types */
#include <clc/clctypes.h>

diff --git a/generic/include/clc/clcversion.h b/generic/include/clc/clcversion.h
new file mode 100644
index 0000000..1026192
--- /dev/null
+++ b/generic/include/clc/clcversion.h
@@ -0,0 +1,5 @@
+#define CLC_VERSION_1_0 100
+#define CLC_VERSION_1_1 110
+#if __OPENCL_VERSION__ >= 120
+#define CLC_VERSION_1_2 120
+#endif

I think all these defines should be wrapped in __OPENCL_VERSION__ == 1XX,
because even when we support 1.2, we still want to be able to use the library with
a 1.1 implementation.

-Tom

+#define CLC_VERSION_1_0 100
+#define CLC_VERSION_1_1 110
+#if __OPENCL_VERSION__ >= 120
+#define CLC_VERSION_1_2 120
+#endif

I think all these defines should be wrapped in __OPENCL_VERSION__ == 1XX,
because even when we support 1.2, we still want to be able to use the library with
a 1.1 implementation.

I don’t quite understand what you’re saying. In OpenCL 1.1 both the first two macro’s exist. In OpenCL 1.2 all three exist.

Jeroen

>> +#define CLC_VERSION_1_0 100
>> +#define CLC_VERSION_1_1 110
>> +#if __OPENCL_VERSION__ >= 120
>> +#define CLC_VERSION_1_2 120
>> +#endif
>
> I think all these defines should be wrapped in __OPENCL_VERSION__ == 1XX,
> because even when we support 1.2, we still want to be able to use the library with
> a 1.1 implementation.

I don’t quite understand what you’re saying. In OpenCL 1.1 both the first two macro’s exist. In OpenCL 1.2 all three exist.

Sorry, you are right. I overlooked that. I checked the OpenCL 1.0 spec and it doesn't
have any of the macros, so I think we should wrap the first two in __OPENCL_VERSION__ >= 110

-Tom