From 5fe041dd185d808f98df8327a583f1a55fccc15f Mon Sep 17 00:00:00 2001 From: Jeroen Vermeulen Date: Tue, 17 Aug 2021 18:05:11 +0200 Subject: [PATCH] Fix more warnings like #475. With clang 12 I get a lot more warnings (or errors, in maintainer mode) about `[[likely]]` or `[[unlikely]]` in `if constexpr`. Remove those attributes. --- NEWS | 1 + include/pqxx/field.hxx | 6 ++---- include/pqxx/stream_from.hxx | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 6ee5b808e..09940a248 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,7 @@ - Fix `stream_to` for differing table/client encodings. (#473) - Use `[[likely]]` & `[[unlikely]]` only in C++20, to silence warnings. - Fix clang "not a const expression" error in Windows. (#472) + - Fix warnings about `[[likely]]` in `if constexpr`. (#475) 7.6.0 - Removed bad string conversion to `std::basic_string_view`. (#463) - Add C++20 concepts: `binary`, `char_string`, `char_strings`. diff --git a/include/pqxx/field.hxx b/include/pqxx/field.hxx index abd83243c..9f1a7b3ad 100644 --- a/include/pqxx/field.hxx +++ b/include/pqxx/field.hxx @@ -218,8 +218,7 @@ public: if (is_null()) { if constexpr (not nullness::has_null) - PQXX_UNLIKELY - internal::throw_null_conversion(type_name); + internal::throw_null_conversion(type_name); else return nullness::null(); } else @@ -494,8 +493,7 @@ template inline T from_string(field const &value) if constexpr (nullness::has_null) return nullness::null(); else - PQXX_UNLIKELY - internal::throw_null_conversion(type_name); + internal::throw_null_conversion(type_name); } else { diff --git a/include/pqxx/stream_from.hxx b/include/pqxx/stream_from.hxx index f2dcc31a4..6d97063e6 100644 --- a/include/pqxx/stream_from.hxx +++ b/include/pqxx/stream_from.hxx @@ -338,8 +338,7 @@ inline void stream_from::extract_value(Tuple &t) const if constexpr (nullity::has_null) std::get(t) = nullity::null(); else - PQXX_UNLIKELY - internal::throw_null_conversion(type_name); + internal::throw_null_conversion(type_name); } else {