Skip to content

Commit

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

src/textord/alignedblob.h:81:7: warning:
 'AlignedBlob' 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 c9d8e5e commit 677198e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/textord/alignedblob.cpp
Expand Up @@ -212,6 +212,11 @@ static bool AtLeast2LineCrossings(BLOBNBOX_CLIST* blobs) {
return total_crossings >= 2;
}

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

// Finds a vector corresponding to a set of vertically aligned blob edges
// running through the given box. The type of vector returned and the
// search parameters are determined by the AlignedBlobParams.
Expand Down
2 changes: 1 addition & 1 deletion src/textord/alignedblob.h
Expand Up @@ -81,7 +81,7 @@ struct AlignedBlobParams {
class AlignedBlob : public BlobGrid {
public:
AlignedBlob(int gridsize, const ICOORD& bleft, const ICOORD& tright);
virtual ~AlignedBlob() = default;
virtual ~AlignedBlob();

// Return true if the given coordinates are within the test rectangle
// and the debug level is at least the given detail level.
Expand Down

0 comments on commit 677198e

Please sign in to comment.