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

@@ -17,6 +17,7 @@
#include "harness/conversions.h"
#include <algorithm>
#include <cinttypes>
#define TEST_SIZE 512
@@ -198,13 +199,23 @@ int test_single_param_integer_kernel(cl_command_queue queue, cl_context context,
case 8:
if( useOpKernel )
log_error( "ERROR: Data sample %d:%d does not validate! Expected (0x%16.16llx), got (0x%16.16llx), sources (0x%16.16llx, 0x%16.16llx)\n",
(int)i, (int)j, ((cl_ulong*)&expected)[0], *( (cl_ulong *)p ),
*( (cl_ulong *)in ), *( (cl_ulong *)in2 ) );
log_error("ERROR: Data sample %d:%d does not "
"validate! Expected (0x%16.16" PRIx64
"), got (0x%16.16" PRIx64
"), sources (0x%16.16" PRIx64
", 0x%16.16" PRIx64 ")\n",
(int)i, (int)j,
((cl_ulong *)&expected)[0],
*((cl_ulong *)p), *((cl_ulong *)in),
*((cl_ulong *)in2));
else
log_error( "ERROR: Data sample %d:%d does not validate! Expected (0x%16.16llx), got (0x%16.16llx), sources (0x%16.16llx)\n",
(int)i, (int)j, ((cl_ulong*)&expected)[0], *( (cl_ulong *)p ),
*( (cl_ulong *)in ) );
log_error("ERROR: Data sample %d:%d does not "
"validate! Expected (0x%16.16" PRIx64
"), got (0x%16.16" PRIx64
"), sources (0x%16.16" PRIx64 ")\n",
(int)i, (int)j,
((cl_ulong *)&expected)[0],
*((cl_ulong *)p), *((cl_ulong *)in));
break;
}
return -1;
@@ -750,10 +761,14 @@ int test_two_param_integer_kernel(cl_command_queue queue, cl_context context, co
break;
case 8:
log_error( "ERROR: Data sample %d:%d does not validate! Expected (0x%16.16llx), got (0x%16.16llx), sources (0x%16.16llx, 0x%16.16llx)\n",
(int)i, (int)j, ((cl_ulong*)&expected)[ 0 ], *( (cl_ulong *)out ),
*( (cl_ulong *)inA ),
*( (cl_ulong *)inB ) );
log_error("ERROR: Data sample %d:%d does not validate! "
"Expected (0x%16.16" PRIx64
"), got (0x%16.16" PRIx64
"), sources (0x%16.16" PRIx64
", 0x%16.16" PRIx64 ")\n",
(int)i, (int)j, ((cl_ulong *)&expected)[0],
*((cl_ulong *)out), *((cl_ulong *)inA),
*((cl_ulong *)inB));
break;
}
return -1;
@@ -1417,11 +1432,14 @@ int test_three_param_integer_kernel(cl_command_queue queue, cl_context context,
break;
case 8:
log_error( "ERROR: Data sample %d:%d does not validate! Expected (0x%16.16llx), got (0x%16.16llx), sources (0x%16.16llx, 0x%16.16llx, 0x%16.16llx)\n",
(int)i, (int)j, ((cl_ulong*)&expected)[ 0 ], *( (cl_ulong *)out ),
*( (cl_ulong *)inA ),
*( (cl_ulong *)inB ),
*( (cl_ulong *)inC ) );
log_error("ERROR: Data sample %d:%d does not validate! "
"Expected (0x%16.16" PRIx64
"), got (0x%16.16" PRIx64
"), sources (0x%16.16" PRIx64
", 0x%16.16" PRIx64 ", 0x%16.16" PRIx64 ")\n",
(int)i, (int)j, ((cl_ulong *)&expected)[0],
*((cl_ulong *)out), *((cl_ulong *)inA),
*((cl_ulong *)inB), *((cl_ulong *)inC));
break;
}
return -1;