Builds without support for OpenMP failed with the old code. Fix this:
* Add OPENMP_CXXFLAGS for ccmain.
* Replace unconditional -fopenmp by OPENMP_CXXFLAGS for lstm.
* Always use _OPENMP for conditional compilation.
* Remove OPENMP as there is already _OPENMP.
* Include omp.h conditionally.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This fixes a compiler warning from clang:
ccutil/platform.h:88:13: warning:
macro name is a reserved identifier [-Wreserved-id-macro]
#define _TESS_FILE_BASENAME_ \
Signed-off-by: Stefan Weil <sw@weilnetz.de>
clang++ report:
api/baseapi.h:852:4: warning:
extra ';' after member function definition [-Wextra-semi]
[...]
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Commit 03eec61a2f removed unneeded
null pointer checks after new, but missed one which now raises
a warning from coverity scan. Remove that one, too.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Coverity report:
CID 1366758: Memory - corruptions (USE_AFTER_FREE)
Calling "operator delete[]" frees pointer "label32"
which has already been freed.
Commit f60ff4d575 fixed several memory leaks
but also added this wrong delete operation.
label32 is assigned to char_samp->label32_, so it is freed when deleting
char_samp.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Coverity report:
CID 1366441 (#1 of 1): Division or modulo by float zero (DIVIDE_BY_ZERO)
5. divide_by_zero: In expression
static_cast<double>(char_errors) / truth_size, division by expression
truth_size which may be zero has undefined behavior.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Coverity report:
CID 1366443 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)
3. var_deref_model: Passing null pointer this->sub_trainer_ to
training_iteration, which dereferences it.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Coverity report:
CID 1366448 (#1 of 1): Big parameter passed by value (PASS_BY_VALUE)
pass_by_value: Passing parameter recoder of type
tesseract::UnicharCompress const (size 240 bytes) by value.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Coverity report:
CID 1366450 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
4. uninit_member: Non-static class member beam_size_ is not initialized
in this constructor nor in any functions that it calls.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Coverity report:
CID 1366452 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
18. uninit_member: Non-static class member input_width_ is not initialized
in this constructor nor in any functions that it calls.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
It was introduced recently in commit f24ef67d, so there is no need
to support the old variant for compatibility reasons.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
It is not necessary to check for null pointers after new.
Simplify also two delete operations which were missing
in the previous commit.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
GNU compiler report (cross build for Windows on Debian):
In file included from ../ccutil/host.h:63:0,
from ../arch/dotproductsse.h:22,
from ../arch/dotproductsse.cpp:43:
../ccutil/platform.h:27:0: warning: "NOMINMAX" redefined
#define NOMINMAX
In file included from /usr/lib/gcc/i686-w64-mingw32/6.1-win32/include/c++/i686-w64-mingw32/bits/c++config.h:495:0,
from /usr/lib/gcc/i686-w64-mingw32/6.1-win32/include/c++/cstdlib:41,
from /usr/lib/gcc/i686-w64-mingw32/6.1-win32/include/c++/stdlib.h:36,
from /usr/lib/gcc/i686-w64-mingw32/6.1-win32/include/mm_malloc.h:27,
from /usr/lib/gcc/i686-w64-mingw32/6.1-win32/include/xmmintrin.h:34,
from /usr/lib/gcc/i686-w64-mingw32/6.1-win32/include/emmintrin.h:31,
from ../arch/dotproductsse.cpp:40:
/usr/lib/gcc/i686-w64-mingw32/6.1-win32/include/c++/i686-w64-mingw32/bits/os_defines.h:45:0:
note: this is the location of the previous definition
#define NOMINMAX 1
Signed-off-by: Stefan Weil <sw@weilnetz.de>