Skip to content

Commit 8e55146

Browse files
committed
MutableIterator: Define virtual destructor in .cpp file
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>
1 parent d926655 commit 8e55146

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

src/ccmain/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ libtesseract_main_la_SOURCES = \
5555
fixxht.cpp \
5656
linerec.cpp \
5757
ltrresultiterator.cpp \
58+
mutableiterator.cpp \
5859
output.cpp \
5960
pageiterator.cpp \
6061
pagesegmain.cpp \

src/ccmain/mutableiterator.cpp

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
///////////////////////////////////////////////////////////////////////
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
// Unless required by applicable law or agreed to in writing, software
8+
// distributed under the License is distributed on an "AS IS" BASIS,
9+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
// See the License for the specific language governing permissions and
11+
// limitations under the License.
12+
//
13+
///////////////////////////////////////////////////////////////////////
14+
15+
#include "mutableiterator.h"
16+
17+
namespace tesseract {
18+
19+
// Destructor.
20+
// It is defined here, so the compiler can create a single vtable
21+
// instead of weak vtables in every compilation unit.
22+
MutableIterator::~MutableIterator() = default;
23+
24+
} // namespace tesseract.

src/ccmain/mutableiterator.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class MutableIterator : public ResultIterator {
5151
: ResultIterator(
5252
LTRResultIterator(page_res, tesseract, scale, scaled_yres, rect_left,
5353
rect_top, rect_width, rect_height)) {}
54-
virtual ~MutableIterator() = default;
54+
virtual ~MutableIterator();
5555

5656
// See PageIterator and ResultIterator for most calls.
5757

0 commit comments

Comments
 (0)