[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

@@ -32,7 +32,11 @@ struct format {
};
// These are the typically tested formats.
// TODO: These variables should be made const; until then, suppress unused
// variable warnings as not every translation unit including this header uses
// all variables.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-variable"
static struct format common_formats[] = {
#ifdef __APPLE__
{ GL_RGBA8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, kUChar },
@@ -60,6 +64,7 @@ static struct format depth_formats[] = {
{ GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, kFloat },
};
#endif
#pragma GCC diagnostic pop
int test_images_write_common(cl_device_id device, cl_context context,
cl_command_queue queue, struct format* formats, size_t nformats,

View File

@@ -337,7 +337,6 @@ int test_image_methods_depth( cl_device_id device, cl_context context, cl_comman
return 0;
}
size_t pixelSize;
int result = 0;
GLenum depth_targets[] = {GL_TEXTURE_2D, GL_TEXTURE_2D_ARRAY};
size_t ntargets = sizeof(depth_targets) / sizeof(depth_targets[0]);
@@ -378,7 +377,6 @@ int test_image_methods_multisample( cl_device_id device, cl_context context, cl_
return 0;
}
size_t pixelSize;
int result = 0;
GLenum targets[] = {GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_2D_MULTISAMPLE_ARRAY};
size_t ntargets = sizeof(targets) / sizeof(targets[0]);

View File

@@ -427,7 +427,6 @@ static int test_image_write( cl_context context, cl_command_queue queue,
int supportsHalf(cl_context context, bool* supports_half)
{
int error;
size_t size;
cl_uint numDev;
error = clGetContextInfo(context, CL_CONTEXT_NUM_DEVICES, sizeof(cl_uint), &numDev, NULL);
@@ -446,7 +445,6 @@ int supportsHalf(cl_context context, bool* supports_half)
int supportsMsaa(cl_context context, bool* supports_msaa)
{
int error;
size_t size;
cl_uint numDev;
error = clGetContextInfo(context, CL_CONTEXT_NUM_DEVICES, sizeof(cl_uint), &numDev, NULL);
@@ -465,7 +463,6 @@ int supportsMsaa(cl_context context, bool* supports_msaa)
int supportsDepth(cl_context context, bool* supports_depth)
{
int error;
size_t size;
cl_uint numDev;
error = clGetContextInfo(context, CL_CONTEXT_NUM_DEVICES, sizeof(cl_uint), &numDev, NULL);
@@ -486,7 +483,6 @@ static int test_image_format_write( cl_context context, cl_command_queue queue,
GLenum internalFormat, GLenum glType, ExplicitType type, MTdata d )
{
int error;
int samples = 8;
// If we're testing a half float format, then we need to determine the
// rounding mode of this machine. Punt if we fail to do so.