[Libreoffice-commits] core.git: compilerplugins/clang include/o3tl
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jun 16 16:38:36 UTC 2021
compilerplugins/clang/implicitboolconversion.cxx | 6 ------
include/o3tl/hash_combine.hxx | 8 ++++----
2 files changed, 4 insertions(+), 10 deletions(-)
New commits:
commit d32d2fd301357df94d1930420b89415e1fe69688
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Jun 16 14:04:12 2021 +0200
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Jun 16 18:37:57 2021 +0200
Move enable_if from dummy template parameter to return type
...and drop the no-longer necessary loplugin:implicitboolconversion exclusion
(which had been necessary to avoid
> [CXX] vcl/source/window/dockingarea.cxx
> In file included from vcl/source/window/dockingarea.cxx:26:
> In file included from vcl/inc/svdata.hxx:26:
> include/o3tl/hash_combine.hxx:14:78: error: implicit conversion (Dependent) from 'bool' to 'std::enable_if_t<(sizeof(N) == 4), bool>' (aka 'typename enable_if<(sizeof(N) == 4), bool>::type') [loplugin:implicitboolconversion]
> template <typename T, typename N, std::enable_if_t<(sizeof(N) == 4), bool> = false>
> ^~~~~
etc.)
Change-Id: If764365213cf29f7dec6fdd6a773dc9894dd15bd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117330
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/compilerplugins/clang/implicitboolconversion.cxx b/compilerplugins/clang/implicitboolconversion.cxx
index 7e708eb49843..14574e3cd420 100644
--- a/compilerplugins/clang/implicitboolconversion.cxx
+++ b/compilerplugins/clang/implicitboolconversion.cxx
@@ -907,12 +907,6 @@ void ImplicitBoolConversion::reportWarning(ImplicitCastExpr const * expr) {
}
}
}
-
- // ignore template magic
- StringRef aFileName = getFilenameOfLocation(compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(expr)));
- if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/include/o3tl/hash_combine.hxx"))
- return;
-
report(
DiagnosticsEngine::Warning,
"implicit conversion (%0) from %1 to %2", compat::getBeginLoc(expr))
diff --git a/include/o3tl/hash_combine.hxx b/include/o3tl/hash_combine.hxx
index 17419b3e2c0f..139ee981699c 100644
--- a/include/o3tl/hash_combine.hxx
+++ b/include/o3tl/hash_combine.hxx
@@ -11,15 +11,15 @@
namespace o3tl
{
-template <typename T, typename N, std::enable_if_t<(sizeof(N) == 4), bool> = false>
-inline void hash_combine(N& nSeed, T const& nValue)
+template <typename T, typename N>
+inline std::enable_if_t<(sizeof(N) == 4)> hash_combine(N& nSeed, T const& nValue)
{
static_assert(sizeof(nSeed) == 4);
nSeed ^= std::hash<T>{}(nValue) + 0x9E3779B9u + (nSeed << 6) + (nSeed >> 2);
}
-template <typename T, typename N, std::enable_if_t<(sizeof(N) == 8), bool> = false>
-inline void hash_combine(N& nSeed, T const& nValue)
+template <typename T, typename N>
+inline std::enable_if_t<(sizeof(N) == 8)> hash_combine(N& nSeed, T const& nValue)
{
static_assert(sizeof(nSeed) == 8);
nSeed ^= std::hash<T>{}(nValue) + 0x9E3779B97F4A7C15llu + (nSeed << 12) + (nSeed >> 4);
More information about the Libreoffice-commits
mailing list