Fix warnings reported by -Wconversion-null (#603)

Fix error reporting in clFillImage as a result.

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
This commit is contained in:
Kévin Petit
2020-02-21 12:21:53 +00:00
committed by GitHub
parent 170784c193
commit 3f11868e11
11 changed files with 21 additions and 21 deletions

View File

@@ -240,7 +240,7 @@ cl_int create_cl_objects(cl_device_id device_from_harness, const char** ppCodeSt
return 1; // 1 indicates do not execute, but counts as passing.
}
cl_context_properties context_properties[3] = {CL_CONTEXT_PLATFORM, (cl_context_properties)platform_id, NULL };
cl_context_properties context_properties[3] = {CL_CONTEXT_PLATFORM, (cl_context_properties)platform_id, 0 };
*context = clCreateContext(context_properties, *num_devices, &devices[0], NULL, NULL, &error);
test_error(error, "Unable to create context" );

View File

@@ -58,7 +58,7 @@ int test_create_context_from_type(cl_device_id deviceID, cl_context context, cl_
cl_context_properties properties[3] = {
(cl_context_properties)CL_CONTEXT_PLATFORM,
(cl_context_properties)platform,
NULL
0
};
context_to_test = clCreateContextFromType(properties, type, notify_callback, NULL, &error);
@@ -68,7 +68,7 @@ int test_create_context_from_type(cl_device_id deviceID, cl_context context, cl_
return -1;
}
queue_to_test = clCreateCommandQueue(context_to_test, deviceID, NULL, &error);
queue_to_test = clCreateCommandQueue(context_to_test, deviceID, 0, &error);
test_error(error, "clCreateCommandQueue failed");
if (queue_to_test == NULL) {
log_error("clCreateCommandQueue returned NULL, but error was CL_SUCCESS.");

View File

@@ -111,7 +111,7 @@ int test_get_kernel_info(cl_device_id deviceID, cl_context context, cl_command_q
return -1;
}
error = clGetKernelInfo( kernel, CL_KERNEL_FUNCTION_NAME, NULL, 0, &paramSize );
error = clGetKernelInfo( kernel, CL_KERNEL_FUNCTION_NAME, 0, NULL, &paramSize );
test_error( error, "Unable to get kernel function name param size" );
if( paramSize != strlen( "sample_test" ) + 1 )
{
@@ -157,7 +157,7 @@ int test_get_kernel_info(cl_device_id deviceID, cl_context context, cl_command_q
test_error( error, "Unable to get kernel reference count" );
error = clGetKernelInfo( kernel, CL_KERNEL_PROGRAM, NULL, 0, &paramSize );
error = clGetKernelInfo( kernel, CL_KERNEL_PROGRAM, 0, NULL, &paramSize );
test_error( error, "Unable to get kernel program param size" );
if( paramSize != sizeof( testProgram ) )
{

View File

@@ -109,7 +109,7 @@ int test_queue_properties(cl_device_id deviceID, cl_context context, cl_command_
clKernelWrapper kernel;
size_t strSize;
std::string strExt(0, '\0');
cl_queue_properties_khr device_props = NULL;
cl_queue_properties_khr device_props = 0;
cl_queue_properties_khr queue_prop_def[] = { CL_QUEUE_PROPERTIES, 0, 0 };
// Query extension

View File

@@ -172,7 +172,7 @@ int test_enqueue_map_image(cl_device_id deviceID, cl_context context, cl_command
if (!(flag_set[src_flag_id] & CL_MEM_USE_HOST_PTR) && !(flag_set[src_flag_id] & CL_MEM_COPY_HOST_PTR)) {
size_t write_origin[3]={0,0,0}, write_region[3]={imageSize, imageSize, 1};
error = clEnqueueWriteImage(queue, memObject, CL_TRUE, write_origin, write_region, NULL, NULL, initialData, 0, NULL, NULL);
error = clEnqueueWriteImage(queue, memObject, CL_TRUE, write_origin, write_region, 0, 0, initialData, 0, NULL, NULL);
test_error( error, "Unable to write to testing buffer" );
}

View File

@@ -84,7 +84,7 @@ int test_load_program_source(cl_device_id deviceID, cl_context context, cl_comma
test_error( error, "Unable to create reference program" );
/* Now get the source and compare against our original */
error = clGetProgramInfo( program, CL_PROGRAM_SOURCE, NULL, NULL, &length );
error = clGetProgramInfo( program, CL_PROGRAM_SOURCE, 0, NULL, &length );
test_error( error, "Unable to get length of first program source" );
// Note: according to spec section 5.4.5, the length returned should include the null terminator
@@ -366,7 +366,7 @@ int test_get_program_info(cl_device_id deviceID, cl_context context, cl_command_
test_error( error, "Unable to get instance count" );
/* While we're at it, test the sizes of programInfo too */
error = clGetProgramInfo( program, CL_PROGRAM_DEVICES, NULL, NULL, &paramSize );
error = clGetProgramInfo( program, CL_PROGRAM_DEVICES, 0, NULL, &paramSize );
test_error( error, "Unable to get device param size" );
if( paramSize != sizeof( cl_device_id ) )
{
@@ -374,7 +374,7 @@ int test_get_program_info(cl_device_id deviceID, cl_context context, cl_command_
return -1;
}
error = clGetProgramInfo( program, CL_PROGRAM_CONTEXT, NULL, NULL, &paramSize );
error = clGetProgramInfo( program, CL_PROGRAM_CONTEXT, 0, NULL, &paramSize );
test_error( error, "Unable to get context param size" );
if( paramSize != sizeof( cl_context ) )
{
@@ -382,7 +382,7 @@ int test_get_program_info(cl_device_id deviceID, cl_context context, cl_command_
return -1;
}
error = clGetProgramInfo( program, CL_PROGRAM_REFERENCE_COUNT, NULL, NULL, &paramSize );
error = clGetProgramInfo( program, CL_PROGRAM_REFERENCE_COUNT, 0, NULL, &paramSize );
test_error( error, "Unable to get instance param size" );
if( paramSize != sizeof( cl_uint ) )
{
@@ -390,7 +390,7 @@ int test_get_program_info(cl_device_id deviceID, cl_context context, cl_command_
return -1;
}
error = clGetProgramInfo( program, CL_PROGRAM_NUM_DEVICES, NULL, NULL, &paramSize );
error = clGetProgramInfo( program, CL_PROGRAM_NUM_DEVICES, 0, NULL, &paramSize );
test_error( error, "Unable to get device count param size" );
if( paramSize != sizeof( cl_uint ) )
{
@@ -421,7 +421,7 @@ int test_get_program_source(cl_device_id deviceID, cl_context context, cl_comman
}
/* Try getting the length */
error = clGetProgramInfo( program, CL_PROGRAM_SOURCE, NULL, NULL, &length );
error = clGetProgramInfo( program, CL_PROGRAM_SOURCE, 0, NULL, &length );
test_error( error, "Unable to get program source length" );
if (length != strlen(sample_kernel_code_single_line[0]) + 1 && gCompilationMode == kOnline)
{
@@ -556,7 +556,7 @@ int test_get_program_build_info(cl_device_id deviceID, cl_context context, cl_co
return -1;
}
error = clGetProgramBuildInfo( program, deviceID, CL_PROGRAM_BUILD_OPTIONS, NULL, NULL, &length );
error = clGetProgramBuildInfo( program, deviceID, CL_PROGRAM_BUILD_OPTIONS, 0, NULL, &length );
test_error( error, "Unable to get program build options" );
buffer = (char*)malloc(length);

View File

@@ -75,5 +75,5 @@ const int test_num = ARRAY_SIZE( test_list );
int main(int argc, const char *argv[])
{
return runTestHarness(argc, argv, test_num, test_list, false, false, NULL);
return runTestHarness(argc, argv, test_num, test_list, false, false, 0);
}

View File

@@ -431,7 +431,7 @@ int test_fill_image_generic( cl_context context, cl_command_queue queue, image_d
if (error != CL_SUCCESS)
{
log_error( "ERROR: Unable to map image for verification: %s\n", IGetErrorString( error ) );
return NULL;
return -1;
}
// Verify scanline by scanline, since the pitches are different
@@ -560,7 +560,7 @@ int test_fill_image_generic( cl_context context, cl_command_queue queue, image_d
if (error != CL_SUCCESS)
{
log_error( "ERROR: Unable to unmap image after verify: %s\n", IGetErrorString( error ) );
return NULL;
return -1;
}
imgHost.reset(0x0);

View File

@@ -250,9 +250,9 @@ static int kernelFilter( cl_device_id device, cl_context context, cl_command_que
}
#ifdef USE_LOCAL_THREADS
err = clEnqueueNDRangeKernel( queue, kernel[0], 2, NULL, threads, localThreads, NULL, 0, &executeEvent );
err = clEnqueueNDRangeKernel( queue, kernel[0], 2, NULL, threads, localThreads, 0, NULL, &executeEvent );
#else
err = clEnqueueNDRangeKernel( queue, kernel[0], 2, NULL, threads, NULL, NULL, 0, &executeEvent );
err = clEnqueueNDRangeKernel( queue, kernel[0], 2, NULL, threads, NULL, 0, NULL, &executeEvent );
#endif
if( err != CL_SUCCESS ){

View File

@@ -160,7 +160,7 @@ static int run_kernel( cl_device_id device, cl_context context, cl_command_queue
return -1;
}
err = clEnqueueNDRangeKernel( queue, kernel[0], 3, NULL, threads, localThreads, NULL, 0, &executeEvent );
err = clEnqueueNDRangeKernel( queue, kernel[0], 3, NULL, threads, localThreads, 0, NULL, &executeEvent );
if( err != CL_SUCCESS ){
print_error( err, "clEnqueueNDRangeKernel failed\n" );

View File

@@ -59,6 +59,6 @@ static test_status checkSubGroupsExtension(cl_device_id device)
int main(int argc, const char *argv[])
{
gMTdata = init_genrand(0);
return runTestHarnessWithCheck(argc, argv, test_num, test_list, false, false, NULL, checkSubGroupsExtension);
return runTestHarnessWithCheck(argc, argv, test_num, test_list, false, false, 0, checkSubGroupsExtension);
}