remove CMake option for OpenCL 3.0 provisional (#121)

* remove CMake option for OpenCL 3.0 provisional

* generate the OpenCL 3.0 APIs also
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a0da4d3..db0346f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,11 +34,6 @@
 # advance. Use it with discretion.
 option (BUILD_SHARED_LIBS "Build shared libs" ON)
 
-# This option enables support for OpenCL 3.0 Provisional in the ICD loader.  It
-# is currently off by default while the specification is provisional, as it may
-# change.
-option (ENABLE_OPENCL30_PROVISIONAL "Enable 3.0 provisional entry points" OFF)
-
 include(CheckFunctionExists)
 check_function_exists(secure_getenv HAVE_SECURE_GETENV)
 check_function_exists(__secure_getenv HAVE___SECURE_GETENV)
@@ -55,17 +50,6 @@
     loader/icd_platform.h)
 
 if (WIN32)
-    # By default don't include OpenCL 3.0 symbol definitions (i.e. comment them
-    # out), but include them for OpenCL 3.0 builds.  Once the symbols are no
-    # longer provisional then they may be included unconditionally.
-    set(ENABLE_OPENCL30_SYMBOLS ";")
-    if (ENABLE_OPENCL30_PROVISIONAL)
-      set(ENABLE_OPENCL30_SYMBOLS "")
-    endif ()
-    configure_file(
-        ${CMAKE_CURRENT_SOURCE_DIR}/loader/windows/OpenCL.def.in
-        ${CMAKE_CURRENT_BINARY_DIR}/loader/windows/OpenCL.def)
-
     list (APPEND OPENCL_ICD_LOADER_SOURCES 
         loader/windows/adapter.h
         loader/windows/icd_windows.c
@@ -77,7 +61,7 @@
         loader/windows/icd_windows_hkr.h
         loader/windows/icd_windows_apppackage.cpp
         loader/windows/icd_windows_apppackage.h
-        ${CMAKE_CURRENT_BINARY_DIR}/loader/windows/OpenCL.def
+        loader/windows/OpenCL.def
         loader/windows/OpenCL.rc)
     # Only add the DXSDK include directory if the environment variable is
     # defined.  Since the DXSDK has merged into the Windows SDK, this is
@@ -86,23 +70,10 @@
         include_directories ($ENV{DXSDK_DIR}/Include)
     endif ()
 else ()
-    # By default don't include OpenCL 3.0 symbol definitions (i.e. comment them
-    # out), but include them for OpenCL 3.0 builds.  Once the symbols are no
-    # longer provisional then they may be included unconditionally.
-    set(ENABLE_OPENCL30_SYMBOLS_START "/*")
-    set(ENABLE_OPENCL30_SYMBOLS_END "*/")
-    if (ENABLE_OPENCL30_PROVISIONAL)
-      set(ENABLE_OPENCL30_SYMBOLS_START "")
-      set(ENABLE_OPENCL30_SYMBOLS_END "")
-    endif ()
-    configure_file(
-        ${CMAKE_CURRENT_SOURCE_DIR}/loader/linux/icd_exports.map.in
-        ${CMAKE_CURRENT_BINARY_DIR}/loader/linux/icd_exports.map)
-
     list (APPEND OPENCL_ICD_LOADER_SOURCES
         loader/linux/icd_linux.c
         loader/linux/icd_linux_envvars.c
-        ${CMAKE_CURRENT_BINARY_DIR}/loader/linux/icd_exports.map)
+        loader/linux/icd_exports.map)
 endif ()
 
 set (OPENCL_ICD_LOADER_HEADERS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/inc CACHE PATH "Path to OpenCL Headers")
@@ -133,17 +104,13 @@
     if (APPLE)
         target_link_libraries (OpenCL ${CMAKE_THREAD_LIBS_INIT})
     else ()
-        set_target_properties (OpenCL PROPERTIES LINK_FLAGS "-Wl,--version-script -Wl,${CMAKE_CURRENT_BINARY_DIR}/loader/linux/icd_exports.map")
+        set_target_properties (OpenCL PROPERTIES LINK_FLAGS "-Wl,--version-script -Wl,${CMAKE_CURRENT_SOURCE_DIR}/loader/linux/icd_exports.map")
         target_link_libraries (OpenCL ${CMAKE_THREAD_LIBS_INIT})
     endif ()
 endif ()
 
 include_directories (${OPENCL_ICD_LOADER_HEADERS_DIR})
-if (ENABLE_OPENCL30_PROVISIONAL)
-  add_definitions (-DCL_TARGET_OPENCL_VERSION=300)
-else()
-  add_definitions (-DCL_TARGET_OPENCL_VERSION=220)
-endif()
+add_definitions (-DCL_TARGET_OPENCL_VERSION=300)
 
 target_include_directories (OpenCL PRIVATE ${CMAKE_CURRENT_BINARY_DIR} loader)
 target_link_libraries (OpenCL ${CMAKE_DL_LIBS})
diff --git a/loader/icd_dispatch.c b/loader/icd_dispatch.c
index 878f6e0..2d1e4bd 100644
--- a/loader/icd_dispatch.c
+++ b/loader/icd_dispatch.c
@@ -216,63 +216,6 @@
         function_name);
 }
 
-#ifdef CL_VERSION_3_0
-/* ICD loader entry points should not normally be ifdef'ed, but prevent
- * OpenCL 3.0 provisional entry points from being in general builds before the
- * specification is finalized. */
-
-CL_API_ENTRY cl_mem CL_API_CALL clCreateBufferWithProperties(
-    cl_context context,
-    const cl_mem_properties* properties,
-    cl_mem_flags flags,
-    size_t size,
-    void* host_ptr,
-    cl_int* errcode_ret) CL_API_SUFFIX__VERSION_3_0
-{
-    KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
-    return context->dispatch->clCreateBufferWithProperties(
-        context,
-        properties,
-        flags,
-        size,
-        host_ptr,
-        errcode_ret);
-}
-
-CL_API_ENTRY cl_mem CL_API_CALL clCreateImageWithProperties(
-    cl_context context,
-    const cl_mem_properties* properties,
-    cl_mem_flags flags,
-    const cl_image_format* image_format,
-    const cl_image_desc* image_desc,
-    void* host_ptr,
-    cl_int* errcode_ret) CL_API_SUFFIX__VERSION_3_0
-{
-    KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
-    return context->dispatch->clCreateImageWithProperties(
-        context,
-        properties,
-        flags,
-        image_format,
-        image_desc,
-        host_ptr,
-        errcode_ret);
-}
-
-CL_API_ENTRY cl_int CL_API_CALL clSetContextDestructorCallback(
-    cl_context context,
-    void (CL_CALLBACK* pfn_notify)(cl_context context, void* user_data),
-    void* user_data) CL_API_SUFFIX__VERSION_3_0
-{
-    KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT);
-    return context->dispatch->clSetContextDestructorCallback(
-        context,
-        pfn_notify,
-        user_data);
-}
-
-#endif // CL_VERSION_3_0
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/loader/icd_dispatch_generated.c b/loader/icd_dispatch_generated.c
index 8a05935..8498563 100644
--- a/loader/icd_dispatch_generated.c
+++ b/loader/icd_dispatch_generated.c
@@ -1986,6 +1986,62 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
+CL_API_ENTRY cl_int CL_API_CALL clSetContextDestructorCallback(
+    cl_context context,
+    void (CL_CALLBACK* pfn_notify)(cl_context context, void* user_data),
+    void* user_data) CL_API_SUFFIX__VERSION_3_0
+{
+    KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT);
+    return context->dispatch->clSetContextDestructorCallback(
+        context,
+        pfn_notify,
+        user_data);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+CL_API_ENTRY cl_mem CL_API_CALL clCreateBufferWithProperties(
+    cl_context context,
+    const cl_mem_properties* properties,
+    cl_mem_flags flags,
+    size_t size,
+    void* host_ptr,
+    cl_int* errcode_ret) CL_API_SUFFIX__VERSION_3_0
+{
+    KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
+    return context->dispatch->clCreateBufferWithProperties(
+        context,
+        properties,
+        flags,
+        size,
+        host_ptr,
+        errcode_ret);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+CL_API_ENTRY cl_mem CL_API_CALL clCreateImageWithProperties(
+    cl_context context,
+    const cl_mem_properties* properties,
+    cl_mem_flags flags,
+    const cl_image_format* image_format,
+    const cl_image_desc* image_desc,
+    void* host_ptr,
+    cl_int* errcode_ret) CL_API_SUFFIX__VERSION_3_0
+{
+    KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
+    return context->dispatch->clCreateImageWithProperties(
+        context,
+        properties,
+        flags,
+        image_format,
+        image_desc,
+        host_ptr,
+        errcode_ret);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
 // cl_ext_device_fission
 
 CL_API_ENTRY cl_int CL_API_CALL clReleaseDeviceEXT(
diff --git a/loader/linux/icd_exports.map.in b/loader/linux/icd_exports.map
similarity index 98%
rename from loader/linux/icd_exports.map.in
rename to loader/linux/icd_exports.map
index 8ef522b..f9299c3 100644
--- a/loader/linux/icd_exports.map.in
+++ b/loader/linux/icd_exports.map
@@ -164,11 +164,9 @@
         clSetProgramSpecializationConstant;
 } OPENCL_2.1;
 
-@ENABLE_OPENCL30_SYMBOLS_START@
 OPENCL_3.0 {
     global:
         clCreateBufferWithProperties;
         clCreateImageWithProperties;
         clSetContextDestructorCallback;
 } OPENCL_2.2;
-@ENABLE_OPENCL30_SYMBOLS_END@
diff --git a/loader/windows/OpenCL.def.in b/loader/windows/OpenCL.def
similarity index 95%
rename from loader/windows/OpenCL.def.in
rename to loader/windows/OpenCL.def
index 7fbd39c..ed451bf 100644
--- a/loader/windows/OpenCL.def.in
+++ b/loader/windows/OpenCL.def
@@ -161,6 +161,6 @@
 clSetProgramSpecializationConstant
 
 ; OpenCL 3.0 API
-@ENABLE_OPENCL30_SYMBOLS@clCreateBufferWithProperties
-@ENABLE_OPENCL30_SYMBOLS@clCreateImageWithProperties
-@ENABLE_OPENCL30_SYMBOLS@clSetContextDestructorCallback
+clCreateBufferWithProperties
+clCreateImageWithProperties
+clSetContextDestructorCallback
diff --git a/loader/windows/OpenCL.rc b/loader/windows/OpenCL.rc
index 3353fd4..2ebc875 100644
--- a/loader/windows/OpenCL.rc
+++ b/loader/windows/OpenCL.rc
@@ -18,9 +18,9 @@
 
 #include <windows.h>
 
-#define OPENCL_ICD_LOADER_VERSION_MAJOR 2
-#define OPENCL_ICD_LOADER_VERSION_MINOR 2
-#define OPENCL_ICD_LOADER_VERSION_REV   9
+#define OPENCL_ICD_LOADER_VERSION_MAJOR 3
+#define OPENCL_ICD_LOADER_VERSION_MINOR 0
+#define OPENCL_ICD_LOADER_VERSION_REV   0
 
 #ifdef RC_INVOKED
 
diff --git a/scripts/icd_dispatch_generated.c.mako b/scripts/icd_dispatch_generated.c.mako
index 5bc9db4..cdc4b4a 100644
--- a/scripts/icd_dispatch_generated.c.mako
+++ b/scripts/icd_dispatch_generated.c.mako
@@ -4,9 +4,6 @@
     'clGetPlatformIDs',                         # to query platforms
     'clGetExtensionFunctionAddress',            # to return ICD-aware extensions
     'clGetExtensionFunctionAddressForPlatform', # to return ICD-aware extensions
-    'clCreateBufferWithProperties',             # only until OpenCL 3.0 is final
-    'clCreateImageWithProperties',              # only until OpenCL 3.0 is final
-    'clSetContextDestructorCallback',           # only until OpenCL 3.0 is final
     }
 
 # Handles, and mappings to errors when handles are invalid:
diff --git a/test/driver_stub/cl.c b/test/driver_stub/cl.c
index 733a2aa..c82b8a5 100644
--- a/test/driver_stub/cl.c
+++ b/test/driver_stub/cl.c
@@ -355,8 +355,6 @@
     return return_value;
 }
 
-#ifdef CL_VERSION_3_0
-
 CL_API_ENTRY cl_int CL_API_CALL
 clSetContextDestructorCallback(cl_context         context,
                                void (CL_CALLBACK* pfn_notify)(cl_context context,
@@ -377,8 +375,6 @@
     return return_value;
 }
 
-#endif
-
 /* Command Queue APIs */
 CL_API_ENTRY cl_command_queue CL_API_CALL
 clCreateCommandQueue(cl_context                     context,
@@ -575,8 +571,6 @@
     return obj;
 }
 
-#ifdef CL_VERSION_3_0
-
 CL_API_ENTRY cl_mem CL_API_CALL
 clCreateBufferWithProperties(cl_context                context ,
                              const cl_mem_properties * properties,
@@ -623,8 +617,6 @@
     return obj;
 }
 
-#endif  // CL_VERSION_3_0
-
 CL_API_ENTRY cl_int CL_API_CALL
 clRetainMemObject(cl_mem memobj) CL_API_SUFFIX__VERSION_1_0
 {
diff --git a/test/driver_stub/icd.c b/test/driver_stub/icd.c
index eea8665..7b58de2 100644
--- a/test/driver_stub/icd.c
+++ b/test/driver_stub/icd.c
@@ -230,16 +230,10 @@
     ICD_DISPATCH_TABLE_ENTRY( NULL );
     ICD_DISPATCH_TABLE_ENTRY( NULL );
 
-#ifdef CL_VERSION_3_0
     /* OpenCL 3.0 */
     ICD_DISPATCH_TABLE_ENTRY ( clCreateBufferWithProperties );
     ICD_DISPATCH_TABLE_ENTRY ( clCreateImageWithProperties );
     ICD_DISPATCH_TABLE_ENTRY ( clSetContextDestructorCallback );
-#else
-    ICD_DISPATCH_TABLE_ENTRY( NULL );
-    ICD_DISPATCH_TABLE_ENTRY( NULL );
-    ICD_DISPATCH_TABLE_ENTRY( NULL );
-#endif  // CL_VERSION_3_0
 
     // return success
     *outDispatchTable = dispatchTable;
diff --git a/test/loader_test/param_struct.h b/test/loader_test/param_struct.h
index 0e2db51..d04e229 100644
--- a/test/loader_test/param_struct.h
+++ b/test/loader_test/param_struct.h
@@ -68,14 +68,12 @@
     size_t *param_value_size_ret;
 };
 
-#ifdef CL_VERSION_3_0
 struct clSetContextDestructorCallback_st
 {
     cl_context context;
     void (CL_CALLBACK *pfn_notify)(cl_context context, void *user_data);
     void *user_data;
 };
-#endif  // CL_VERSION_3_0
 
 struct clGetPlatformIDs_st 
 {
@@ -185,7 +183,7 @@
     void *host_ptr;
     cl_int *errcode_ret;
 };
-#ifdef CL_VERSION_3_0
+
 struct clCreateBufferWithProperties_st
 {
     cl_context context;
@@ -195,7 +193,7 @@
     void *host_ptr;
     cl_int *errcode_ret;
 };
-#endif  // CL_VERSION_3_0
+
 struct clCreateSubBuffer_st 
 {
     cl_mem buffer;
@@ -517,7 +515,6 @@
     cl_int *errcode_ret;
 };
 
-#ifdef CL_VERSION_3_0
 struct clCreateImageWithProperties_st
 {
     cl_context context;
@@ -528,7 +525,6 @@
     void *host_ptr;
     cl_int *errcode_ret;
 };
-#endif  // CL_VERSION_3_0
 
 struct clCreateImage2D_st 
 {
diff --git a/test/loader_test/test_create_calls.c b/test/loader_test/test_create_calls.c
index f7e8990..9bd3514 100644
--- a/test/loader_test/test_create_calls.c
+++ b/test/loader_test/test_create_calls.c
@@ -60,12 +60,10 @@
     {NULL, 0, 0, NULL, NULL}
 };
 
-#ifdef CL_VERSION_3_0
 const struct clCreateBufferWithProperties_st clCreateBufferWithPropertiesData[NUM_ITEMS_clCreateBufferWithProperties] =
 {
     {NULL, NULL, 0, 0, NULL, NULL}
 };
-#endif  // CL_VERSION_3_0
 
 const struct clCreateSubBuffer_st clCreateSubBufferData[NUM_ITEMS_clCreateSubBuffer] =
 {
@@ -77,12 +75,10 @@
     { NULL, 0x0, NULL, NULL, NULL, NULL}
 };
 
-#ifdef CL_VERSION_3_0
 const struct clCreateImageWithProperties_st clCreateImageWithPropertiesData[NUM_ITEMS_clCreateImageWithProperties] =
 {
     { NULL, NULL, 0x0, NULL, NULL, NULL, NULL}
 };
-#endif  // CL_VERSION_3_0
 
 const struct clCreateImage2D_st clCreateImage2DData[NUM_ITEMS_clCreateImage2D] =
 {
@@ -313,7 +309,6 @@
 
 }
 
-#ifdef CL_VERSION_3_0
 int test_clCreateBufferWithProperties(const struct clCreateBufferWithProperties_st *data)
 {
     test_icd_app_log("clCreateBufferWithProperties(%p, %p, %x, %u, %p, %p)\n",
@@ -338,7 +333,6 @@
     return 0;
 
 }
-#endif  // CL_VERSION_3_0
 
 int test_clCreateSubBuffer(const struct clCreateSubBuffer_st *data)
 {
@@ -387,7 +381,6 @@
 
 }
 
-#ifdef CL_VERSION_3_0
 int test_clCreateImageWithProperties(const struct clCreateImageWithProperties_st *data)
 {
     test_icd_app_log("clCreateImageWithProperties(%p, %p, %x, %p, %p, %p, %p)\n",
@@ -413,7 +406,6 @@
     return 0;
 
 }
-#endif  // CL_VERSION_3_0
 
 int test_clCreateImage2D(const struct clCreateImage2D_st *data)
 {
@@ -779,17 +771,13 @@
 
     test_clCreateBuffer(clCreateBufferData);
 
-#ifdef CL_VERSION_3_0
     test_clCreateBufferWithProperties(clCreateBufferWithPropertiesData);
-#endif
 
     test_clCreateSubBuffer(clCreateSubBufferData);
 
     test_clCreateImage(clCreateImageData);
 
-#ifdef CL_VERSION_3_0
     test_clCreateImageWithProperties(clCreateImageWithPropertiesData);
-#endif
 
     test_clReleaseMemObject(clReleaseMemObjectDataImage);
 
diff --git a/test/loader_test/test_platforms.c b/test/loader_test/test_platforms.c
index 8296e65..cb2839b 100644
--- a/test/loader_test/test_platforms.c
+++ b/test/loader_test/test_platforms.c
@@ -20,12 +20,10 @@
     {NULL, 0, 0, NULL, NULL}
 };
 
-#ifdef CL_VERSION_3_0
 struct clSetContextDestructorCallback_st clSetContextDestructorCallbackData[NUM_ITEMS_clSetContextDestructorCallback] =
 {
     {NULL, setcontextdestructor_callback, NULL}
 };
-#endif  // CL_VERSION_3_0
 
 struct clGetPlatformInfo_st clGetPlatformInfoData[NUM_ITEMS_clGetPlatformInfo] =
 {
@@ -87,7 +85,6 @@
 }
 
 
-#ifdef CL_VERSION_3_0
 int test_clSetContextDestructorCallback(
     const struct clSetContextDestructorCallback_st* data)
 {
@@ -108,7 +105,6 @@
 
     return 0;
 }
-#endif  // CL_VERSION_3_0
 
 
 int test_clGetPlatformInfo(const struct clGetPlatformInfo_st* data)
@@ -199,11 +195,9 @@
         test_clRetainContext(&clRetainContextData[i]);
     }
 
-#ifdef CL_VERSION_3_0
     for (i = 0;i<NUM_ITEMS_clSetContextDestructorCallback;i++) {
         test_clSetContextDestructorCallback(&clSetContextDestructorCallbackData[i]);
     }
-#endif  // CL_VERSION_3_0
 
     for (i = 0;i<NUM_ITEMS_clGetContextInfo;i++) {
         test_clGetContextInfo(&clGetContextInfoData[i]);