[NFCI] Remove unused variables and enable -Wunused-variable (#1483)

Remove unused variables throughout the code base and enable the
`-Wunused-variable` warning flag globally to prevent new unused
variable issues being introduced in the future.

This is mostly a non-functional change, with one exception:

 - In `test_conformance/api/test_kernel_arg_info.cpp`, an error check
   of the clGetDeviceInfo return value was added.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
This commit is contained in:
Sven van Haastregt
2022-09-08 12:54:36 +01:00
committed by GitHub
parent fec9d9a238
commit 6554c49018
49 changed files with 29 additions and 112 deletions

View File

@@ -81,7 +81,6 @@ int test_read_image_1D(cl_context context, cl_command_queue queue,
for( size_t lod = 0; (gTestMipmaps && lod < imageInfo->num_mip_levels) || (!gTestMipmaps && lod < 1); lod++)
{
float lod_float = (float) lod;
origin[1] = lod;
size_t width_lod, row_pitch_lod;

View File

@@ -82,7 +82,6 @@ int test_read_image_1D_array(cl_context context, cl_command_queue queue,
for( size_t lod = 0; (gTestMipmaps && lod < imageInfo->num_mip_levels) || (!gTestMipmaps && lod < 1); lod++)
{
float lod_float = (float) lod;
size_t width_lod, row_pitch_lod, slice_pitch_lod;
if( gTestMipmaps )
origin[2] = lod;

View File

@@ -81,7 +81,6 @@ int test_read_image_2D(cl_context context, cl_command_queue queue,
for( size_t lod = 0; (gTestMipmaps && lod < imageInfo->num_mip_levels) || (!gTestMipmaps && lod < 1); lod++)
{
float lod_float = (float) lod;
origin[2] = lod;
size_t width_lod, height_lod, row_pitch_lod;

View File

@@ -83,9 +83,8 @@ int test_read_image_2D_array(cl_context context, cl_command_queue queue,
for(size_t lod = 0; (gTestMipmaps && lod < imageInfo->num_mip_levels) || (!gTestMipmaps && lod < 1); lod++)
{
float lod_float = (float) lod;
origin[3] = lod;
size_t width_lod, height_lod, depth_lod, row_pitch_lod, slice_pitch_lod;
size_t width_lod, height_lod, row_pitch_lod, slice_pitch_lod;
width_lod = (imageInfo->width >> lod) ? (imageInfo->width >> lod) : 1;
height_lod = (imageInfo->height >> lod) ? (imageInfo->height >> lod) : 1;

View File

@@ -83,7 +83,6 @@ int test_read_image_3D(cl_context context, cl_command_queue queue,
for(size_t lod = 0; (gTestMipmaps && lod < imageInfo->num_mip_levels) || (!gTestMipmaps && lod < 1); lod++)
{
float lod_float = (float) lod;
origin[3] = lod;
size_t width_lod, height_lod, depth_lod, row_pitch_lod, slice_pitch_lod;

View File

@@ -17,5 +17,15 @@ set(${MODULE_NAME}_SOURCES
../common.cpp
)
# Make unused variables not fatal in this module; see
# https://github.com/KhronosGroup/OpenCL-CTS/issues/1484
if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang")
SET_SOURCE_FILES_PROPERTIES(
${${MODULE_NAME}_SOURCES}
PROPERTIES
COMPILE_FLAGS "-Wno-error=unused-variable"
)
endif()
include(../../CMakeCommon.txt)