Skip to content

Commit bde8f08

Browse files
committed
CCStruct: Define virtual destructor in .cpp file
This fixes compiler warnings from clang: src/ccstruct/ccstruct.h:25:7: warning: 'CCStruct' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit [-Wweak-vtables] Signed-off-by: Stefan Weil <[email protected]>
1 parent 8317371 commit bde8f08

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/ccstruct/ccstruct.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,9 @@ const double CCStruct::kAscenderFraction = 0.25;
2828
const double CCStruct::kXHeightCapRatio = CCStruct::kXHeightFraction /
2929
(CCStruct::kXHeightFraction + CCStruct::kAscenderFraction);
3030

31+
// Destructor.
32+
// It is defined here, so the compiler can create a single vtable
33+
// instead of weak vtables in every compilation unit.
34+
CCStruct::~CCStruct() = default;
35+
3136
}

src/ccstruct/ccstruct.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace tesseract {
2525
class CCStruct : public CUtil {
2626
public:
2727
CCStruct() = default;
28-
~CCStruct() = default;
28+
virtual ~CCStruct();
2929

3030
// Globally accessible constants.
3131
// APPROXIMATIONS of the fractions of the character cell taken by

0 commit comments

Comments
 (0)