basic: fix size_t Wformat warnings (#2264)

Printing of a `size_t` requires the `%zu` specifier.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
This commit is contained in:
Sven van Haastregt
2025-02-18 18:11:32 +01:00
committed by GitHub
parent 9c5999bc1d
commit ea934a7648
11 changed files with 113 additions and 81 deletions

View File

@@ -189,7 +189,7 @@ int test_sizeof(cl_device_id device, cl_context context, cl_command_queue queue,
}
char name[32];
sprintf( name, "%s%ld", vector_table[i].name, j );
sprintf(name, "%s%zu", vector_table[i].name, j);
test = CL_ULONG_MAX;
err = get_type_size( context, queue, name, &test, device );
@@ -197,12 +197,16 @@ int test_sizeof(cl_device_id device, cl_context context, cl_command_queue queue,
return err;
if( test != j * vector_table[i].size )
{
log_error( "\nFAILED: Type %s has size %lld, but expected size %lld!\n", name, test, j * vector_table[i].size );
log_error(
"\nFAILED: Type %s has size %lld, but expected size %zu!\n",
name, test, j * vector_table[i].size);
return -1;
}
if( test != j * vector_table[i].cl_size )
{
log_error( "\nFAILED: Type %s has size %lld, but cl_ size is %lld!\n", name, test, j * vector_table[i].cl_size );
log_error(
"\nFAILED: Type %s has size %lld, but cl_ size is %zu!\n",
name, test, j * vector_table[i].cl_size);
return -2;
}
log_info( "%16s", name );
@@ -317,7 +321,7 @@ int test_sizeof(cl_device_id device, cl_context context, cl_command_queue queue,
for( j = 2; j <= 16; j *= 2 )
{
char name[32];
sprintf( name, "double%ld", j );
sprintf(name, "double%zu", j);
test = CL_ULONG_MAX;
err = get_type_size( context, queue, name, &test, device );
@@ -325,7 +329,8 @@ int test_sizeof(cl_device_id device, cl_context context, cl_command_queue queue,
return err;
if( test != 8*j )
{
log_error( "\nFAILED: %s has size %lld, but must be %ld!\n", name, test, 8 * j);
log_error("\nFAILED: %s has size %lld, but must be %zu!\n",
name, test, 8 * j);
return -1;
}
log_info( "%16s", name );
@@ -352,7 +357,7 @@ int test_sizeof(cl_device_id device, cl_context context, cl_command_queue queue,
for( j = 2; j <= 16; j *= 2 )
{
char name[32];
sprintf( name, "half%ld", j );
sprintf(name, "half%zu", j);
test = CL_ULONG_MAX;
err = get_type_size( context, queue, name, &test, device );
@@ -360,7 +365,8 @@ int test_sizeof(cl_device_id device, cl_context context, cl_command_queue queue,
return err;
if( test != 2*j )
{
log_error( "\nFAILED: %s has size %lld, but must be %ld!\n", name, test, 2 * j);
log_error("\nFAILED: %s has size %lld, but must be %zu!\n",
name, test, 2 * j);
return -1;
}
log_info( "%16s", name );