Skip to content

Commit

Permalink
Explicitly silence Wnon-virtual-dtor in Decomposer and MatchExpr
Browse files Browse the repository at this point in the history
Closes #2854
  • Loading branch information
horenmar committed Apr 30, 2024
1 parent a654e4b commit fa5a53d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMake/CatchMiscFunctions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ function(add_warnings_to_targets targets)
"-Wmissing-noreturn"
"-Wmissing-prototypes"
"-Wmissing-variable-declarations"
"-Wnon-virtual-dtor"
"-Wnull-dereference"
"-Wold-style-cast"
"-Woverloaded-virtual"
Expand Down
2 changes: 2 additions & 0 deletions src/catch2/internal/catch_decomposer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,11 @@
#ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wsign-compare"
# pragma clang diagnostic ignored "-Wnon-virtual-dtor"
#elif defined __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wsign-compare"
# pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
#endif

#if defined(CATCH_CPP20_OR_GREATER) && __has_include(<compare>)
Expand Down
17 changes: 17 additions & 0 deletions src/catch2/matchers/internal/catch_matchers_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@

namespace Catch {

#ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wsign-compare"
# pragma clang diagnostic ignored "-Wnon-virtual-dtor"
#elif defined __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wsign-compare"
# pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
#endif

template<typename ArgT, typename MatcherT>
class MatchExpr : public ITransientExpression {
ArgT && m_arg;
Expand All @@ -36,6 +46,13 @@ namespace Catch {
}
};

#ifdef __clang__
# pragma clang diagnostic pop
#elif defined __GNUC__
# pragma GCC diagnostic pop
#endif


namespace Matchers {
template <typename ArgT>
class MatcherBase;
Expand Down

0 comments on commit fa5a53d

Please sign in to comment.