Skip to content

Commit

Permalink
MATRIX: Define virtual destructor in .cpp file
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
stweil committed Sep 4, 2018
1 parent bde8f08 commit 14c23c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ccstruct/matrix.cpp
Expand Up @@ -32,6 +32,11 @@
#include "tprintf.h"
#include "unicharset.h"

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

// Returns true if there are any real classification results.
bool MATRIX::Classified(int col, int row, int wildcard_id) const {
if (get(col, row) == NOT_CLASSIFIED) return false;
Expand Down
2 changes: 2 additions & 0 deletions src/ccstruct/matrix.h
Expand Up @@ -577,6 +577,8 @@ class MATRIX : public BandTriMatrix<BLOB_CHOICE_LIST *> {
MATRIX(int dimension, int bandwidth)
: BandTriMatrix<BLOB_CHOICE_LIST *>(dimension, bandwidth, NOT_CLASSIFIED) {}

virtual ~MATRIX();

// Returns true if there are any real classification results.
bool Classified(int col, int row, int wildcard_id) const;

Expand Down

0 comments on commit 14c23c9

Please sign in to comment.