integer_ops: fix -Wformat warnings (#1860)

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
2023-12-20 17:57:35 +01:00
committed by GitHub
parent 47d5d371cd
commit b36b2d592c
11 changed files with 437 additions and 126 deletions

View File

@@ -20,6 +20,8 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <cinttypes>
#include "procs.h"
template <class Integer>
@@ -43,7 +45,12 @@ static int verify_absdiff_char( const void *p, const void *q, const void *r, siz
{
cl_uchar r = abs_diff(inA[i], inB[i]);
if( r != outptr[i] )
{ log_info( "%ld) Failure for absdiff( (char%s) 0x%2.2x, (char%s) 0x%2.2x) = *0x%2.2x vs 0x%2.2x\n", i, sizeName, inA[i], sizeName, inB[i], r, outptr[i] ); return -1; }
{
log_info("%zu) Failure for absdiff( (char%s) 0x%2.2x, (char%s) "
"0x%2.2x) = *0x%2.2x vs 0x%2.2x\n",
i, sizeName, inA[i], sizeName, inB[i], r, outptr[i]);
return -1;
}
}
return 0;
}
@@ -58,7 +65,12 @@ static int verify_absdiff_uchar( const void *p, const void *q, const void *r, si
{
cl_uchar r = abs_diff(inA[i], inB[i]);
if( r != outptr[i] )
{ log_info( "%ld) Failure for absdiff( (uchar%s) 0x%2.2x, (uchar%s) 0x%2.2x) = *0x%2.2x vs 0x%2.2x\n", i, sizeName, inA[i], sizeName, inB[i], r, outptr[i] ); return -1; }
{
log_info("%zu) Failure for absdiff( (uchar%s) 0x%2.2x, (uchar%s) "
"0x%2.2x) = *0x%2.2x vs 0x%2.2x\n",
i, sizeName, inA[i], sizeName, inB[i], r, outptr[i]);
return -1;
}
}
return 0;
}
@@ -73,7 +85,12 @@ static int verify_absdiff_short( const void *p, const void *q, const void *r, si
{
cl_ushort r = abs_diff(inA[i], inB[i]);
if( r != outptr[i] )
{ log_info( "%ld) Failure for absdiff( (short%s) 0x%4.4x, (short%s) 0x%4.4x) = *0x%4.4x vs 0x%4.4x\n", i, sizeName, inA[i], sizeName, inB[i], r, outptr[i] ); return -1; }
{
log_info("%zu) Failure for absdiff( (short%s) 0x%4.4x, (short%s) "
"0x%4.4x) = *0x%4.4x vs 0x%4.4x\n",
i, sizeName, inA[i], sizeName, inB[i], r, outptr[i]);
return -1;
}
}
return 0;
}
@@ -88,7 +105,12 @@ static int verify_absdiff_ushort( const void *p, const void *q, const void *r, s
{
cl_ushort r = abs_diff(inA[i], inB[i]);
if( r != outptr[i] )
{ log_info( "%ld) Failure for absdiff( (ushort%s) 0x%4.4x, (ushort%s) 0x%4.4x) = *0x%4.4x vs 0x%4.4x\n", i, sizeName, inA[i], sizeName, inB[i], r, outptr[i] ); return -1; }
{
log_info("%zu) Failure for absdiff( (ushort%s) 0x%4.4x, (ushort%s) "
"0x%4.4x) = *0x%4.4x vs 0x%4.4x\n",
i, sizeName, inA[i], sizeName, inB[i], r, outptr[i]);
return -1;
}
}
return 0;
}
@@ -104,7 +126,9 @@ static int verify_absdiff_int( const void *p, const void *q, const void *r, size
cl_uint r = abs_diff(inA[i], inB[i]);
if( r != outptr[i] )
{
log_info( "%ld) Failure for absdiff( (int%s) 0x%8.8x, (int%s) 0x%8.8x) = *0x%8.8x vs 0x%8.8x\n", i, sizeName, inA[i], sizeName, inB[i], r, outptr[i] );
log_info("%zu) Failure for absdiff( (int%s) 0x%8.8x, (int%s) "
"0x%8.8x) = *0x%8.8x vs 0x%8.8x\n",
i, sizeName, inA[i], sizeName, inB[i], r, outptr[i]);
return -1;
}
}
@@ -121,7 +145,12 @@ static int verify_absdiff_uint( const void *p, const void *q, const void *r, siz
{
cl_uint r = abs_diff(inA[i], inB[i]);
if( r != outptr[i] )
{ log_info( "%ld) Failure for absdiff( (uint%s) 0x%8.8x, (uint%s) 0x%8.8x) = *0x%8.8x vs 0x%8.8x\n", i, sizeName, inA[i], sizeName, inB[i], r, outptr[i] ); return -1; }
{
log_info("%zu) Failure for absdiff( (uint%s) 0x%8.8x, (uint%s) "
"0x%8.8x) = *0x%8.8x vs 0x%8.8x\n",
i, sizeName, inA[i], sizeName, inB[i], r, outptr[i]);
return -1;
}
}
return 0;
}
@@ -136,7 +165,13 @@ static int verify_absdiff_long( const void *p, const void *q, const void *r, siz
{
cl_ulong r = abs_diff(inA[i], inB[i]);
if( r != outptr[i] )
{ log_info( "%ld) Failure for absdiff( (long%s) 0x%16.16llx, (long%s) 0x%16.16llx) = *0x%16.16llx vs 0x%16.16llx\n", i, sizeName, inA[i], sizeName, inB[i], r, outptr[i] ); return -1; }
{
log_info("%zu) Failure for absdiff( (long%s) 0x%16.16" PRIx64
", (long%s) 0x%16.16" PRIx64 ") = *0x%16.16" PRIx64
" vs 0x%16.16" PRIx64 "\n",
i, sizeName, inA[i], sizeName, inB[i], r, outptr[i]);
return -1;
}
}
return 0;
}
@@ -151,7 +186,13 @@ static int verify_absdiff_ulong( const void *p, const void *q, const void *r, si
{
cl_ulong r = abs_diff(inA[i], inB[i]);
if( r != outptr[i] )
{ log_info( "%ld) Failure for absdiff( (ulong%s) 0x%16.16llx, (ulong%s) 0x%16.16llx) = *0x%16.16llx vs 0x%16.16llx\n", i, sizeName, inA[i], sizeName, inB[i], r, outptr[i] ); return -1; }
{
log_info("%zu) Failure for absdiff( (ulong%s) 0x%16.16" PRIx64
", (ulong%s) 0x%16.16" PRIx64 ") = *0x%16.16" PRIx64
" vs 0x%16.16" PRIx64 "\n",
i, sizeName, inA[i], sizeName, inB[i], r, outptr[i]);
return -1;
}
}
return 0;
}