QAnyStringView: fix MSVC warning
When use /W4, MSVC warns about the code is not reachable. It's not reachable indeed, so it's no need to include it in the final binary, just use the same #ifdef guard to comment it out. Change-Id: I22a321e2c748bd1c5608475d61ba9a83734c5364 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 8ba8d1346a562347c398bdd0529d34f94f2ac698) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
bd82fb5e65
commit
3868f2fa5d
@ -51,15 +51,18 @@ private:
|
|||||||
static constexpr bool isAsciiOnlyCharsAtCompileTime(Char *str, qsizetype sz) noexcept
|
static constexpr bool isAsciiOnlyCharsAtCompileTime(Char *str, qsizetype sz) noexcept
|
||||||
{
|
{
|
||||||
// do not perform check if not at compile time
|
// do not perform check if not at compile time
|
||||||
#if defined(__cpp_lib_is_constant_evaluated)
|
#if !(defined(__cpp_lib_is_constant_evaluated) || defined(Q_CC_GNU))
|
||||||
if (!std::is_constant_evaluated())
|
Q_UNUSED(str);
|
||||||
return false;
|
Q_UNUSED(sz);
|
||||||
#elif defined(Q_CC_GNU) && !defined(Q_CC_CLANG)
|
|
||||||
if (!str || !__builtin_constant_p(*str))
|
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
|
# if defined(__cpp_lib_is_constant_evaluated)
|
||||||
|
if (!std::is_constant_evaluated())
|
||||||
return false;
|
return false;
|
||||||
#endif
|
# elif defined(Q_CC_GNU) && !defined(Q_CC_CLANG)
|
||||||
|
if (!str || !__builtin_constant_p(*str))
|
||||||
|
return false;
|
||||||
|
# endif
|
||||||
if constexpr (sizeof(Char) != sizeof(char)) {
|
if constexpr (sizeof(Char) != sizeof(char)) {
|
||||||
Q_UNUSED(str);
|
Q_UNUSED(str);
|
||||||
Q_UNUSED(sz);
|
Q_UNUSED(sz);
|
||||||
@ -71,6 +74,7 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Char>
|
template<typename Char>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user