Skip to content

Commit 677198e

Browse files
committed
AlignedBlob: Define virtual destructor in .cpp file
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>
1 parent c9d8e5e commit 677198e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/textord/alignedblob.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ static bool AtLeast2LineCrossings(BLOBNBOX_CLIST* blobs) {
212212
return total_crossings >= 2;
213213
}
214214

215+
// Destructor.
216+
// It is defined here, so the compiler can create a single vtable
217+
// instead of weak vtables in every compilation unit.
218+
AlignedBlob::~AlignedBlob() = default;
219+
215220
// Finds a vector corresponding to a set of vertically aligned blob edges
216221
// running through the given box. The type of vector returned and the
217222
// search parameters are determined by the AlignedBlobParams.

src/textord/alignedblob.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ struct AlignedBlobParams {
8181
class AlignedBlob : public BlobGrid {
8282
public:
8383
AlignedBlob(int gridsize, const ICOORD& bleft, const ICOORD& tright);
84-
virtual ~AlignedBlob() = default;
84+
virtual ~AlignedBlob();
8585

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

0 commit comments

Comments
 (0)