Skip to content

Commit

Permalink
CUtil: Define virtual destructor in .cpp file
Browse files Browse the repository at this point in the history
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 <sw@weilnetz.de>
  • Loading branch information
stweil committed Sep 4, 2018
1 parent 32098b7 commit ac8afc5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/cutil/cutil_class.cpp
Expand Up @@ -20,4 +20,9 @@

namespace tesseract {

// Destructor.
// It is defined here, so the compiler can create a single vtable
// instead of weak vtables in every compilation unit.
CUtil::~CUtil() = default;

} // namespace tesseract
2 changes: 1 addition & 1 deletion src/cutil/cutil_class.h
Expand Up @@ -27,7 +27,7 @@ namespace tesseract {
class CUtil : public CCUtil {
public:
CUtil() = default;
~CUtil() = default;
virtual ~CUtil();
void read_variables(const char *filename, bool global_only);
};

Expand Down

0 comments on commit ac8afc5

Please sign in to comment.