[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

@@ -49,8 +49,6 @@ static const char *fpmul_kernel_code =
"}\n";
static const float MAX_ERR = 1e-5f;
static int
verify_fpadd(float *inptrA, float *inptrB, float *outptr, int n)
{

View File

@@ -43,8 +43,6 @@ static const unsigned int out_vector_idx[] = { 0, 0, 1, 1, 3, 4};
// input type name is strcat(gentype, vector_size_names[i]);
// and output type name is
// strcat(gentype, vector_size_names[out_vector_idx[i]]);
static const int size_to_idx[] = {-1,0,1,2,3,-1,-1,-1,4,
-1,-1,-1,-1,-1,-1,-1,5};
static const char *vector_size_names[] = { "", "2", "3", "4", "8", "16"};
static const size_t kSizes[] = { 1, 1, 2, 2, 4, 4, 8, 8, 4, 8 };

View File

@@ -32,8 +32,6 @@ const char *hostptr_kernel_code =
" dst[tid] = srcA[tid] + srcB[tid];\n"
"}\n";
static const float MAX_ERR = 1e-5f;
static int verify_hostptr(cl_float *inptrA, cl_float *inptrB, cl_float *outptr, int n)
{
cl_float r;

View File

@@ -97,10 +97,10 @@ int test_kernel_preprocessor_macros(cl_device_id deviceID, cl_context context, c
char programSource[4096];
char curFileName[512];
char *programPtr = programSource;
int i = 0;
snprintf(curFileName, 512, "%s", __FILE__);
#ifdef _WIN32
// Replace "\" with "\\"
int i = 0;
while(curFileName[i] != '\0') {
if (curFileName[i] == '\\') {
int j = i + 1;

View File

@@ -1642,8 +1642,6 @@ int test_progvar_func_scope(cl_device_id device, cl_context context, cl_command_
"supported on this device\n");
return TEST_SKIPPED_ITSELF;
}
size_t max_size = 0;
size_t pref_size = 0;
cl_int err = CL_SUCCESS;

View File

@@ -48,13 +48,9 @@ static const char *fpmul_kernel_code =
" dst[tid] = srcA[tid] * srcB[tid];\n"
"}\n";
static const float MAX_ERR = 1e-5f;
static int
verify_fpadd(float *inptrA, float *inptrB, float *outptr, int n, int fileNum)
{
float r;
int i;
float * reference_ptr = (float *)malloc(n * sizeof(float));
@@ -82,7 +78,6 @@ verify_fpadd(float *inptrA, float *inptrB, float *outptr, int n, int fileNum)
static int
verify_fpsub(float *inptrA, float *inptrB, float *outptr, int n, int fileNum)
{
float r;
int i;
float * reference_ptr = (float *)malloc(n * sizeof(float));
@@ -110,7 +105,6 @@ verify_fpsub(float *inptrA, float *inptrB, float *outptr, int n, int fileNum)
static int
verify_fpmul(float *inptrA, float *inptrB, float *outptr, int n, int fileNum)
{
float r;
int i;
float * reference_ptr = (float *)malloc(n * sizeof(float));

View File

@@ -142,7 +142,7 @@ int test_readimage3d(cl_device_id device, cl_context context, cl_command_queue q
int img_width = 64;
int img_height = 64;
int img_depth = 64;
int i, err;
int err;
size_t origin[3] = {0, 0, 0};
size_t region[3] = {img_width, img_height, img_depth};
size_t length = img_width * img_height * img_depth * 4 * sizeof(float);