From 9d0b5f82c2734444145718f12788f2dde436ef45 Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Wed, 1 May 2019 13:03:59 +0100 Subject: COMPMID-2177 Fix clang warnings Change-Id: I78039db8c58d7b14a042c41e54c25fb9cb509bf7 Signed-off-by: Michalis Spyrou Reviewed-on: https://review.mlplatform.org/c/1092 Reviewed-by: VidhyaSudhan Loganathan Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins --- src/runtime/CL/CLHelpers.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/runtime/CL/CLHelpers.cpp') diff --git a/src/runtime/CL/CLHelpers.cpp b/src/runtime/CL/CLHelpers.cpp index 533e6fabfa..8bc7b8eb7b 100644 --- a/src/runtime/CL/CLHelpers.cpp +++ b/src/runtime/CL/CLHelpers.cpp @@ -47,7 +47,7 @@ void printf_callback(const char *buffer, unsigned int len, size_t complete, void * @return A pointer to the context properties which can be used to create an opencl context */ -void initialise_context_properties(const cl::Platform &platform, const cl::Device &device, cl_context_properties prop[7]) +void initialise_context_properties(const cl::Platform &platform, const cl::Device &device, std::array &prop) { ARM_COMPUTE_UNUSED(device); #if defined(ARM_COMPUTE_ASSERTS_ENABLED) @@ -55,7 +55,7 @@ void initialise_context_properties(const cl::Platform &platform, const cl::Devic if(arm_compute::device_supports_extension(device, "cl_arm_printf")) { // Create a cl_context with a printf_callback and user specified buffer size. - cl_context_properties properties_printf[] = + std::array properties_printf = { CL_CONTEXT_PLATFORM, reinterpret_cast(platform()), // Enable a printf callback function for this context. @@ -65,17 +65,17 @@ void initialise_context_properties(const cl::Platform &platform, const cl::Devic CL_PRINTF_BUFFERSIZE_ARM, 0x1000, 0 }; - std::copy_n(properties_printf, 7, prop); + prop = properties_printf; } else #endif // defined(ARM_COMPUTE_ASSERTS_ENABLED) { - cl_context_properties properties[] = + std::array properties = { CL_CONTEXT_PLATFORM, reinterpret_cast(platform()), 0 }; - std::copy_n(properties, 3, prop); + std::copy(properties.begin(), properties.end(), prop.begin()); }; } } //namespace @@ -94,11 +94,11 @@ create_opencl_context_and_device() std::vector platform_devices; p.getDevices(CL_DEVICE_TYPE_DEFAULT, &platform_devices); ARM_COMPUTE_ERROR_ON_MSG(platform_devices.size() == 0, "Couldn't find any OpenCL device"); - device = platform_devices[0]; - cl_int err = CL_SUCCESS; - cl_context_properties properties[7] = { 0, 0, 0, 0, 0, 0, 0 }; + device = platform_devices[0]; + cl_int err = CL_SUCCESS; + std::array properties = { 0, 0, 0, 0, 0, 0, 0 }; initialise_context_properties(p, device, properties); - cl::Context cl_context = cl::Context(device, properties, nullptr, nullptr, &err); + cl::Context cl_context = cl::Context(device, properties.data(), nullptr, nullptr, &err); ARM_COMPUTE_ERROR_ON_MSG(err != CL_SUCCESS, "Failed to create OpenCL context"); return std::make_tuple(cl_context, device, err); } -- cgit v1.2.1