Skip to content

Commit ac8afc5

Browse files
committed
CUtil: Define virtual destructor in .cpp file
This fixes compiler warnings from clang: src/cutil/cutil_class.h:27:7: warning: 'CUtil' 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 32098b7 commit ac8afc5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/cutil/cutil_class.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,9 @@
2020

2121
namespace tesseract {
2222

23+
// Destructor.
24+
// It is defined here, so the compiler can create a single vtable
25+
// instead of weak vtables in every compilation unit.
26+
CUtil::~CUtil() = default;
27+
2328
} // namespace tesseract

src/cutil/cutil_class.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace tesseract {
2727
class CUtil : public CCUtil {
2828
public:
2929
CUtil() = default;
30-
~CUtil() = default;
30+
virtual ~CUtil();
3131
void read_variables(const char *filename, bool global_only);
3232
};
3333

0 commit comments

Comments
 (0)