Skip to content

Commit 0d211f9

Browse files
committed
Dawg: Define virtual destructor in .cpp file
This fixes compiler warnings from clang: src/dict/dawg.h:119:7: warning: 'Dawg' 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 ac8afc5 commit 0d211f9

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/dict/dawg.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@
4242
----------------------------------------------------------------------*/
4343
namespace tesseract {
4444

45+
// Destructor.
46+
// It is defined here, so the compiler can create a single vtable
47+
// instead of weak vtables in every compilation unit.
48+
Dawg::~Dawg() = default;
49+
4550
bool Dawg::prefix_in_dawg(const WERD_CHOICE &word,
4651
bool requires_complete) const {
4752
if (word.length() == 0) return !requires_complete;

src/dict/dawg.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class Dawg {
129129
inline const STRING &lang() const { return lang_; }
130130
inline PermuterType permuter() const { return perm_; }
131131

132-
virtual ~Dawg() = default;
132+
virtual ~Dawg();
133133

134134
/// Returns true if the given word is in the Dawg.
135135
bool word_in_dawg(const WERD_CHOICE &word) const;

0 commit comments

Comments
 (0)