api: fix -Wformat warnings (#2025)

The main sources of warnings were:

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

 * Printing of `cl_long`/`cl_ulong` which is now done using the `PRI*64`
macros to ensure portability across 32 and 64-bit builds.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
This commit is contained in:
Sven van Haastregt
2024-09-02 12:02:28 +02:00
committed by GitHub
parent a7162188d6
commit 90f523ea57
8 changed files with 126 additions and 94 deletions

View File

@@ -19,6 +19,7 @@
#include <stdlib.h>
#include <ctype.h>
#include <algorithm>
#include <cinttypes>
#include <vector>
int test_get_platform_info(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
@@ -237,7 +238,7 @@ int test_sampler_params(cl_device_id deviceID, cl_context context,
if (set_size != 0)
{
log_error(
"ERROR: CL_SAMPLER_PROPERTIES size is %d, expected 0\n",
"ERROR: CL_SAMPLER_PROPERTIES size is %zu, expected 0\n",
set_size);
return TEST_FAIL;
}
@@ -248,7 +249,7 @@ int test_sampler_params(cl_device_id deviceID, cl_context context,
!= test_properties.size() * sizeof(cl_sampler_properties))
{
log_error(
"ERROR: CL_SAMPLER_PROPERTIES size is %d, expected %d.\n",
"ERROR: CL_SAMPLER_PROPERTIES size is %zu, expected %zu.\n",
set_size,
test_properties.size() * sizeof(cl_sampler_properties));
return TEST_FAIL;
@@ -380,7 +381,8 @@ int check_get_command_queue_info_params(cl_device_id deviceID,
clGetDeviceInfo(deviceID, host_queue_query, sizeof(host_queue_props),
&host_queue_props, NULL);
test_error(error, "clGetDeviceInfo failed");
log_info("CL_DEVICE_QUEUE_ON_HOST_PROPERTIES is %d\n", host_queue_props);
log_info("CL_DEVICE_QUEUE_ON_HOST_PROPERTIES is %" PRIu64 "\n",
host_queue_props);
cl_queue_properties device_queue_props = 0;
if (version >= Version(2, 0))
@@ -389,7 +391,7 @@ int check_get_command_queue_info_params(cl_device_id deviceID,
sizeof(device_queue_props), &device_queue_props,
NULL);
test_error(error, "clGetDeviceInfo failed");
log_info("CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES is %d\n",
log_info("CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES is %" PRIu64 "\n",
device_queue_props);
}