From 81f146f648a35389468ebb223bad2e3dec019f44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Dubois?= Date: Sat, 20 Nov 2021 16:51:26 +0100 Subject: [PATCH] build: fix multiple Clang13 warnings * spot/kripke/kripkegraph.hh, spot/misc/hash.hh, spot/twa/taatgba.cc, spot/twa/twagraph.hh, tests/core/ngraph.cc: Replace subtraction of pointeur minus nullptr by an explicit cast to size_t. * spot/twa/acc.hh: Add explicit default copy assignment operator for rs_pair. --- spot/kripke/kripkegraph.hh | 3 +-- spot/misc/hash.hh | 3 +-- spot/twa/acc.hh | 1 + spot/twa/taatgba.cc | 2 +- spot/twa/twagraph.hh | 3 +-- tests/core/ngraph.cc | 3 +-- 6 files changed, 6 insertions(+), 9 deletions(-) diff --git a/spot/kripke/kripkegraph.hh b/spot/kripke/kripkegraph.hh index 348e1ccf5..d6292c070 100644 --- a/spot/kripke/kripkegraph.hh +++ b/spot/kripke/kripkegraph.hh @@ -64,8 +64,7 @@ namespace spot virtual size_t hash() const override { - return - reinterpret_cast(this) - static_cast(nullptr); + return reinterpret_cast(this); } virtual kripke_graph_state* diff --git a/spot/misc/hash.hh b/spot/misc/hash.hh index 94f603b7c..b99c4ab53 100644 --- a/spot/misc/hash.hh +++ b/spot/misc/hash.hh @@ -48,8 +48,7 @@ namespace spot size_t operator()(const T* p) const noexcept { - return knuth32_hash(reinterpret_cast(p) - - static_cast(nullptr)); + return knuth32_hash(reinterpret_cast(p)); } }; diff --git a/spot/twa/acc.hh b/spot/twa/acc.hh index 761433f54..455850f35 100644 --- a/spot/twa/acc.hh +++ b/spot/twa/acc.hh @@ -1670,6 +1670,7 @@ namespace spot #ifndef SWIG rs_pair() = default; rs_pair(const rs_pair&) = default; + rs_pair& operator=(const rs_pair&) = default; #endif rs_pair(acc_cond::mark_t fin, acc_cond::mark_t inf) noexcept: diff --git a/spot/twa/taatgba.cc b/spot/twa/taatgba.cc index 416028e37..1ae35ff1b 100644 --- a/spot/twa/taatgba.cc +++ b/spot/twa/taatgba.cc @@ -105,7 +105,7 @@ namespace spot taa_tgba::state_set::const_iterator it = s_->begin(); while (it != s_->end()) { - res ^= reinterpret_cast(*it++) - static_cast(nullptr); + res ^= reinterpret_cast(*it++); res = wang32_hash(res); } return res; diff --git a/spot/twa/twagraph.hh b/spot/twa/twagraph.hh index 683fa32c8..c6222871e 100644 --- a/spot/twa/twagraph.hh +++ b/spot/twa/twagraph.hh @@ -70,8 +70,7 @@ namespace spot virtual size_t hash() const override { - return - reinterpret_cast(this) - static_cast(nullptr); + return reinterpret_cast(this); } virtual twa_graph_state* diff --git a/tests/core/ngraph.cc b/tests/core/ngraph.cc index 021e66452..0a64f5f73 100644 --- a/tests/core/ngraph.cc +++ b/tests/core/ngraph.cc @@ -372,8 +372,7 @@ public: size_t hash() const override { - return - reinterpret_cast(this) - static_cast(nullptr); + return reinterpret_cast(this); } my_state* clone() const override