mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
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:
committed by
GitHub
parent
4b39b59469
commit
f6a963a583
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cinttypes>
|
||||
#include <vector>
|
||||
|
||||
static bool findProperty(const std::vector<cl_properties>& props,
|
||||
@@ -97,16 +98,16 @@ int compareProperties(const std::vector<cl_properties>& queried,
|
||||
|
||||
if (!found)
|
||||
{
|
||||
log_error("ERROR: expected property 0x%llx not found!\n",
|
||||
log_error("ERROR: expected property 0x%" PRIx64 " not found!\n",
|
||||
check_prop);
|
||||
return TEST_FAIL;
|
||||
}
|
||||
else if (check_value != queried_value)
|
||||
{
|
||||
log_error(
|
||||
"ERROR: mis-matched value for property 0x%llx: wanted "
|
||||
"0x%llx, got 0x%llx\n",
|
||||
check_prop, check_value, queried_value);
|
||||
log_error("ERROR: mis-matched value for property 0x%" PRIx64
|
||||
": wanted "
|
||||
"0x%" PRIx64 ", got 0x%" PRIx64 "\n",
|
||||
check_prop, check_value, queried_value);
|
||||
return TEST_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1198,7 +1198,7 @@ cl_platform_id getPlatformFromDevice(cl_device_id deviceID)
|
||||
|
||||
void PrintArch(void)
|
||||
{
|
||||
vlog("sizeof( void*) = %ld\n", sizeof(void *));
|
||||
vlog("sizeof( void*) = %zu\n", sizeof(void *));
|
||||
#if defined(__ppc__)
|
||||
vlog("ARCH:\tppc\n");
|
||||
#elif defined(__ppc64__)
|
||||
|
||||
Reference in New Issue
Block a user