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

@@ -14,6 +14,7 @@
// limitations under the License.
//
#include "conversions.h"
#include <cinttypes>
#include <limits.h>
#include <time.h>
#include <assert.h>
@@ -50,10 +51,10 @@ void print_type_to_string(ExplicitType type, void *data, char *string)
case kInt: sprintf(string, "%d", *((cl_int *)data)); return;
case kUInt:
case kUnsignedInt: sprintf(string, "%u", *((cl_uint *)data)); return;
case kLong: sprintf(string, "%lld", *((cl_long *)data)); return;
case kLong: sprintf(string, "%" PRId64 "", *((cl_long *)data)); return;
case kULong:
case kUnsignedLong:
sprintf(string, "%llu", *((cl_ulong *)data));
sprintf(string, "%" PRIu64 "", *((cl_ulong *)data));
return;
case kFloat: sprintf(string, "%f", *((cl_float *)data)); return;
case kHalf: sprintf(string, "half"); return;