A number of functions were deprecated with version 2.0 of the OpenCL spec, and including the OpenCL 2.0 headers causes GCC and clang to emit deprecation warnings.
This patch uses "pragma GCC diagnostic" (which is also supported by clang[1]) to suppress these warnings only the in functions using the deprecated functionality. I chose this approach rather than using the precompiler to switch between the CL 1.x and 2.0 functions since that would make the compiled code unusable on 1.x systems if it's compiled against a 2.0 driver. [1] http://clang.llvm.org/docs/UsersManual.html#pragma-gcc-diagnostic Signed-off-by: Dylan Baker <dylanx.c.ba...@intel.com> --- tests/util/piglit-util-cl.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/util/piglit-util-cl.c b/tests/util/piglit-util-cl.c index 51d6808..bb8b297 100644 --- a/tests/util/piglit-util-cl.c +++ b/tests/util/piglit-util-cl.c @@ -655,6 +655,8 @@ piglit_cl_get_device_ids(cl_platform_id platform_id, cl_device_type device_type, return 0; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" piglit_cl_context piglit_cl_create_context(cl_platform_id platform_id, const cl_device_id device_ids[], @@ -714,6 +716,7 @@ piglit_cl_create_context(cl_platform_id platform_id, return context; } +#pragma GCC diagnostic pop void piglit_cl_release_context(piglit_cl_context context) @@ -1032,6 +1035,8 @@ piglit_cl_get_device_image_support(cl_device_id device) return ret; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" cl_mem piglit_cl_create_image(piglit_cl_context context, cl_mem_flags flags, const cl_image_format *format, @@ -1067,6 +1072,7 @@ piglit_cl_create_image(piglit_cl_context context, cl_mem_flags flags, return image; } +#pragma GCC diagnostic pop bool piglit_cl_write_image(cl_command_queue command_queue, cl_mem image, @@ -1204,6 +1210,8 @@ piglit_cl_create_kernel(cl_program program, const char* kernel_name) return kernel; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" cl_sampler piglit_cl_create_sampler(piglit_cl_context context, cl_bool normalized_coords, @@ -1223,6 +1231,7 @@ piglit_cl_create_sampler(piglit_cl_context context, return sampler; } +#pragma GCC diagnostic pop bool piglit_cl_set_kernel_arg(cl_kernel kernel, cl_uint arg_index, size_t size, @@ -1308,6 +1317,8 @@ piglit_cl_execute_ND_range_kernel(cl_command_queue command_queue, return true; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" bool piglit_cl_enqueue_task(cl_command_queue command_queue, cl_kernel kernel) { @@ -1324,6 +1335,7 @@ piglit_cl_enqueue_task(cl_command_queue command_queue, cl_kernel kernel) return true; } +#pragma GCC diagnostic pop bool piglit_cl_execute_task(cl_command_queue command_queue, cl_kernel kernel) -- 2.8.2 _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit