Skip to content

Commit

Permalink
IndexMap: Define virtual destructor in .cpp file
Browse files Browse the repository at this point in the history
This fixes compiler warnings from clang:

src/ccutil/indexmapbidi.h:102:7: warning:
 'IndexMapBiDi' 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]>
  • Loading branch information
stweil committed Sep 4, 2018
1 parent 5b8162f commit 32098b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/ccutil/indexmapbidi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@

namespace tesseract {

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

// SparseToCompact takes a sparse index to an index in the compact space.
// Uses a binary search to find the result. For faster speed use
// IndexMapBiDi, but that takes more memory.
Expand Down
2 changes: 1 addition & 1 deletion src/ccutil/indexmapbidi.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class IndexMapBiDi;
// It must be initialized by copying from an IndexMapBiDi or by DeSerialize.
class IndexMap {
public:
virtual ~IndexMap() = default;
virtual ~IndexMap();

// SparseToCompact takes a sparse index to an index in the compact space.
// Uses a binary search to find the result. For faster speed use
Expand Down

0 comments on commit 32098b7

Please sign in to comment.