Skip to content

Commit 14c23c9

Browse files
committed
MATRIX: Define virtual destructor in .cpp file
This fixes compiler warnings from clang: src/ccstruct/matrix.h:575:7: warning: 'MATRIX' 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 bde8f08 commit 14c23c9

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/ccstruct/matrix.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
#include "tprintf.h"
3333
#include "unicharset.h"
3434

35+
// Destructor.
36+
// It is defined here, so the compiler can create a single vtable
37+
// instead of weak vtables in every compilation unit.
38+
MATRIX::~MATRIX() = default;
39+
3540
// Returns true if there are any real classification results.
3641
bool MATRIX::Classified(int col, int row, int wildcard_id) const {
3742
if (get(col, row) == NOT_CLASSIFIED) return false;

src/ccstruct/matrix.h

+2
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,8 @@ class MATRIX : public BandTriMatrix<BLOB_CHOICE_LIST *> {
577577
MATRIX(int dimension, int bandwidth)
578578
: BandTriMatrix<BLOB_CHOICE_LIST *>(dimension, bandwidth, NOT_CLASSIFIED) {}
579579

580+
virtual ~MATRIX();
581+
580582
// Returns true if there are any real classification results.
581583
bool Classified(int col, int row, int wildcard_id) const;
582584

0 commit comments

Comments
 (0)