jeremy-rifkin / cpptrace

Simple, portable, and self-contained stacktrace library for C++11 and newer
MIT License
701 stars 75 forks source link

Tweaks from clang-tidy #92

Closed waywardmonkeys closed 8 months ago

waywardmonkeys commented 8 months ago

This is (perhaps) mainly for discussion as I saw you removed clang-tidy checks last year. These fix a variety of minor things.

With one of the options that I was using, these still remain:

/Users/bruce/Development/custodian/cpptrace/src/symbols/../utils/utils.hpp:235:22: warning: noexcept specifier on the move constructor evaluates to 'false' [performance-noexcept-move-constructor]
  235 |             noexcept(std::is_nothrow_move_constructible<T>::value)
      |                      ^
/Users/bruce/Development/custodian/cpptrace/src/symbols/../utils/utils.hpp:250:64: warning: noexcept specifier on the move assignment operator evaluates to 'false' [performance-noexcept-move-constructor]
  250 |             noexcept(std::is_nothrow_move_assignable<T>::value && std::is_nothrow_move_constructible<T>::value)
      |                                                                ^
jeremy-rifkin commented 8 months ago

Regarding the warnings on the noexcepts, I used the same exception specification as std::optional and the move constructor/assignment operator are really only noexcept if T is nothrow move constructible. The move assignment could be relaxed to not require std::is_nothrow_move_assignable<T>::value, or alternatively maybe it should be implemented to actually use an assignment operator. But that wouldn't resolve the clang-tidy warning of course.

Does clang-tidy give any information about what T is leading to a false noexcept here? Or is it just waning that it could be false?