Skip to content

Commit 05786fa

Browse files
ChrisThrasherhorenmar
authored andcommitted
Remove redundant destructors
Classes will automatically inherit the virtual-ness of their base class destructors. If the base class already has a virtual destructor and the derived class needs default destructor semantics then the derived class can omit defining the destructor in favor of the compiler automatically defining it. This has an additional benefit of reenabling move semantics. The presence of a user-specified destructor automatically disables move operations.
1 parent d79bfa0 commit 05786fa

File tree

8 files changed

+0
-32
lines changed

8 files changed

+0
-32
lines changed

extras/catch_amalgamated.hpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7304,12 +7304,6 @@ namespace Detail {
73047304
}
73057305

73067306
public:
7307-
~IGenerator() override = default;
7308-
IGenerator() = default;
7309-
IGenerator(IGenerator const&) = default;
7310-
IGenerator& operator=(IGenerator const&) = default;
7311-
7312-
73137307
// Returns the current element of the generator
73147308
//
73157309
// \Precondition The generator is either freshly constructed,
@@ -10707,8 +10701,6 @@ namespace Catch {
1070710701

1070810702
class TestRegistry : public ITestCaseRegistry {
1070910703
public:
10710-
~TestRegistry() override = default;
10711-
1071210704
void registerTest( Detail::unique_ptr<TestCaseInfo> testInfo, Detail::unique_ptr<ITestInvoker> testInvoker );
1071310705

1071410706
std::vector<TestCaseInfo*> const& getAllInfos() const override;
@@ -13376,8 +13368,6 @@ namespace Catch {
1337613368
public:
1337713369
JunitReporter(ReporterConfig&& _config);
1337813370

13379-
~JunitReporter() override = default;
13380-
1338113371
static std::string getDescription();
1338213372

1338313373
void testRunStarting(TestRunInfo const& runInfo) override;
@@ -13618,8 +13608,6 @@ namespace Catch {
1361813608
m_shouldStoreSuccesfulAssertions = false;
1361913609
}
1362013610

13621-
~SonarQubeReporter() override = default;
13622-
1362313611
static std::string getDescription() {
1362413612
using namespace std::string_literals;
1362513613
return "Reports test results in the Generic Test Data SonarQube XML format"s;
@@ -13666,7 +13654,6 @@ namespace Catch {
1366613654
StreamingReporterBase( CATCH_MOVE(config) ) {
1366713655
m_preferences.shouldReportAllAssertions = true;
1366813656
}
13669-
~TAPReporter() override = default;
1367013657

1367113658
static std::string getDescription() {
1367213659
using namespace std::string_literals;

src/catch2/generators/catch_generators.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ namespace Detail {
3737
}
3838

3939
public:
40-
~IGenerator() override = default;
41-
IGenerator() = default;
42-
IGenerator(IGenerator const&) = default;
43-
IGenerator& operator=(IGenerator const&) = default;
44-
45-
4640
// Returns the current element of the generator
4741
//
4842
// \Precondition The generator is either freshly constructed,

src/catch2/internal/catch_istream.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ namespace Detail {
8080
CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << '\'' );
8181
m_ofs << std::unitbuf;
8282
}
83-
~FileStream() override = default;
8483
public: // IStream
8584
std::ostream& stream() override {
8685
return m_ofs;
@@ -95,7 +94,6 @@ namespace Detail {
9594
// Store the streambuf from cout up-front because
9695
// cout may get redirected when running tests
9796
CoutStream() : m_os( Catch::cout().rdbuf() ) {}
98-
~CoutStream() override = default;
9997

10098
public: // IStream
10199
std::ostream& stream() override { return m_os; }
@@ -109,7 +107,6 @@ namespace Detail {
109107
// Store the streambuf from cerr up-front because
110108
// cout may get redirected when running tests
111109
CerrStream(): m_os( Catch::cerr().rdbuf() ) {}
112-
~CerrStream() override = default;
113110

114111
public: // IStream
115112
std::ostream& stream() override { return m_os; }
@@ -127,8 +124,6 @@ namespace Detail {
127124
m_os( m_streamBuf.get() )
128125
{}
129126

130-
~DebugOutStream() override = default;
131-
132127
public: // IStream
133128
std::ostream& stream() override { return m_os; }
134129
};

src/catch2/internal/catch_run_context.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ namespace Catch {
3838
TrackerContext& ctx,
3939
ITracker* parent ):
4040
TrackerBase( CATCH_MOVE( nameAndLocation ), ctx, parent ) {}
41-
~GeneratorTracker() override = default;
4241

4342
static GeneratorTracker*
4443
acquire( TrackerContext& ctx,

src/catch2/internal/catch_test_case_registry_impl.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ namespace Catch {
3030

3131
class TestRegistry : public ITestCaseRegistry {
3232
public:
33-
~TestRegistry() override = default;
34-
3533
void registerTest( Detail::unique_ptr<TestCaseInfo> testInfo, Detail::unique_ptr<ITestInvoker> testInvoker );
3634

3735
std::vector<TestCaseInfo*> const& getAllInfos() const override;

src/catch2/reporters/catch_reporter_junit.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ namespace Catch {
1919
public:
2020
JunitReporter(ReporterConfig&& _config);
2121

22-
~JunitReporter() override = default;
23-
2422
static std::string getDescription();
2523

2624
void testRunStarting(TestRunInfo const& runInfo) override;

src/catch2/reporters/catch_reporter_sonarqube.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ namespace Catch {
2525
m_shouldStoreSuccesfulAssertions = false;
2626
}
2727

28-
~SonarQubeReporter() override = default;
29-
3028
static std::string getDescription() {
3129
using namespace std::string_literals;
3230
return "Reports test results in the Generic Test Data SonarQube XML format"s;

src/catch2/reporters/catch_reporter_tap.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ namespace Catch {
1919
StreamingReporterBase( CATCH_MOVE(config) ) {
2020
m_preferences.shouldReportAllAssertions = true;
2121
}
22-
~TAPReporter() override = default;
2322

2423
static std::string getDescription() {
2524
using namespace std::string_literals;

0 commit comments

Comments
 (0)