Skip to content

Commit

Permalink
Fix more warnings like #475.
Browse files Browse the repository at this point in the history
With clang 12 I get a lot more warnings (or errors, in maintainer mode)
about `[[likely]]` or `[[unlikely]]` in `if constexpr`.  Remove those
attributes.
  • Loading branch information
jtv committed Aug 17, 2021
1 parent 9100bef commit 5fe041d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::byte>`. (#463)
- Add C++20 concepts: `binary`, `char_string`, `char_strings`.
Expand Down
6 changes: 2 additions & 4 deletions include/pqxx/field.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,7 @@ public:
if (is_null())
{
if constexpr (not nullness<T>::has_null)
PQXX_UNLIKELY
internal::throw_null_conversion(type_name<T>);
internal::throw_null_conversion(type_name<T>);
else return nullness<T>::null();
}
else
Expand Down Expand Up @@ -494,8 +493,7 @@ template<typename T> inline T from_string(field const &value)
if constexpr (nullness<T>::has_null)
return nullness<T>::null();
else
PQXX_UNLIKELY
internal::throw_null_conversion(type_name<T>);
internal::throw_null_conversion(type_name<T>);
}
else
{
Expand Down
3 changes: 1 addition & 2 deletions include/pqxx/stream_from.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,7 @@ inline void stream_from::extract_value(Tuple &t) const
if constexpr (nullity::has_null)
std::get<index>(t) = nullity::null();
else
PQXX_UNLIKELY
internal::throw_null_conversion(type_name<field_type>);
internal::throw_null_conversion(type_name<field_type>);
}
else
{
Expand Down

0 comments on commit 5fe041d

Please sign in to comment.