harness: Fix -Wformat warnings (#1527)

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>

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
This commit is contained in:
Sven van Haastregt
2022-10-13 10:02:40 +01:00
committed by GitHub
parent 4b39b59469
commit f6a963a583
4 changed files with 14 additions and 11 deletions

View File

@@ -23,6 +23,7 @@
#include <malloc.h>
#endif
#include <algorithm>
#include <cinttypes>
#include <iterator>
#if !defined(_WIN32)
#include <cmath>
@@ -421,7 +422,7 @@ void print_first_pixel_difference_error(size_t where, const char *sourcePixel,
(int)thirdDim, (int)imageInfo->rowPitch,
(int)imageInfo->rowPitch
- (int)imageInfo->width * (int)pixel_size);
log_error("Failed at column: %ld ", where);
log_error("Failed at column: %zu ", where);
switch (pixel_size)
{
@@ -454,7 +455,7 @@ void print_first_pixel_difference_error(size_t where, const char *sourcePixel,
((cl_ushort *)destPixel)[1], ((cl_ushort *)destPixel)[2]);
break;
case 8:
log_error("*0x%16.16llx vs. 0x%16.16llx\n",
log_error("*0x%16.16" PRIx64 " vs. 0x%16.16" PRIx64 "\n",
((cl_ulong *)sourcePixel)[0], ((cl_ulong *)destPixel)[0]);
break;
case 12:
@@ -473,7 +474,7 @@ void print_first_pixel_difference_error(size_t where, const char *sourcePixel,
((cl_uint *)destPixel)[2], ((cl_uint *)destPixel)[3]);
break;
default:
log_error("Don't know how to print pixel size of %ld\n",
log_error("Don't know how to print pixel size of %zu\n",
pixel_size);
break;
}