mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Fix more Wformat warnings related to size_t (#2166)
Printing of a `size_t` requires the `%zu` specifier. This fixes occurrences where the previous wrong specifier appears to work in a typical 64-bit build, but causes a Wformat warning in 32-bit builds. --------- Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
This commit is contained in:
committed by
GitHub
parent
d99b302f90
commit
56d383b2e9
@@ -180,7 +180,7 @@ TestItem *CreateTestItem( cl_device_id deviceID, cl_int *err )
|
||||
{
|
||||
if( err )
|
||||
{
|
||||
log_error("FAILURE: clCreateBuffer( %ld bytes ) failed in "
|
||||
log_error("FAILURE: clCreateBuffer( %zu bytes ) failed in "
|
||||
"CreateTestItem: %d\n",
|
||||
TEST_SIZE * sizeof(cl_uint), error);
|
||||
*err = error;
|
||||
@@ -294,7 +294,8 @@ cl_int UseTestItem( const TestItem *item, cl_int *err )
|
||||
{
|
||||
if( err )
|
||||
{
|
||||
log_error( "FAILURE to set arg 0 for kernel # %ld : %d\n", j, error );
|
||||
log_error("FAILURE to set arg 0 for kernel # %zu : %d\n", j,
|
||||
error);
|
||||
*err = error;
|
||||
}
|
||||
return error;
|
||||
@@ -305,7 +306,9 @@ cl_int UseTestItem( const TestItem *item, cl_int *err )
|
||||
{
|
||||
if( err )
|
||||
{
|
||||
log_error( "FAILURE: Unable to set arg 1 for kernel # %ld : %d\n", j, error );
|
||||
log_error(
|
||||
"FAILURE: Unable to set arg 1 for kernel # %zu : %d\n", j,
|
||||
error);
|
||||
*err = error;
|
||||
}
|
||||
return error;
|
||||
@@ -318,7 +321,8 @@ cl_int UseTestItem( const TestItem *item, cl_int *err )
|
||||
{
|
||||
if( err )
|
||||
{
|
||||
log_error( "FAILURE: Unable to enqueue kernel %ld: %d\n", j, error );
|
||||
log_error("FAILURE: Unable to enqueue kernel %zu: %d\n", j,
|
||||
error);
|
||||
*err = error;
|
||||
}
|
||||
return error;
|
||||
@@ -360,7 +364,9 @@ cl_int UseTestItem( const TestItem *item, cl_int *err )
|
||||
cl_uint result = mapped[i];
|
||||
if( expected != result )
|
||||
{
|
||||
log_error( "FAILURE: Sample data at position %ld does not match expected result: *0x%8.8x vs. 0x%8.8x\n", i, expected, result );
|
||||
log_error("FAILURE: Sample data at position %zu does not "
|
||||
"match expected result: *0x%8.8x vs. 0x%8.8x\n",
|
||||
i, expected, result);
|
||||
if( err )
|
||||
*err = -1;
|
||||
return -1;
|
||||
@@ -441,16 +447,17 @@ int test_context_multiple_contexts_same_device(cl_device_id deviceID, size_t max
|
||||
// Check to make sure we made the minimum amount
|
||||
if( i < minCount )
|
||||
{
|
||||
log_error( "FAILURE: only could make %ld of %ld contexts!\n", i, minCount );
|
||||
log_error("FAILURE: only could make %zu of %zu contexts!\n", i,
|
||||
minCount);
|
||||
err = -1;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// Report how many contexts we made
|
||||
if( i == maxCount )
|
||||
log_info( "Successfully created all %lu contexts.\n", i );
|
||||
log_info("Successfully created all %zu contexts.\n", i);
|
||||
else
|
||||
log_info( "Successfully created %lu contexts out of %lu\n", i, maxCount );
|
||||
log_info("Successfully created %zu contexts out of %zu\n", i, maxCount);
|
||||
|
||||
// Set the count to be the number we succesfully made
|
||||
maxCount = i;
|
||||
|
||||
@@ -53,22 +53,27 @@ int test_device_set(size_t deviceCount, size_t queueCount, cl_device_id *devices
|
||||
RandomSeed seed( gRandomSeed );
|
||||
|
||||
if (deviceCount > MAX_DEVICES) {
|
||||
log_error("Number of devices in set (%ld) is greater than the number for which the test was written (%d).", deviceCount, MAX_DEVICES);
|
||||
return -1;
|
||||
log_error("Number of devices in set (%zu) is greater than the number "
|
||||
"for which the test was written (%d).",
|
||||
deviceCount, MAX_DEVICES);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (queueCount > MAX_QUEUES) {
|
||||
log_error("Number of queues (%ld) is greater than the number for which the test was written (%d).", queueCount, MAX_QUEUES);
|
||||
return -1;
|
||||
log_error("Number of queues (%zu) is greater than the number for which "
|
||||
"the test was written (%d).",
|
||||
queueCount, MAX_QUEUES);
|
||||
return -1;
|
||||
}
|
||||
|
||||
log_info("Testing with %ld queues on %ld devices, %ld kernel executions.\n", queueCount, deviceCount, queueCount*num_elements/TEST_SIZE);
|
||||
log_info("Testing with %zu queues on %zu devices, %zu kernel executions.\n",
|
||||
queueCount, deviceCount, queueCount * num_elements / TEST_SIZE);
|
||||
|
||||
for (i=0; i<deviceCount; i++) {
|
||||
char deviceName[4096] = "";
|
||||
error = clGetDeviceInfo(devices[i], CL_DEVICE_NAME, sizeof(deviceName), deviceName, NULL);
|
||||
test_error(error, "clGetDeviceInfo CL_DEVICE_NAME failed");
|
||||
log_info("Device %ld is \"%s\".\n", i, deviceName);
|
||||
log_info("Device %zu is \"%s\".\n", i, deviceName);
|
||||
}
|
||||
|
||||
/* Create a context */
|
||||
@@ -158,14 +163,19 @@ int test_device_set(size_t deviceCount, size_t queueCount, cl_device_id *devices
|
||||
{
|
||||
if( expectedResults[ i ] != outputData[ i ] )
|
||||
{
|
||||
log_error( "ERROR: Sample data did not verify for queue %d on device %ld (sample %d, expected %d, got %d)\n",
|
||||
q, q % deviceCount, (int)i, expectedResults[ i ], outputData[ i ] );
|
||||
for (size_t j=0; j<deviceCount; j++) {
|
||||
if (expectedResultsOneDevice[j][i] == outputData[i])
|
||||
log_info("Sample consistent with only device %ld having modified the data.\n", j);
|
||||
}
|
||||
errorsThisTime++;
|
||||
break;
|
||||
log_error("ERROR: Sample data did not verify for queue %d on device "
|
||||
"%zu (sample %d, expected %d, got %d)\n",
|
||||
q, q % deviceCount, (int)i, expectedResults[i],
|
||||
outputData[i]);
|
||||
for (size_t j = 0; j < deviceCount; j++)
|
||||
{
|
||||
if (expectedResultsOneDevice[j][i] == outputData[i])
|
||||
log_info("Sample consistent with only device %zu having "
|
||||
"modified the data.\n",
|
||||
j);
|
||||
}
|
||||
errorsThisTime++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (errorsThisTime)
|
||||
|
||||
Reference in New Issue
Block a user