From 7972b13e3a440eda80ffcfc3d7f0dc0a016f8810 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 4 Mar 2018 14:43:28 +0100 Subject: [PATCH] Remove macro USE_STD_NAMESPACE (#1360) The related code in training/util.h now uses the GOOGLE_TESSERACT macro to enable Google specific code to disable heap checking. Signed-off-by: Stefan Weil --- CMakeLists.txt | 1 - api/Makefile.am | 1 - arch/Makefile.am | 2 +- ccmain/Makefile.am | 1 - ccstruct/Makefile.am | 2 +- ccutil/Makefile.am | 2 +- classify/Makefile.am | 2 +- cppan.yml | 1 - cutil/Makefile.am | 2 +- dict/Makefile.am | 2 +- lstm/Makefile.am | 10 +++++----- textord/Makefile.am | 1 - training/Makefile.am | 2 +- training/util.h | 2 +- unittest/Makefile.am | 6 +++--- wordrec/Makefile.am | 2 +- 16 files changed, 17 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 27e29e3c61..0798ed28df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -131,7 +131,6 @@ include(SourceGroups) add_definitions(-DHAVE_CONFIG_H) add_definitions(-D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS=1) -add_definitions(-DUSE_STD_NAMESPACE=1) add_definitions(-DWINDLLNAME="libtesseract${VERSION_MAJOR}${VERSION_MINOR}.dll") include_directories(${Leptonica_INCLUDE_DIRS}) diff --git a/api/Makefile.am b/api/Makefile.am index eb67dd136f..855b7443ea 100644 --- a/api/Makefile.am +++ b/api/Makefile.am @@ -1,5 +1,4 @@ AM_CPPFLAGS += -DLOCALEDIR=\"$(localedir)\"\ - -DUSE_STD_NAMESPACE \ -I$(top_srcdir)/arch -I$(top_srcdir)/lstm \ -I$(top_srcdir)/ccutil -I$(top_srcdir)/ccstruct \ -I$(top_srcdir)/viewer \ diff --git a/arch/Makefile.am b/arch/Makefile.am index 48f34450e6..734c6e1e44 100644 --- a/arch/Makefile.am +++ b/arch/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS += -I$(top_srcdir)/ccstruct -I$(top_srcdir)/ccutil -I$(top_srcdir)/viewer -DUSE_STD_NAMESPACE +AM_CPPFLAGS += -I$(top_srcdir)/ccstruct -I$(top_srcdir)/ccutil -I$(top_srcdir)/viewer AUTOMAKE_OPTIONS = subdir-objects SUBDIRS = AM_CXXFLAGS = diff --git a/ccmain/Makefile.am b/ccmain/Makefile.am index c2516c8b23..63e9ee110d 100644 --- a/ccmain/Makefile.am +++ b/ccmain/Makefile.am @@ -1,5 +1,4 @@ AM_CPPFLAGS += \ - -DUSE_STD_NAMESPACE \ -I$(top_srcdir)/ccutil -I$(top_srcdir)/ccstruct \ -I$(top_srcdir)/arch -I$(top_srcdir)/lstm \ -I$(top_srcdir)/viewer \ diff --git a/ccstruct/Makefile.am b/ccstruct/Makefile.am index 9e63555ab9..a7f379b187 100644 --- a/ccstruct/Makefile.am +++ b/ccstruct/Makefile.am @@ -2,7 +2,7 @@ AM_CPPFLAGS += \ -I$(top_srcdir)/ccutil -I$(top_srcdir)/cutil \ -I$(top_srcdir)/viewer \ -I$(top_srcdir)/opencl -AM_CPPFLAGS += $(OPENCL_CPPFLAGS) -DUSE_STD_NAMESPACE +AM_CPPFLAGS += $(OPENCL_CPPFLAGS) if VISIBILITY AM_CPPFLAGS += -DTESS_EXPORTS \ diff --git a/ccutil/Makefile.am b/ccutil/Makefile.am index c7731eb360..40b201ca5e 100644 --- a/ccutil/Makefile.am +++ b/ccutil/Makefile.am @@ -1,7 +1,7 @@ AUTOMAKE_OPTIONS = subdir-objects SUBDIRS = AM_CXXFLAGS = -AM_CPPFLAGS = -DUSE_STD_NAMESPACE +AM_CPPFLAGS = if !NO_TESSDATA_PREFIX AM_CXXFLAGS += -DTESSDATA_PREFIX=@datadir@/ diff --git a/classify/Makefile.am b/classify/Makefile.am index 4a859e174b..3eaa2aa65b 100644 --- a/classify/Makefile.am +++ b/classify/Makefile.am @@ -1,7 +1,7 @@ AM_CPPFLAGS += \ -I$(top_srcdir)/cutil -I$(top_srcdir)/ccutil \ -I$(top_srcdir)/ccstruct -I$(top_srcdir)/dict \ - -I$(top_srcdir)/viewer -DUSE_STD_NAMESPACE + -I$(top_srcdir)/viewer if VISIBILITY AM_CPPFLAGS += -DTESS_EXPORTS \ diff --git a/cppan.yml b/cppan.yml index 740406af92..a09dac91c9 100644 --- a/cppan.yml +++ b/cppan.yml @@ -148,7 +148,6 @@ projects: public: - HAVE_CONFIG_H - _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS=1 - - USE_STD_NAMESPACE=1 - WINDLLNAME="tesseract" shared: definitions: diff --git a/cutil/Makefile.am b/cutil/Makefile.am index 5c45ea2262..049a6dfefc 100644 --- a/cutil/Makefile.am +++ b/cutil/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS += -I$(top_srcdir)/ccutil -I$(top_srcdir)/viewer -DUSE_STD_NAMESPACE +AM_CPPFLAGS += -I$(top_srcdir)/ccutil -I$(top_srcdir)/viewer if VISIBILITY AM_CPPFLAGS += -DTESS_EXPORTS \ diff --git a/dict/Makefile.am b/dict/Makefile.am index f365c44368..49359c4214 100644 --- a/dict/Makefile.am +++ b/dict/Makefile.am @@ -1,5 +1,5 @@ AM_CPPFLAGS += -I$(top_srcdir)/cutil -I$(top_srcdir)/ccutil \ - -I$(top_srcdir)/ccstruct -I$(top_srcdir)/viewer -DUSE_STD_NAMESPACE + -I$(top_srcdir)/ccstruct -I$(top_srcdir)/viewer if VISIBILITY AM_CPPFLAGS += -DTESS_EXPORTS \ diff --git a/lstm/Makefile.am b/lstm/Makefile.am index d849de4559..a197a8c602 100644 --- a/lstm/Makefile.am +++ b/lstm/Makefile.am @@ -1,7 +1,7 @@ AM_CPPFLAGS += \ -I$(top_srcdir)/ccutil -I$(top_srcdir)/cutil -I$(top_srcdir)/ccstruct \ -I$(top_srcdir)/arch -I$(top_srcdir)/viewer -I$(top_srcdir)/classify \ - -I$(top_srcdir)/dict -I$(top_srcdir)/lstm -DUSE_STD_NAMESPACE + -I$(top_srcdir)/dict -I$(top_srcdir)/lstm AUTOMAKE_OPTIONS = subdir-objects SUBDIRS = AM_CXXFLAGS = $(OPENMP_CXXFLAGS) @@ -16,10 +16,10 @@ AM_CPPFLAGS += -DTESS_EXPORTS endif include_HEADERS = \ - convolve.h ctc.h fullyconnected.h functions.h input.h \ + convolve.h ctc.h fullyconnected.h functions.h input.h \ lstm.h lstmrecognizer.h lstmtrainer.h maxpool.h \ networkbuilder.h network.h networkio.h networkscratch.h \ - parallel.h plumbing.h recodebeam.h reconfig.h reversed.h \ + parallel.h plumbing.h recodebeam.h reconfig.h reversed.h \ series.h static_shape.h stridemap.h tfnetwork.h weightmatrix.h noinst_HEADERS = @@ -27,8 +27,8 @@ noinst_HEADERS = noinst_LTLIBRARIES = libtesseract_lstm.la libtesseract_lstm_la_SOURCES = \ - convolve.cpp ctc.cpp fullyconnected.cpp functions.cpp input.cpp \ + convolve.cpp ctc.cpp fullyconnected.cpp functions.cpp input.cpp \ lstm.cpp lstmrecognizer.cpp lstmtrainer.cpp maxpool.cpp \ networkbuilder.cpp network.cpp networkio.cpp \ - parallel.cpp plumbing.cpp recodebeam.cpp reconfig.cpp reversed.cpp \ + parallel.cpp plumbing.cpp recodebeam.cpp reconfig.cpp reversed.cpp \ series.cpp stridemap.cpp tfnetwork.cpp weightmatrix.cpp diff --git a/textord/Makefile.am b/textord/Makefile.am index 41c4db6b6c..e4b094088f 100644 --- a/textord/Makefile.am +++ b/textord/Makefile.am @@ -1,5 +1,4 @@ AM_CPPFLAGS += \ - -DUSE_STD_NAMESPACE \ -I$(top_srcdir)/ccstruct -I$(top_srcdir)/ccutil \ -I$(top_srcdir)/viewer \ -I$(top_srcdir)/ccmain -I$(top_srcdir)/wordrec -I$(top_srcdir)/api \ diff --git a/training/Makefile.am b/training/Makefile.am index b13ae43a1e..8a6272fb93 100644 --- a/training/Makefile.am +++ b/training/Makefile.am @@ -1,6 +1,6 @@ AUTOMAKE_OPTIONS = subdir-objects AM_CPPFLAGS += \ - -DUSE_STD_NAMESPACE -DPANGO_ENABLE_ENGINE\ + -DPANGO_ENABLE_ENGINE \ -I$(top_srcdir)/ccmain -I$(top_srcdir)/api \ -I$(top_srcdir)/ccutil -I$(top_srcdir)/ccstruct \ -I$(top_srcdir)/lstm -I$(top_srcdir)/arch \ diff --git a/training/util.h b/training/util.h index 7815c3448d..fab5dfcdeb 100644 --- a/training/util.h +++ b/training/util.h @@ -55,7 +55,7 @@ struct StringHash : public stdext::hash_compare { }; #endif // !COMPILER_MSVC -#ifndef USE_STD_NAMESPACE +#ifdef GOOGLE_TESSERACT #include "base/heap-checker.h" #define DISABLE_HEAP_LEAK_CHECK HeapLeakChecker::Disabler disabler #else diff --git a/unittest/Makefile.am b/unittest/Makefile.am index 01ebcd8e40..dbb15e2de3 100644 --- a/unittest/Makefile.am +++ b/unittest/Makefile.am @@ -1,6 +1,6 @@ AUTOMAKE_OPTIONS = subdir-objects -AM_CPPFLAGS += -DUSE_STD_NAMESPACE -DPANGO_ENABLE_ENGINE +AM_CPPFLAGS += -DPANGO_ENABLE_ENGINE AM_CPPFLAGS += -I$(top_srcdir)/api AM_CPPFLAGS += -I$(top_srcdir)/arch AM_CPPFLAGS += -I$(top_srcdir)/ccmain @@ -14,7 +14,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/lstm AM_CPPFLAGS += -I$(top_srcdir)/textord AM_CPPFLAGS += -I$(top_srcdir)/viewer AM_CPPFLAGS += -I$(top_srcdir)/wordrec - + # Build googletest: check_LTLIBRARIES = libgtest.la libgtest_main.la libgtest_la_SOURCES = ../googletest/googletest/src/gtest-all.cc @@ -36,7 +36,7 @@ check_PROGRAMS = \ TESTS = $(check_PROGRAMS) #List of source files needed to build the executable: - + apiexample_test_SOURCES = apiexample_test.cc apiexample_test_LDFLAGS = $(OPENCL_LDFLAGS) $(LEPTONICA_LIBS) apiexample_test_LDADD = $(GTEST_LIBS) $(TESS_LIBS) $(LEPTONICA_LIBS) diff --git a/wordrec/Makefile.am b/wordrec/Makefile.am index e6aa30beff..c5fb7dc60d 100644 --- a/wordrec/Makefile.am +++ b/wordrec/Makefile.am @@ -2,7 +2,7 @@ AM_CPPFLAGS += \ -I$(top_srcdir)/ccstruct -I$(top_srcdir)/ccutil \ -I$(top_srcdir)/cutil -I$(top_srcdir)/classify \ -I$(top_srcdir)/dict \ - -I$(top_srcdir)/viewer -DUSE_STD_NAMESPACE + -I$(top_srcdir)/viewer if VISIBILITY AM_CPPFLAGS += -DTESS_EXPORTS \