diff options
author | Yuhang Zhao <2546789017@qq.com> | 2022-10-10 14:55:25 +0800 |
---|---|---|
committer | Yuhang Zhao <2546789017@qq.com> | 2022-10-15 21:34:20 +0800 |
commit | 8ba8d1346a562347c398bdd0529d34f94f2ac698 (patch) | |
tree | de8b4973828b83cb6802b75b8636d46fd8b90577 /src/corelib/text/qanystringview.h | |
parent | 8cb832090a8a0e7226904561f97c6de954d752ed (diff) |
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.
Pick-to: 6.4
Change-Id: I22a321e2c748bd1c5608475d61ba9a83734c5364
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text/qanystringview.h')
-rw-r--r-- | src/corelib/text/qanystringview.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/corelib/text/qanystringview.h b/src/corelib/text/qanystringview.h index 36262e28e1..2f8291b168 100644 --- a/src/corelib/text/qanystringview.h +++ b/src/corelib/text/qanystringview.h @@ -73,15 +73,18 @@ private: static constexpr bool isAsciiOnlyCharsAtCompileTime(Char *str, qsizetype sz) noexcept { // 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)) + Q_UNUSED(str); + Q_UNUSED(sz); + return false; +#else +# if defined(__cpp_lib_is_constant_evaluated) if (!std::is_constant_evaluated()) return false; -#elif defined(Q_CC_GNU) && !defined(Q_CC_CLANG) +# elif defined(Q_CC_GNU) && !defined(Q_CC_CLANG) if (!str || !__builtin_constant_p(*str)) return false; -#else - return false; -#endif +# endif if constexpr (sizeof(Char) != sizeof(char)) { Q_UNUSED(str); Q_UNUSED(sz); @@ -93,6 +96,7 @@ private: } } return true; +#endif } template<typename Char> |