Skip to content

Commit fa5a53d

Browse files
committed
Explicitly silence Wnon-virtual-dtor in Decomposer and MatchExpr
Closes #2854
1 parent a654e4b commit fa5a53d

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

CMake/CatchMiscFunctions.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ function(add_warnings_to_targets targets)
6868
"-Wmissing-noreturn"
6969
"-Wmissing-prototypes"
7070
"-Wmissing-variable-declarations"
71+
"-Wnon-virtual-dtor"
7172
"-Wnull-dereference"
7273
"-Wold-style-cast"
7374
"-Woverloaded-virtual"

src/catch2/internal/catch_decomposer.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,11 @@
110110
#ifdef __clang__
111111
# pragma clang diagnostic push
112112
# pragma clang diagnostic ignored "-Wsign-compare"
113+
# pragma clang diagnostic ignored "-Wnon-virtual-dtor"
113114
#elif defined __GNUC__
114115
# pragma GCC diagnostic push
115116
# pragma GCC diagnostic ignored "-Wsign-compare"
117+
# pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
116118
#endif
117119

118120
#if defined(CATCH_CPP20_OR_GREATER) && __has_include(<compare>)

src/catch2/matchers/internal/catch_matchers_impl.hpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@
1818

1919
namespace Catch {
2020

21+
#ifdef __clang__
22+
# pragma clang diagnostic push
23+
# pragma clang diagnostic ignored "-Wsign-compare"
24+
# pragma clang diagnostic ignored "-Wnon-virtual-dtor"
25+
#elif defined __GNUC__
26+
# pragma GCC diagnostic push
27+
# pragma GCC diagnostic ignored "-Wsign-compare"
28+
# pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
29+
#endif
30+
2131
template<typename ArgT, typename MatcherT>
2232
class MatchExpr : public ITransientExpression {
2333
ArgT && m_arg;
@@ -36,6 +46,13 @@ namespace Catch {
3646
}
3747
};
3848

49+
#ifdef __clang__
50+
# pragma clang diagnostic pop
51+
#elif defined __GNUC__
52+
# pragma GCC diagnostic pop
53+
#endif
54+
55+
3956
namespace Matchers {
4057
template <typename ArgT>
4158
class MatcherBase;

0 commit comments

Comments
 (0)