Skip to content

Commit

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

src/ccmain/mutableiterator.h:44:7: warning:
 'MutableIterator' 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 d926655 commit 8e55146
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/ccmain/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ libtesseract_main_la_SOURCES = \
fixxht.cpp \
linerec.cpp \
ltrresultiterator.cpp \
mutableiterator.cpp \
output.cpp \
pageiterator.cpp \
pagesegmain.cpp \
Expand Down
24 changes: 24 additions & 0 deletions src/ccmain/mutableiterator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
///////////////////////////////////////////////////////////////////////
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
///////////////////////////////////////////////////////////////////////

#include "mutableiterator.h"

namespace tesseract {

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

} // namespace tesseract.
2 changes: 1 addition & 1 deletion src/ccmain/mutableiterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class MutableIterator : public ResultIterator {
: ResultIterator(
LTRResultIterator(page_res, tesseract, scale, scaled_yres, rect_left,
rect_top, rect_width, rect_height)) {}
virtual ~MutableIterator() = default;
virtual ~MutableIterator();

// See PageIterator and ResultIterator for most calls.

Expand Down

0 comments on commit 8e55146

Please sign in to comment.