half: fix -Wformat warnings (#1927)

Avoid casting to `uint64_t` in some places; instead keep the types as
`size_t` and use the `%z` length modifier, or as
`uint32_t` and use the `%u` specifier.

For printing of 64-bit types, use the `PRI*64` macros from <cinttypes>
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-03-27 14:46:27 +01:00
committed by GitHub
parent 96361171ed
commit 83203db6e2
4 changed files with 26 additions and 10 deletions

View File

@@ -433,7 +433,7 @@ int Test_vStoreHalf_private(cl_device_id device, f2h referenceFunc,
};
char local_buf_size[10];
sprintf(local_buf_size, "%lld", (uint64_t)gWorkGroupSize);
sprintf(local_buf_size, "%zu", gWorkGroupSize);
const char *source_local_store[] = {
@@ -1308,7 +1308,7 @@ int Test_vStoreaHalf_private(cl_device_id device, f2h referenceFunc,
};
char local_buf_size[10];
sprintf(local_buf_size, "%lld", (uint64_t)gWorkGroupSize);
sprintf(local_buf_size, "%zu", gWorkGroupSize);
const char *source_local[] = { "__kernel void test( __global float",
vector_size_name_extensions[vectorSize],
" *p, __global half *f )\n"