mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
conversions: use C++17 to avoid Wformat warnings (#2369)
Using C++17's `if constexpr` avoids Wformat warnings in this template function, as it is now made explicit that the various format strings are only used with appropriate types. Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
This commit is contained in:
committed by
GitHub
parent
829e91663a
commit
4ce3d8968a
@@ -12,6 +12,6 @@ if("${CLConform_TARGET_ARCH}" STREQUAL "ARM" OR "${CLConform_TARGET_ARCH}" STREQ
|
|||||||
list(APPEND ${MODULE_NAME}_SOURCES fplib.cpp)
|
list(APPEND ${MODULE_NAME}_SOURCES fplib.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_gnulike_module_compile_flags("-Wno-sign-compare -Wno-format")
|
set_gnulike_module_compile_flags("-Wno-sign-compare")
|
||||||
|
|
||||||
include(../CMakeCommon.txt)
|
include(../CMakeCommon.txt)
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ int CalcRefValsPat<InType, OutType, InFP, OutFP>::check_result(void *test,
|
|||||||
{
|
{
|
||||||
const cl_uchar *a = (const cl_uchar *)gAllowZ;
|
const cl_uchar *a = (const cl_uchar *)gAllowZ;
|
||||||
|
|
||||||
if (is_half<OutType, OutFP>())
|
if constexpr (is_half<OutType, OutFP>())
|
||||||
{
|
{
|
||||||
const cl_half *t = (const cl_half *)test;
|
const cl_half *t = (const cl_half *)test;
|
||||||
const cl_half *c = (const cl_half *)gRef;
|
const cl_half *c = (const cl_half *)gRef;
|
||||||
@@ -335,7 +335,7 @@ int CalcRefValsPat<InType, OutType, InFP, OutFP>::check_result(void *test,
|
|||||||
return i + 1;
|
return i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (std::is_integral<OutType>::value)
|
else if constexpr (std::is_integral<OutType>::value)
|
||||||
{ // char/uchar/short/ushort/half/int/uint/long/ulong
|
{ // char/uchar/short/ushort/half/int/uint/long/ulong
|
||||||
const OutType *t = (const OutType *)test;
|
const OutType *t = (const OutType *)test;
|
||||||
const OutType *c = (const OutType *)gRef;
|
const OutType *c = (const OutType *)gRef;
|
||||||
@@ -350,7 +350,7 @@ int CalcRefValsPat<InType, OutType, InFP, OutFP>::check_result(void *test,
|
|||||||
return i + 1;
|
return i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (std::is_same<OutType, cl_float>::value)
|
else if constexpr (std::is_same<OutType, cl_float>::value)
|
||||||
{
|
{
|
||||||
// cast to integral - from original test
|
// cast to integral - from original test
|
||||||
const cl_uint *t = (const cl_uint *)test;
|
const cl_uint *t = (const cl_uint *)test;
|
||||||
|
|||||||
Reference in New Issue
Block a user