diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de749f55b..560e6f771 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -204,23 +204,6 @@ jobs: if: steps.cache-local.outputs.cache-hit != 'true' run: ./install_wxpdfdoc.sh - - name: Build Boost.Regex - if: matrix.autotools - run: | - # Define flags to avoid warnings in Boost code we don't care about. - boost_cxxflags="-Wno-deprecated-declarations -Wno-register -DBOOST_NO_AUTO_PTR -DBOOST_NO_STD_ALLOCATOR" - if [ "${{ matrix.compiler }}" = clang ]; then - boost_cxxflags="${boost_cxxflags} -Wno-parentheses-equality" - fi - - for lib in regex; do - cd /opt/lmi/third_party/src/boost/libs/${lib}/src - echo "Compiling $lib sources" - ${CXX-${LMI_COMPILER}} -std=c++17 -fPIC $(echo ${boost_cxxflags}) -I../../.. -c *.cpp - echo "Creating libboost_${lib}.a from" *.o - ar rc /opt/lmi/local/${LMI_COMPILER}_${LMI_TRIPLET}/lib/libboost_${lib}.a *.o - done - - name: Configure lmi if: matrix.autotools run: | diff --git a/Makefile.am b/Makefile.am index de4c393b8..c2901b8e6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1132,7 +1132,6 @@ noinst_HEADERS = \ authenticity.hpp \ basic_tables.hpp \ basic_values.hpp \ - boost_regex.hpp \ bourn_cast.hpp \ cache_file_reads.hpp \ calendar_date.hpp \ diff --git a/boost_1_33_1.patch b/boost_1_33_1.patch deleted file mode 100644 index 02ae5174b..000000000 --- a/boost_1_33_1.patch +++ /dev/null @@ -1,330 +0,0 @@ -diff --recursive '--unified=3' original/boost_1_33_1/boost/mpl/apply.hpp modified/boost_1_33_1/boost/mpl/apply.hpp ---- original/boost_1_33_1/boost/mpl/apply.hpp 2004-09-02 15:40:41.000000000 +0000 -+++ modified/boost_1_33_1/boost/mpl/apply.hpp 2019-03-20 23:47:48.629517270 +0000 -@@ -135,7 +135,10 @@ - - ///// iteration, depth == 1 - --#elif BOOST_PP_ITERATION_DEPTH() == 1 -+// For gcc 4.4 compatability, we must include the -+// BOOST_PP_ITERATION_DEPTH test inside an #else clause. -+#else // BOOST_PP_IS_ITERATING -+#if BOOST_PP_ITERATION_DEPTH() == 1 - - # define i_ BOOST_PP_FRAME_ITERATION(1) - -@@ -222,4 +225,5 @@ - - # undef i_ - -+#endif // BOOST_PP_ITERATION_DEPTH() - #endif // BOOST_PP_IS_ITERATING -diff --recursive '--unified=3' original/boost_1_33_1/boost/mpl/apply_wrap.hpp modified/boost_1_33_1/boost/mpl/apply_wrap.hpp ---- original/boost_1_33_1/boost/mpl/apply_wrap.hpp 2004-09-03 15:56:55.000000000 +0000 -+++ modified/boost_1_33_1/boost/mpl/apply_wrap.hpp 2019-03-20 23:47:48.629517270 +0000 -@@ -78,7 +78,10 @@ - - ///// iteration, depth == 1 - --#elif BOOST_PP_ITERATION_DEPTH() == 1 -+// For gcc 4.4 compatability, we must include the -+// BOOST_PP_ITERATION_DEPTH test inside an #else clause. -+#else // BOOST_PP_IS_ITERATING -+#if BOOST_PP_ITERATION_DEPTH() == 1 - - # define i_ BOOST_PP_FRAME_ITERATION(1) - -@@ -197,4 +200,5 @@ - - # undef j_ - -+#endif // BOOST_PP_ITERATION_DEPTH() - #endif // BOOST_PP_IS_ITERATING -diff --recursive '--unified=3' original/boost_1_33_1/boost/mpl/aux_/advance_backward.hpp modified/boost_1_33_1/boost/mpl/aux_/advance_backward.hpp ---- original/boost_1_33_1/boost/mpl/aux_/advance_backward.hpp 2004-09-02 15:40:43.000000000 +0000 -+++ modified/boost_1_33_1/boost/mpl/aux_/advance_backward.hpp 2019-03-20 23:47:48.629517270 +0000 -@@ -79,7 +79,10 @@ - - ///// iteration, depth == 1 - --#elif BOOST_PP_ITERATION_DEPTH() == 1 -+// For gcc 4.4 compatability, we must include the -+// BOOST_PP_ITERATION_DEPTH test inside an #else clause. -+#else // BOOST_PP_IS_ITERATING -+#if BOOST_PP_ITERATION_DEPTH() == 1 - #define i_ BOOST_PP_FRAME_ITERATION(1) - - template<> -@@ -121,4 +124,5 @@ - # undef AUX778076_ITER_1 - # undef AUX778076_ITER_0 - -+#endif // BOOST_PP_ITERATION_DEPTH() - #endif // BOOST_PP_IS_ITERATING -diff --recursive '--unified=3' original/boost_1_33_1/boost/mpl/aux_/advance_forward.hpp modified/boost_1_33_1/boost/mpl/aux_/advance_forward.hpp ---- original/boost_1_33_1/boost/mpl/aux_/advance_forward.hpp 2004-09-02 15:40:43.000000000 +0000 -+++ modified/boost_1_33_1/boost/mpl/aux_/advance_forward.hpp 2019-03-20 23:47:48.629517270 +0000 -@@ -79,7 +79,10 @@ - - ///// iteration, depth == 1 - --#elif BOOST_PP_ITERATION_DEPTH() == 1 -+// For gcc 4.4 compatability, we must include the -+// BOOST_PP_ITERATION_DEPTH test inside an #else clause. -+#else // BOOST_PP_IS_ITERATING -+#if BOOST_PP_ITERATION_DEPTH() == 1 - #define i_ BOOST_PP_FRAME_ITERATION(1) - - template<> -@@ -120,4 +123,5 @@ - # undef AUX778076_ITER_1 - # undef AUX778076_ITER_0 - -+#endif // BOOST_PP_ITERATION_DEPTH() - #endif // BOOST_PP_IS_ITERATING -diff --recursive '--unified=3' original/boost_1_33_1/boost/mpl/aux_/full_lambda.hpp modified/boost_1_33_1/boost/mpl/aux_/full_lambda.hpp ---- original/boost_1_33_1/boost/mpl/aux_/full_lambda.hpp 2004-09-04 01:10:19.000000000 +0000 -+++ modified/boost_1_33_1/boost/mpl/aux_/full_lambda.hpp 2019-03-20 23:47:48.629517270 +0000 -@@ -227,7 +227,10 @@ - - ///// iteration, depth == 1 - --#elif BOOST_PP_ITERATION_DEPTH() == 1 -+// For gcc 4.4 compatability, we must include the -+// BOOST_PP_ITERATION_DEPTH test inside an #else clause. -+#else // BOOST_PP_IS_ITERATING -+#if BOOST_PP_ITERATION_DEPTH() == 1 - #define i_ BOOST_PP_FRAME_ITERATION(1) - - #if i_ > 0 -@@ -347,4 +350,5 @@ - }; - - #undef i_ -+#endif // BOOST_PP_ITERATION_DEPTH() - #endif // BOOST_PP_IS_ITERATING -diff --recursive '--unified=3' original/boost_1_33_1/boost/mpl/aux_/numeric_op.hpp modified/boost_1_33_1/boost/mpl/aux_/numeric_op.hpp ---- original/boost_1_33_1/boost/mpl/aux_/numeric_op.hpp 2004-12-20 19:17:06.000000000 +0000 -+++ modified/boost_1_33_1/boost/mpl/aux_/numeric_op.hpp 2019-03-20 23:47:48.629517270 +0000 -@@ -287,7 +287,10 @@ - - ///// iteration, depth == 1 - --#elif BOOST_PP_ITERATION_DEPTH() == 1 -+// For gcc 4.4 compatability, we must include the -+// BOOST_PP_ITERATION_DEPTH test inside an #else clause. -+#else // BOOST_PP_IS_ITERATING -+#if BOOST_PP_ITERATION_DEPTH() == 1 - - # define i_ BOOST_PP_FRAME_ITERATION(1) - -@@ -308,4 +311,5 @@ - - # undef i_ - -+#endif // BOOST_PP_ITERATION_DEPTH() - #endif // BOOST_PP_IS_ITERATING -diff --recursive '--unified=3' original/boost_1_33_1/boost/mpl/aux_/static_cast.hpp modified/boost_1_33_1/boost/mpl/aux_/static_cast.hpp ---- original/boost_1_33_1/boost/mpl/aux_/static_cast.hpp 2004-09-02 15:40:44.000000000 +0000 -+++ modified/boost_1_33_1/boost/mpl/aux_/static_cast.hpp 2019-03-20 23:51:15.951618377 +0000 -@@ -21,7 +21,7 @@ - || BOOST_WORKAROUND(__MWERKS__, <= 0x3001) - # define BOOST_MPL_AUX_STATIC_CAST(T, expr) (T)(expr) - #else --# define BOOST_MPL_AUX_STATIC_CAST(T, expr) static_cast(expr) -+# define BOOST_MPL_AUX_STATIC_CAST(T, expr) (T)(expr) - #endif - - #endif // BOOST_MPL_AUX_STATIC_CAST_HPP_INCLUDED -diff --recursive '--unified=3' original/boost_1_33_1/boost/mpl/bind.hpp modified/boost_1_33_1/boost/mpl/bind.hpp ---- original/boost_1_33_1/boost/mpl/bind.hpp 2004-10-26 14:51:04.000000000 +0000 -+++ modified/boost_1_33_1/boost/mpl/bind.hpp 2019-03-20 23:47:48.629517270 +0000 -@@ -361,7 +361,10 @@ - - ///// iteration, depth == 1 - --#elif BOOST_PP_ITERATION_DEPTH() == 1 -+// For gcc 4.4 compatability, we must include the -+// BOOST_PP_ITERATION_DEPTH test inside an #else clause. -+#else // BOOST_PP_IS_ITERATING -+#if BOOST_PP_ITERATION_DEPTH() == 1 - - # define i_ BOOST_PP_FRAME_ITERATION(1) - -@@ -544,4 +547,5 @@ - # endif - # undef j_ - -+#endif // BOOST_PP_ITERATION_DEPTH() - #endif // BOOST_PP_IS_ITERATING -diff --recursive '--unified=3' original/boost_1_33_1/boost/mpl/unpack_args.hpp modified/boost_1_33_1/boost/mpl/unpack_args.hpp ---- original/boost_1_33_1/boost/mpl/unpack_args.hpp 2004-09-02 15:40:42.000000000 +0000 -+++ modified/boost_1_33_1/boost/mpl/unpack_args.hpp 2019-03-20 23:47:48.629517270 +0000 -@@ -111,7 +111,10 @@ - - ///// iteration, depth == 1 - --#elif BOOST_PP_ITERATION_DEPTH() == 1 -+// For gcc 4.4 compatability, we must include the -+// BOOST_PP_ITERATION_DEPTH test inside an #else clause. -+#else // BOOST_PP_IS_ITERATING -+#if BOOST_PP_ITERATION_DEPTH() == 1 - - # define i_ BOOST_PP_FRAME_ITERATION(1) - -@@ -143,4 +146,5 @@ - - # undef i_ - -+#endif // BOOST_PP_ITERATION_DEPTH() - #endif // BOOST_PP_IS_ITERATING -diff --recursive '--unified=3' original/boost_1_33_1/boost/numeric/ublas/detail/vector_assign.hpp modified/boost_1_33_1/boost/numeric/ublas/detail/vector_assign.hpp ---- original/boost_1_33_1/boost/numeric/ublas/detail/vector_assign.hpp 2005-07-01 20:09:01.000000000 +0000 -+++ modified/boost_1_33_1/boost/numeric/ublas/detail/vector_assign.hpp 2019-03-20 23:47:48.629517270 +0000 -@@ -139,7 +139,10 @@ - void vector_assign_scalar (V &v, const T &t, dense_proxy_tag) { - #ifdef BOOST_UBLAS_USE_INDEXING - indexing_vector_assign_scalar (v, t); --#elif BOOST_UBLAS_USE_ITERATING -+// For gcc 4.4 compatability, we must include the -+// BOOST_UBLAS_USE_ITERATING test inside an #else clause. -+#else // BOOST_UBLAS_USE_INDEXING -+#if BOOST_UBLAS_USE_ITERATING - iterating_vector_assign_scalar (v, t); - #else - typedef typename V::size_type size_type; -@@ -148,6 +151,7 @@ - iterating_vector_assign_scalar (v, t); - else - indexing_vector_assign_scalar (v, t); -+#endif // BOOST_UBLAS_USE_ITERATING - #endif - } - // Packed (proxy) case -@@ -278,7 +282,10 @@ - void vector_assign (V &v, const vector_expression &e, dense_proxy_tag) { - #ifdef BOOST_UBLAS_USE_INDEXING - indexing_vector_assign (v, e); --#elif BOOST_UBLAS_USE_ITERATING -+// For gcc 4.4 compatability, we must include the -+// BOOST_UBLAS_USE_ITERATING test inside an #else clause. -+#else // BOOST_UBLAS_USE_INDEXING -+#if BOOST_UBLAS_USE_ITERATING - iterating_vector_assign (v, e); - #else - typedef typename V::size_type size_type; -@@ -287,6 +294,7 @@ - iterating_vector_assign (v, e); - else - indexing_vector_assign (v, e); -+#endif // BOOST_UBLAS_USE_ITERATING - #endif - } - // Packed (proxy) case -diff --recursive '--unified=3' original/boost_1_33_1/boost/numeric/ublas/vector_expression.hpp modified/boost_1_33_1/boost/numeric/ublas/vector_expression.hpp ---- original/boost_1_33_1/boost/numeric/ublas/vector_expression.hpp 2005-07-13 05:57:36.000000000 +0000 -+++ modified/boost_1_33_1/boost/numeric/ublas/vector_expression.hpp 2019-03-20 23:47:48.629517270 +0000 -@@ -1388,7 +1388,10 @@ - value_type evaluate (dense_random_access_iterator_tag) const { - #ifdef BOOST_UBLAS_USE_INDEXING - return functor_type::apply (e_); --#elif BOOST_UBLAS_USE_ITERATING -+// For gcc 4.4 compatability, we must include the -+// BOOST_UBLAS_USE_ITERATING test inside an #else clause. -+#else // BOOST_UBLAS_USE_INDEXING -+#if BOOST_UBLAS_USE_ITERATING - difference_type size = e_.size (); - return functor_type::apply (size, e_.begin ()); - #else -@@ -1397,6 +1400,7 @@ - return functor_type::apply (size, e_.begin ()); - else - return functor_type::apply (e_); -+#endif // BOOST_UBLAS_USE_ITERATING - #endif - } - -@@ -1525,7 +1529,10 @@ - value_type evaluate (dense_random_access_iterator_tag) const { - #ifdef BOOST_UBLAS_USE_INDEXING - return functor_type::apply (e1_, e2_); --#elif BOOST_UBLAS_USE_ITERATING -+// For gcc 4.4 compatability, we must include the -+// BOOST_UBLAS_USE_ITERATING test inside an #else clause. -+#else // BOOST_UBLAS_USE_INDEXING -+#if BOOST_UBLAS_USE_ITERATING - difference_type size = BOOST_UBLAS_SAME (e1_.size (), e2_.size ()); - return functor_type::apply (size, e1_.begin (), e2_.begin ()); - #else -@@ -1534,6 +1541,7 @@ - return functor_type::apply (size, e1_.begin (), e2_.begin ()); - else - return functor_type::apply (e1_, e2_); -+#endif // BOOST_UBLAS_USE_ITERATING - #endif - } - -diff --recursive '--unified=3' original/boost_1_33_1/libs/regex/src/cregex.cpp modified/boost_1_33_1/libs/regex/src/cregex.cpp ---- original/boost_1_33_1/libs/regex/src/cregex.cpp 2005-03-30 11:38:32.000000000 +0000 -+++ modified/boost_1_33_1/libs/regex/src/cregex.cpp 2019-03-20 23:47:48.633517467 +0000 -@@ -362,7 +362,7 @@ - #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) - (::sprintf_s)(buf, sizeof(buf), "%s%s%s", dstart.path(), directory_iterator::separator(), ptr); - #else -- (std::sprintf)(buf, "%s%s%s", dstart.path(), directory_iterator::separator(), ptr); -+ sprintf(buf, "%s%s%s", dstart.path(), directory_iterator::separator(), ptr); - #endif - BuildFileList(pl, buf, recurse); - ++dstart; -diff --recursive '--unified=3' original/boost_1_33_1/libs/regex/src/fileiter.cpp modified/boost_1_33_1/libs/regex/src/fileiter.cpp ---- original/boost_1_33_1/libs/regex/src/fileiter.cpp 2005-03-30 11:38:32.000000000 +0000 -+++ modified/boost_1_33_1/libs/regex/src/fileiter.cpp 2019-03-20 23:47:48.633517467 +0000 -@@ -30,7 +30,6 @@ - #include - #if defined(BOOST_NO_STDC_NAMESPACE) - namespace std{ -- using ::sprintf; - using ::fseek; - using ::fread; - using ::ftell; -@@ -788,9 +787,9 @@ - { - char buf[MAX_PATH]; - if( ( (root[0] == *_fi_sep) || (root[0] == *_fi_sep_alt) ) && (root[1] == '\0') ) -- (std::sprintf)(buf, "%s%s", root, name); -+ sprintf(buf, "%s%s", root, name); - else -- (std::sprintf)(buf, "%s%s%s", root, _fi_sep, name); -+ sprintf(buf, "%s%s%s", root, _fi_sep, name); - DIR* d = opendir(buf); - if(d) - { -diff --recursive '--unified=3' original/boost_1_33_1/libs/regex/src/posix_api.cpp modified/boost_1_33_1/libs/regex/src/posix_api.cpp ---- original/boost_1_33_1/libs/regex/src/posix_api.cpp 2005-03-30 11:38:32.000000000 +0000 -+++ modified/boost_1_33_1/libs/regex/src/posix_api.cpp 2019-03-20 23:47:48.633517467 +0000 -@@ -24,7 +24,6 @@ - - #if defined(BOOST_NO_STDC_NAMESPACE) - namespace std{ -- using ::sprintf; - using ::strcpy; - using ::strcmp; - } -@@ -148,7 +147,7 @@ - #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) - (::sprintf_s)(localbuf, 5, "%d", i); - #else -- (std::sprintf)(localbuf, "%d", i); -+ sprintf(localbuf, "%d", i); - #endif - if(std::strlen(localbuf) < buf_size) - re_detail::strcpy_s(buf, buf_size, localbuf); -@@ -158,7 +157,7 @@ - #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) - (::sprintf_s)(localbuf, 5, "%d", 0); - #else -- (std::sprintf)(localbuf, "%d", 0); -+ sprintf(localbuf, "%d", 0); - #endif - if(std::strlen(localbuf) < buf_size) - re_detail::strcpy_s(buf, buf_size, localbuf); diff --git a/boost_regex.hpp b/boost_regex.hpp deleted file mode 100644 index c69fc7ebd..000000000 --- a/boost_regex.hpp +++ /dev/null @@ -1,57 +0,0 @@ -// Include boost/regex.hpp, guarding it with a pragma. -// -// Copyright (C) 2017, 2018, 2019, 2020, 2021 Gregory W. Chicares. -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License version 2 as -// published by the Free Software Foundation. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA -// -// https://savannah.nongnu.org/projects/lmi -// email: -// snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA - -#ifndef boost_regex_hpp -#define boost_regex_hpp - -#include "config.hpp" - -#if defined LMI_CLANG -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wchar-subscripts" -# pragma clang diagnostic ignored "-Wdeprecated-declarations" -# pragma clang diagnostic ignored "-Wdeprecated-copy" -# pragma clang diagnostic ignored "-Wkeyword-macro" -# pragma clang diagnostic ignored "-Wparentheses-equality" -# pragma clang diagnostic ignored "-Wregister" -#endif // defined LMI_CLANG -#if defined LMI_GCC -# pragma GCC diagnostic push -# if 7 <= __GNUC__ -# pragma GCC diagnostic ignored "-Wimplicit-fallthrough" -# pragma GCC diagnostic ignored "-Wregister" -# endif // 7 <= __GNUC__ -# if 9 <= __GNUC__ -# pragma GCC diagnostic ignored "-Wdeprecated-copy" -# endif // 9 <= __GNUC__ -# pragma GCC diagnostic ignored "-Wshadow" -# pragma GCC diagnostic ignored "-Wswitch-enum" -# pragma GCC diagnostic ignored "-Wuseless-cast" -#endif // defined LMI_GCC -#include -#if defined LMI_GCC -# pragma GCC diagnostic pop -#endif // defined LMI_GCC -#if defined LMI_CLANG -# pragma clang diagnostic pop -#endif // defined LMI_CLANG - -#endif // boost_regex_hpp diff --git a/configure.ac b/configure.ac index acd94f55d..b4a4d1fce 100644 --- a/configure.ac +++ b/configure.ac @@ -57,13 +57,6 @@ dnl === Command line options === AC_ARG_WITH(boost-headers, [AC_HELP_STRING([--with-boost-headers=dir], [Boost headers directory])], lmi_boost_headers=$withval) -AC_ARG_WITH(boost-libs, - [AC_HELP_STRING([--with-boost-libs=dir], [Boost libs installation directory])], - lmi_boost_libs=$withval) -AC_ARG_WITH(boost-toolkit, - [AC_HELP_STRING([--with-boost-toolkit=dir], [Boost installation toolkit (gcc, mgw, etc.)])], - lmi_boost_toolkit=$withval) - dnl add support for --wxdir, --wx-config, --wx-prefix, ----wx-exec-prefix WX_CONFIG_OPTIONS @@ -413,56 +406,6 @@ AC_CHECK_HEADER([boost/type_traits.hpp], [AC_MSG_FAILURE([Boost headers not found, $errmsg])], [AC_INCLUDES_DEFAULT()] ) - -dnl The default boost library name should be used unless otherwise specified -dnl via --with-boost-tookit options, in which case we need to add -dnl toolkit suffix to the library name (example -lboost_regex-gcc-mt). -if test "x$lmi_boost_toolkit" != "x"; then - lmi_boost_toolkit="-$lmi_boost_toolkit" -fi -boost_libsystem="boost_system$lmi_boost_toolkit" -boost_libregex="boost_regex$lmi_boost_toolkit" - -save_CPPFLAGS=$CPPFLAGS -save_LIBS=$LIBS -save_LDFLAGS=$LDFLAGS -if test "x$lmi_boost_libs" != "x"; then - BOOST_LDFLAGS="$BOOST_LDFLAGS -L$lmi_boost_libs " - LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" - errmsg="even in $lmi_boost_libs" -else - errmsg="use --with-boost-libs=dir -if it is installed in non default location" -fi - -dnl latest versions of boost extract some common functionality in -dnl libboost_system which we must link when using any other Boost library, so -dnl check for it first -AC_CHECK_LIB($boost_libsystem,main,BOOST_LIBS="-l$boost_libsystem") - -dnl usually when we want to check for a library we use AC_CHECK_LIB and main() -dnl but since under mingw with -pedantic and -std= options test does not pass -dnl we are forced to use a bit more sophisticated construct and include our own -dnl wrapper header which disables various warnings that occur in Boost headers - -CPPFLAGS="$save_CPPFLAGS -I$srcdir" -LIBS="$save_LIBS -l$boost_libregex" -AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "boost_regex.hpp"]], - [[boost::regex *r]])], - [], - [AC_MSG_FAILURE([Boost regex library $boost_libregex not found, $errmsg])] -) - -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS -CPPFLAGS=$save_CPPFLAGS - -BOOST_LIBS="-l$boost_libregex $BOOST_LIBS" - -dnl contains flags needed to link to externally or internally built -dnl boost libraries -AC_SUBST(BOOST_LIBS) - dnl check for the other required libraries: under Unix we use pkg-config which dnl is easily available for (and often already installed under) any Linux dnl system but when using Cygwin we do the checks manually as installing diff --git a/objects.make b/objects.make index 6c253e07d..aff078b3a 100644 --- a/objects.make +++ b/objects.make @@ -25,32 +25,6 @@ # is reached through 'vpath' directives. See the rationale in # 'workhorse.make'. -# Boost regex library. The other boost libraries that lmi optionally -# uses are implemented entirely in headers. -# -# As for listing the object files here, the regex author says: -# http://groups.google.com/group/boost-list/msg/7f925ca50d69384b -# | add the libs/regex/src/*.cpp files to your project - -boost_regex_objects := \ - c_regex_traits.o \ - cpp_regex_traits.o \ - cregex.o \ - fileiter.o \ - icu.o \ - instances.o \ - posix_api.o \ - regex.o \ - regex_debug.o \ - regex_raw_buffer.o \ - regex_traits_defaults.o \ - static_mutex.o \ - usinstances.o \ - w32_regex_traits.o \ - wc_regex_traits.o \ - wide_posix_api.o \ - winstances.o \ - # GNU cgicc. # TODO ?? Track down the problems in cgicc-3.2.3 that make it @@ -101,7 +75,6 @@ cgicc_3_1_4_objects = \ # have them as libraries. ifdef HAVE_THIRD_PARTY_LIBRARIES - boost_regex_objects := cgicc_objects := endif @@ -348,7 +321,6 @@ lmi_wx_objects := \ main_wx.o \ wx_test_objects := \ - $(boost_regex_objects) \ main_wx_test.o \ wx_test_about_version.o \ wx_test_benchmark_census.o \ @@ -964,7 +936,6 @@ rate_table_test$(EXEEXT): \ rate_table_test.o \ regex_test$(EXEEXT): \ - $(boost_regex_objects) \ $(common_test_objects) \ regex_test.o \ timer.o \ @@ -1133,7 +1104,6 @@ rate_table_tool$(EXEEXT): \ test_coding_rules_test := PERFORM=$(PERFORM) $(srcdir)/test_coding_rules_test.sh test_coding_rules$(EXEEXT): POST_LINK_COMMAND = $(test_coding_rules_test) test_coding_rules$(EXEEXT): \ - $(boost_regex_objects) \ $(main_auxiliary_common_objects) \ miscellany.o \ my_test_coding_rules.o \ diff --git a/regex_test.cpp b/regex_test.cpp index 12b83783f..717a39386 100644 --- a/regex_test.cpp +++ b/regex_test.cpp @@ -21,12 +21,11 @@ #include "pchfile.hpp" -#include "boost_regex.hpp" - #include "contains.hpp" #include "test_tools.hpp" #include "timer.hpp" +#include #include #include #include @@ -115,57 +114,16 @@ bool contains_regex0(std::string const& regex) /// m logical lines delimited by '\n' no /// ms logical lines delimited by '\n' yes /// -/// Perl's 's' is the default for boost regex; boost offers -/// http://boost.org/libs/regex/doc/syntax_option_type.html -/// "no_mod_s" and -/// http://boost.org/libs/regex/doc/match_flag_type.html -/// "match_not_dot_newline" to prevent '.' from matching '\n', as well -/// as recognizing "(?-s)" in the regex. However, TR1 -/// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf -/// does not: -/// -/// [7.5.2] omits boost's "match_not_dot_newline"; and -/// -/// [7.5.1] offers "awk", "grep", and "egrep" syntax options, but -/// defines them in terms of IEEE 1003.1-2001 -/// http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap09.html -/// which requires '.' to match '\n'. -/// -/// TR1 implements only POSIX and ECMAScript behavior; the latter -/// http://www.ecma-international.org/publications/files/ecma-st/ECMA-262.pdf -/// [15.10.4.1] describes a "multiline property", but excludes 's'. -/// However, TR1 offers no way to manipulate even that "property", -/// much less to set or unset the Perl 's' modifier. -/// -/// Furthermore, in dinkumware's TR1 implementation, a '.' wildcard -/// matches anything except '\n': -/// http://www.dinkumware.com/manuals/?manual=compleat&page=lib_regex.html#wildcard%20character -/// "A wildcard character matches any character in the target -/// expression except a newline" -/// whereas ECMA-262 section 15.10.2.8 says '.' matches -/// the set of all characters except the four line terminator -/// characters , , , or -/// yet '.' matches anything in the boost implementation. -/// -/// Conclusion: TR1 offers no control over 's' or 'm' behavior, and -/// implementors seem not to agree even on what '.' matches. Where -/// such questions matter in code that's desired to be compatible with -/// TR1, there seem to be only two viable options: -/// - use a vectorized approach such as this; or -/// - write regexen with -/// - "[^\\n]" or R"([^\n])" instead of '.', and -/// - "\n" instead of '^' and '$' anchors -/// and prepend a '\n' sentry to the string to be searched (and -/// assert that all files end in '\n'). -/// The second option is far more attractive for performance reasons, -/// as this unit test shows. +/// In C++11, the behaviour of each of the metacharacters is fixed and can only +/// be changed by switching to a non-default regex syntax. The tests here +/// compare performance of matching using different syntaxes. bool contains_regex1(std::string const& regex) { - boost::regex const r(regex, boost::regex::sed); + std::regex const r(regex, std::regex::basic | std::regex::optimize); for(auto const& i : lines) { - if(boost::regex_search(i, r)) + if(std::regex_search(i, r)) { return true; } @@ -173,18 +131,23 @@ bool contains_regex1(std::string const& regex) return false; } -/// Match a regex as with Perl's '-s'. +/// Match a regex as with Perl's '-s', i.e. dot does not match new line. bool contains_regex2(std::string const& regex) { - return boost::regex_search(text, boost::regex("(?-s)" + regex)); + // This is the behaviour of dot metacharacter in the default ECMAScript + // syntax. + return std::regex_search(text, std::regex(regex, std::regex::optimize)); } -/// Match a regex as with Perl's 's'. +/// Match a regex as with Perl's 's', i.e. dot matches new line. bool contains_regex3(std::string const& regex) { - return boost::regex_search(text, boost::regex(regex)); + // To make dot match the new line character, one of POSIX regex syntaxes + // must be used, arbitrarily choose the basic one as the exact syntax + // doesn't matter for the regular expressions used in this test. + return std::regex_search(text, std::regex(regex, std::regex::basic | std::regex::optimize)); } void mete_vectorize() @@ -318,88 +281,88 @@ void test_input_sequence_regex() // This is intended to be useful with xml schema languages, which // implicitly anchor the entire regex, so '^' and '$' aren't used. - boost::regex const r(R); + std::regex const r(R); // Tests that are designed to succeed. // Simple scalars. - LMI_TEST( boost::regex_match("1234" , r)); - LMI_TEST( boost::regex_match("glp" , r)); + LMI_TEST( std::regex_match("1234" , r)); + LMI_TEST( std::regex_match("glp" , r)); // Semicolon-delimited values, as expected in inforce extracts. - LMI_TEST( boost::regex_match("123;456;0" , r)); + LMI_TEST( std::regex_match("123;456;0" , r)); // Same, with whitespace. - LMI_TEST( boost::regex_match("123; 456; 0" , r)); - LMI_TEST( boost::regex_match("123 ;456 ;0" , r)); - LMI_TEST( boost::regex_match("123; 456; 0" , r)); - LMI_TEST( boost::regex_match("123 ;456 ;0" , r)); - LMI_TEST( boost::regex_match(" 123 ; 456 ; 0 " , r)); - LMI_TEST( boost::regex_match(" 123 ; 456 ; 0 " , r)); + LMI_TEST( std::regex_match("123; 456; 0" , r)); + LMI_TEST( std::regex_match("123 ;456 ;0" , r)); + LMI_TEST( std::regex_match("123; 456; 0" , r)); + LMI_TEST( std::regex_match("123 ;456 ;0" , r)); + LMI_TEST( std::regex_match(" 123 ; 456 ; 0 " , r)); + LMI_TEST( std::regex_match(" 123 ; 456 ; 0 " , r)); // Same, with optional terminal semicolon. - LMI_TEST( boost::regex_match(" 123 ; 456 ; 0 ;" , r)); - LMI_TEST( boost::regex_match(" 123 ; 456 ; 0 ; " , r)); + LMI_TEST( std::regex_match(" 123 ; 456 ; 0 ;" , r)); + LMI_TEST( std::regex_match(" 123 ; 456 ; 0 ; " , r)); // Single scalar with terminal semicolon and various whitespace. - LMI_TEST( boost::regex_match("123;" , r)); - LMI_TEST( boost::regex_match("123 ;" , r)); - LMI_TEST( boost::regex_match("123; " , r)); - LMI_TEST( boost::regex_match(" 123 ; " , r)); + LMI_TEST( std::regex_match("123;" , r)); + LMI_TEST( std::regex_match("123 ;" , r)); + LMI_TEST( std::regex_match("123; " , r)); + LMI_TEST( std::regex_match(" 123 ; " , r)); // Negatives (e.g., "negative" loans representing repayments). - LMI_TEST( boost::regex_match("-987; -654" , r)); + LMI_TEST( std::regex_match("-987; -654" , r)); // Decimals. - LMI_TEST( boost::regex_match("0.;.0;0.0;1234.5678" , r)); + LMI_TEST( std::regex_match("0.;.0;0.0;1234.5678" , r)); // Decimals, along with '#' and '@'. - LMI_TEST( boost::regex_match("0.,2;.0,#3;0.0,@75;1234.5678" , r)); + LMI_TEST( std::regex_match("0.,2;.0,#3;0.0,@75;1234.5678" , r)); // Same, with whitespace. - LMI_TEST( boost::regex_match(" 0. , 2 ; .0 , # 3 ; 0.0 , @ 75 ; 1234.5678 " , r)); + LMI_TEST( std::regex_match(" 0. , 2 ; .0 , # 3 ; 0.0 , @ 75 ; 1234.5678 " , r)); // No numbers--only keywords. - LMI_TEST( boost::regex_match("salary,retirement;corridor,maturity" , r)); + LMI_TEST( std::regex_match("salary,retirement;corridor,maturity" , r)); // Same, with whitespace. - LMI_TEST( boost::regex_match(" salary , retirement; corridor , maturity" , r)); - LMI_TEST( boost::regex_match(" salary , retirement; corridor , maturity " , r)); - LMI_TEST( boost::regex_match(" salary , retirement ; corridor , maturity" , r)); - LMI_TEST( boost::regex_match(" salary , retirement ; corridor , maturity " , r)); + LMI_TEST( std::regex_match(" salary , retirement; corridor , maturity" , r)); + LMI_TEST( std::regex_match(" salary , retirement; corridor , maturity " , r)); + LMI_TEST( std::regex_match(" salary , retirement ; corridor , maturity" , r)); + LMI_TEST( std::regex_match(" salary , retirement ; corridor , maturity " , r)); // Empty except for zero or more blanks. - LMI_TEST( boost::regex_match("" , r)); - LMI_TEST( boost::regex_match(" " , r)); - LMI_TEST( boost::regex_match(" " , r)); + LMI_TEST( std::regex_match("" , r)); + LMI_TEST( std::regex_match(" " , r)); + LMI_TEST( std::regex_match(" " , r)); // Interval notation. - LMI_TEST( boost::regex_match("1 [2,3);4 (5,6]" , r)); + LMI_TEST( std::regex_match("1 [2,3);4 (5,6]" , r)); // User-manual examples. See: https://www.nongnu.org/lmi/sequence_input.html - LMI_TEST( boost::regex_match("sevenpay 7; 250000 retirement; 100000 #10; 75000 @95; 50000", r)); - LMI_TEST( boost::regex_match("100000; 110000; 120000; 130000; 140000; 150000" , r)); - LMI_TEST( boost::regex_match("target; maximum" , r)); // [Modified example.] - LMI_TEST( boost::regex_match("10000 20; 0" , r)); - LMI_TEST( boost::regex_match("10000 10; 5000 15; 0" , r)); - LMI_TEST( boost::regex_match("10000 @70; 0" , r)); - LMI_TEST( boost::regex_match("10000 retirement; 0" , r)); - LMI_TEST( boost::regex_match("0 retirement; 5000" , r)); - LMI_TEST( boost::regex_match("0 retirement; 5000 maturity" , r)); - LMI_TEST( boost::regex_match("0 retirement; 5000 #10; 0" , r)); - LMI_TEST( boost::regex_match("0,[0,retirement);10000,[retirement,#10);0" , r)); + LMI_TEST( std::regex_match("sevenpay 7; 250000 retirement; 100000 #10; 75000 @95; 50000", r)); + LMI_TEST( std::regex_match("100000; 110000; 120000; 130000; 140000; 150000" , r)); + LMI_TEST( std::regex_match("target; maximum" , r)); // [Modified example.] + LMI_TEST( std::regex_match("10000 20; 0" , r)); + LMI_TEST( std::regex_match("10000 10; 5000 15; 0" , r)); + LMI_TEST( std::regex_match("10000 @70; 0" , r)); + LMI_TEST( std::regex_match("10000 retirement; 0" , r)); + LMI_TEST( std::regex_match("0 retirement; 5000" , r)); + LMI_TEST( std::regex_match("0 retirement; 5000 maturity" , r)); + LMI_TEST( std::regex_match("0 retirement; 5000 #10; 0" , r)); + LMI_TEST( std::regex_match("0,[0,retirement);10000,[retirement,#10);0" , r)); // Tests that are designed to fail. // Naked semicolon. - LMI_TEST(!boost::regex_match(";" , r)); - LMI_TEST(!boost::regex_match(" ; " , r)); + LMI_TEST(!std::regex_match(";" , r)); + LMI_TEST(!std::regex_match(" ; " , r)); // Missing required semicolon. - LMI_TEST(!boost::regex_match("7 24 25" , r)); - LMI_TEST(!boost::regex_match("7,24,25" , r)); - LMI_TEST(!boost::regex_match("7, 24, 25" , r)); - LMI_TEST(!boost::regex_match("7 , 24 , 25" , r)); + LMI_TEST(!std::regex_match("7 24 25" , r)); + LMI_TEST(!std::regex_match("7,24,25" , r)); + LMI_TEST(!std::regex_match("7, 24, 25" , r)); + LMI_TEST(!std::regex_match("7 , 24 , 25" , r)); // Extraneous commas. - LMI_TEST(!boost::regex_match(",1" , r)); - LMI_TEST(!boost::regex_match("1," , r)); - LMI_TEST(!boost::regex_match("1,2," , r)); - LMI_TEST(!boost::regex_match("1,,2" , r)); + LMI_TEST(!std::regex_match(",1" , r)); + LMI_TEST(!std::regex_match("1," , r)); + LMI_TEST(!std::regex_match("1,2," , r)); + LMI_TEST(!std::regex_match("1,,2" , r)); // Impermissible character. - LMI_TEST(!boost::regex_match("%" , r)); + LMI_TEST(!std::regex_match("%" , r)); // Uppercase in keywords. - LMI_TEST(!boost::regex_match("Glp" , r)); - LMI_TEST(!boost::regex_match("GLP" , r)); + LMI_TEST(!std::regex_match("Glp" , r)); + LMI_TEST(!std::regex_match("GLP" , r)); // Misppellings. - LMI_TEST(!boost::regex_match("gdp" , r)); - LMI_TEST(!boost::regex_match("glpp" , r)); - LMI_TEST(!boost::regex_match("gglp" , r)); + LMI_TEST(!std::regex_match("gdp" , r)); + LMI_TEST(!std::regex_match("glpp" , r)); + LMI_TEST(!std::regex_match("gglp" , r)); X = "(\\-?[0-9.]+)"; R = " *| *" + X + Y + "? *(; *" + X + Y + "? *)*;? *"; diff --git a/test_coding_rules.cpp b/test_coding_rules.cpp index 3e2a45ee1..8114aa0da 100644 --- a/test_coding_rules.cpp +++ b/test_coding_rules.cpp @@ -20,7 +20,6 @@ // snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA #include "assert_lmi.hpp" -#include "boost_regex.hpp" #include "contains.hpp" #include "handle_exceptions.hpp" // report_exception() #include "istream_to_string.hpp" @@ -29,6 +28,8 @@ #include "path.hpp" #include "ssize_lmi.hpp" +#include "../pcre_regex.hpp" + #include // is_sorted() #include // time_t #include @@ -256,7 +257,7 @@ bool file::is_of_phylum(enum_kingdom z) const bool file::phyloanalyze(std::string const& s) const { - return boost::regex_search(file_name(), boost::regex(s)); + return !pcre::search(file_name(), pcre::regex(s)).empty(); } bool error_flag = false; @@ -273,7 +274,7 @@ void require ,std::string const& complaint ) { - if(!boost::regex_search(f.data(), boost::regex(regex))) + if(!pcre::search(f.data(), pcre::regex(regex))) { complain(f, complaint); } @@ -285,7 +286,7 @@ void forbid ,std::string const& complaint ) { - if(boost::regex_search(f.data(), boost::regex(regex))) + if(pcre::search(f.data(), pcre::regex(regex))) { complain(f, complaint); } @@ -294,11 +295,11 @@ void forbid void taboo (file const& f ,std::string const& regex - ,boost::regex::flag_type flags = boost::regex::ECMAScript + ,pcre::regex::flag_type flags = pcre::regex::ECMAScript ) { - boost::regex::flag_type syntax = flags | boost::regex::ECMAScript; - if(boost::regex_search(f.data(), boost::regex(regex, syntax))) + pcre::regex::flag_type syntax = flags | pcre::regex::ECMAScript; + if(pcre::search(f.data(), pcre::regex(regex, syntax))) { std::ostringstream oss; oss << "breaks taboo '" << regex << "'."; @@ -347,8 +348,8 @@ void assay_whitespace(file const& f) throw std::runtime_error(R"(File contains '\t'.)"); } - static boost::regex const postinitial_tab(R"([^\n]\t)"); - if(f.is_of_phylum(e_make) && boost::regex_search(f.data(), postinitial_tab)) + static pcre::regex const postinitial_tab(R"([^\n]\t)"); + if(f.is_of_phylum(e_make) && pcre::search(f.data(), postinitial_tab)) { throw std::runtime_error(R"(File contains postinitial '\t'.)"); } @@ -406,9 +407,8 @@ void check_config_hpp(file const& f) { require(f, loose , "must include 'config.hpp'."); require(f, indent, R"(lacks line '# include "config.hpp"'.)"); - boost::smatch match; - static boost::regex const first_include(R"((# *include[^\n]*))"); - boost::regex_search(f.data(), match, first_include); + static pcre::regex const first_include(R"((# *include[^\n]*))"); + auto const& match = pcre::search(f.data(), first_include); if(R"(# include "config.hpp")" != match[1]) { complain(f, "must include 'config.hpp' first."); @@ -418,9 +418,8 @@ void check_config_hpp(file const& f) { require(f, loose , "must include 'config.hpp'."); require(f, strict, R"(lacks line '#include "config.hpp"'.)"); - boost::smatch match; - static boost::regex const first_include(R"((# *include[^\n]*))"); - boost::regex_search(f.data(), match, first_include); + static pcre::regex const first_include(R"((# *include[^\n]*))"); + auto const& match = pcre::search(f.data(), first_include); if(R"(#include "config.hpp")" != match[1]) { complain(f, "must include 'config.hpp' first."); @@ -516,12 +515,9 @@ void check_cxx(file const& f) } { - static boost::regex const r(R"((\w+)( +)([*&])(\w+\b)([*;]?)([^\n]*))"); - boost::sregex_iterator i(f.data().begin(), f.data().end(), r); - boost::sregex_iterator const omega; - for(; i != omega; ++i) + static pcre::regex const r(R"((\w+)( +)([*&])(\w+\b)([*;]?)([^\n]*))"); + for(auto const& z : pcre::search_all(f.data(), r)) { - boost::smatch const& z(*i); if ( "return" != z[1] // 'return *p' && "nix" != z[4] // '*nix' @@ -537,12 +533,9 @@ void check_cxx(file const& f) } { - static boost::regex const r(R"(\bconst +([A-Za-z][A-Za-z0-9_:]*) *[*&])"); - boost::sregex_iterator i(f.data().begin(), f.data().end(), r); - boost::sregex_iterator const omega; - for(; i != omega; ++i) + static pcre::regex const r(R"(\bconst +([A-Za-z][A-Za-z0-9_:]*) *[*&])"); + for(auto const& z : pcre::search_all(f.data(), r)) { - boost::smatch const& z(*i); if ( "volatile" != z[1] // 'const volatile' ) @@ -559,15 +552,12 @@ void check_cxx(file const& f) } { - static boost::regex const r(R"(\n# *ifn*def[^\n]+\n)"); - boost::sregex_iterator i(f.data().begin(), f.data().end(), r); - boost::sregex_iterator const omega; - for(; i != omega; ++i) + static pcre::regex const r(R"(\n# *ifn*def[^\n]+\n)"); + for(auto const& z : pcre::search_all(f.data(), r)) { - boost::smatch const& z(*i); std::string s = z[0]; - static boost::regex const include_guard(R"(# *ifndef *\l[_\d\l]*_hpp\W)"); - if(!boost::regex_search(s, include_guard)) + static pcre::regex const include_guard(R"(# *ifndef *[[:lower:]][_\d[:lower:]]*_hpp\W)"); + if(!pcre::search(s, include_guard)) { ltrim(s, "\n"); rtrim(s, "\n"); @@ -585,9 +575,9 @@ void check_cxx(file const& f) { // See: // https://lists.nongnu.org/archive/html/lmi/2021-02/msg00023.html - static boost::regex const r(R"([^:s]size_t[^\n])"); + static pcre::regex const r(R"([^:s]size_t[^\n])"); if - ( boost::regex_search(f.data(), r) + ( pcre::search(f.data(), r) && f.file_name() != "test_coding_rules.cpp" ) { @@ -596,9 +586,9 @@ void check_cxx(file const& f) } { - static boost::regex const r(R"(# *endif\n)"); + static pcre::regex const r(R"(# *endif\n)"); if - ( boost::regex_search(f.data(), r) + ( pcre::search(f.data(), r) ) { complain(f, "contains unlabelled '#endif' directive."); @@ -614,12 +604,9 @@ void check_cxx(file const& f) { // See: // https://lists.nongnu.org/archive/html/lmi/2021-03/msg00032.html - static boost::regex const r(R"(\bR"([^(]*)[(])"); - boost::sregex_iterator i(f.data().begin(), f.data().end(), r); - boost::sregex_iterator const omega; - for(; i != omega; ++i) + static pcre::regex const r(R"(\bR"([^(]*)[(])"); + for(auto const& z : pcre::search_all(f.data(), r)) { - boost::smatch const& z(*i); if ( "test_coding_rules.cpp" != f.file_name() && "--cut-here--" != z[1] @@ -643,12 +630,9 @@ void check_cxx(file const& f) // This is "p && q || p", so to speak. If 'p' doesn't match, then // ignore this occurrence. Else if 'q' matches, then diagnose the // problem. Otherwise, match p again and show a diagnostic. - static boost::regex const r("(?=" + p + ")(?:" + q + ")|(" + p + ")"); - boost::sregex_iterator i(f.data().begin(), f.data().end(), r); - boost::sregex_iterator const omega; - for(; i != omega; ++i) + static pcre::regex const r("(?=" + p + ")(?:" + q + ")|(" + p + ")"); + for(auto const& z : pcre::search_all(f.data(), r)) { - boost::smatch const& z(*i); if("" == z[1] && "" == z[2] && "" == z[3]) { std::ostringstream oss; @@ -710,12 +694,9 @@ void check_defect_markers(file const& f) } { - static boost::regex const r(R"((\b\w+\b\W*)\?\?(.))"); - boost::sregex_iterator i(f.data().begin(), f.data().end(), r); - boost::sregex_iterator const omega; - for(; i != omega; ++i) + static pcre::regex const r(R"((\b\w+\b\W*)\?\?(.))"); + for(auto const& z : pcre::search_all(f.data(), r)) { - boost::smatch const& z(*i); bool const error_preceding = "TODO " != z[1]; bool const error_following = " " != z[2] && "\n" != z[2]; if(error_preceding || error_following) @@ -728,12 +709,9 @@ void check_defect_markers(file const& f) } { - static boost::regex const r(R"((\b\w+\b\W?)!!(.))"); - boost::sregex_iterator i(f.data().begin(), f.data().end(), r); - boost::sregex_iterator const omega; - for(; i != omega; ++i) + static pcre::regex const r(R"((\b\w+\b\W?)!!(.))"); + for(auto const& z : pcre::search_all(f.data(), r)) { - boost::smatch const& z(*i); bool const error_preceding = true && "7702 " != z[1] @@ -777,9 +755,9 @@ void check_include_guards(file const& f) return; } - std::string const guard = boost::regex_replace + std::string const guard = pcre::replace (f.file_name() - ,boost::regex(R"(\.hpp$)") + ,pcre::regex(R"(\.hpp$)") ,"_hpp" ); std::string const guard_start = @@ -799,12 +777,9 @@ void check_inclusion_order(file const& f) return; } - static boost::regex const r(R"((?<=\n\n)(# *include *[<"][^\n]*\n)+\n)"); - boost::sregex_iterator i(f.data().begin(), f.data().end(), r); - boost::sregex_iterator const omega; - for(; i != omega; ++i) + static pcre::regex const r(R"((?<=\n\n)(# *include *[<"][^\n]*\n)+\n)"); + for(auto const& z : pcre::search_all(f.data(), r)) { - boost::smatch const& z(*i); std::string s = z[0]; rtrim(s, "\n"); std::vector v = split_into_lines(s); @@ -824,12 +799,9 @@ void check_label_indentation(file const& f) return; } - static boost::regex const r(R"(\n( *)([A-Za-z][A-Za-z0-9_]*)( *:)(?!:))"); - boost::sregex_iterator i(f.data().begin(), f.data().end(), r); - boost::sregex_iterator const omega; - for(; i != omega; ++i) + static pcre::regex const r(R"(\n( *)([A-Za-z][A-Za-z0-9_]*)( *:)(?!:))"); + for(auto const& z : pcre::search_all(f.data(), r)) { - boost::smatch const& z(*i); if ( "default" != z[2] && "Usage" != z[2] @@ -869,10 +841,14 @@ void check_logs(file const& f) entries = f.data(); } - static boost::regex const r(R"(\n(?!\|)(?! *https?:)([^\n]{71,})(?=\n))"); - boost::sregex_iterator i(entries.begin(), entries.end(), r); - boost::sregex_iterator const omega; - if(omega == i) + std::vector long_lines; + static pcre::regex const r(R"(\n(?!\|)(?! *https?:)([^\n]{71,})(?=\n))"); + for(auto const& z : pcre::search_all(entries, r)) + { + long_lines.push_back(z[1]); + } + + if(long_lines.empty()) { return; } @@ -883,10 +859,9 @@ void check_logs(file const& f) << "0000000001111111111222222222233333333334444444444555555555566666666667\n" << "1234567890123456789012345678901234567890123456789012345678901234567890" ; - for(; i != omega; ++i) + for(auto const& line : long_lines) { - boost::smatch const& z(*i); - oss << '\n' << z[1]; + oss << '\n' << line; } complain(f, oss.str()); } @@ -1060,17 +1035,14 @@ void check_reserved_names(file const& f) return; } - static boost::regex const r(R"((\b\w*__\w*\b))"); - boost::sregex_iterator i(f.data().begin(), f.data().end(), r); - boost::sregex_iterator const omega; - for(; i != omega; ++i) + static pcre::regex const r(R"((\b\w*__\w*\b))"); + for(auto const& z : pcre::search_all(f.data(), r)) { - boost::smatch const& z(*i); std::string const s = z[0]; - static boost::regex const not_all_underscore("[A-Za-z0-9]"); + static pcre::regex const not_all_underscore("[A-Za-z0-9]"); if ( !check_reserved_name_exception(s) - && boost::regex_search(s, not_all_underscore) + && pcre::search(s, not_all_underscore) ) { std::ostringstream oss; @@ -1096,14 +1068,14 @@ void enforce_taboos(file const& f) taboo(f, "Cambridge"); taboo(f, "Temple P"); // Patented. - taboo(f, R"(\.gif)", boost::regex::icase); + taboo(f, R"(\.gif)", pcre::regex::icase); // Obsolete email address. taboo(f, "chicares@mindspring.com"); // Obscured email address. taboo(f, "address@hidden"); // Certain proprietary libraries. - taboo(f, R"(\bowl\b)", boost::regex::icase); - taboo(f, "vtss", boost::regex::icase); + taboo(f, R"(\bowl\b)", pcre::regex::icase); + taboo(f, "vtss", pcre::regex::icase); // Suspiciously specific to msw (although the string "Microsoft" // is okay for identifying a GNU/Linux re-distribution). taboo(f, "Visual [A-Z]"); @@ -1127,7 +1099,7 @@ void enforce_taboos(file const& f) && !f.is_of_phylum(e_synopsis) ) { - taboo(f, R"(\bexe\b)", boost::regex::icase); + taboo(f, R"(\bexe\b)", pcre::regex::icase); } if @@ -1137,21 +1109,21 @@ void enforce_taboos(file const& f) && !f.phyloanalyze("configure.ac") // GNU libtool uses 'win32-dll'. ) { - taboo(f, "WIN32", boost::regex::icase); + taboo(f, "WIN32", pcre::regex::icase); } if - ( !boost::regex_search(f.data(), boost::regex(my_taboo_indulgence())) + ( !pcre::search(f.data(), pcre::regex(my_taboo_indulgence())) && !contains(f.data(), "Automatically generated from custom input.") ) { // Unspeakable private taboos. for(auto const& i : my_taboos()) { - boost::regex::flag_type syntax = + pcre::regex::flag_type syntax = i.second - ? boost::regex::ECMAScript | boost::regex::icase - : boost::regex::ECMAScript + ? pcre::regex::ECMAScript | pcre::regex::icase + : pcre::regex::ECMAScript ; taboo(f, i.first, syntax); } diff --git a/workhorse.make b/workhorse.make index 783bde355..2de0936c9 100644 --- a/workhorse.make +++ b/workhorse.make @@ -331,7 +331,6 @@ sys_include_directories := \ all_source_directories := \ $(srcdir) \ /opt/lmi/third_party/src/boost/libs/filesystem/src \ - /opt/lmi/third_party/src/boost/libs/regex/src \ /opt/lmi/third_party/src/cgicc \ vpath lib%.a $(CURDIR) @@ -590,36 +589,10 @@ gcc_common_extra_warnings := \ bourn_cast_test.o: gcc_common_extra_warnings += \ -Wno-double-promotion \ -# Some boost-1.33.1 libraries are incompatible with many warnings. - -$(boost_regex_objects): gcc_common_extra_warnings += \ - -Wno-conversion \ - -Wno-duplicated-branches \ - -Wno-implicit-fallthrough \ - -Wno-old-style-cast \ - -Wno-register \ - -Wno-shadow \ - -Wno-switch-enum \ - -Wno-unused-macros \ - -Wno-unused-result \ - -Wno-useless-cast \ - -Wno-zero-as-null-pointer-constant \ - $(cgicc_objects): gcc_common_extra_warnings += \ -Wno-conversion \ -Wno-zero-as-null-pointer-constant \ -# The boost regex library improperly defines "NOMINMAX": -# http://lists.boost.org/Archives/boost/2006/03/102189.php -# at least in version 1.33.1, and there seems to be no easy workaround -# except to blow away all warning options and let a warning appear. -# This problem seems not to occur with gcc-4.x . - -ifeq (3.4.5,$(gcc_version)) - static_mutex.o: gcc_common_extra_warnings := - static_mutex.o: gcc_cxx_warnings := -endif - ifeq (safestdlib,$(findstring safestdlib,$(build_type))) ifeq (3.4.5,$(gcc_version)) expression_template_0_test.o: gcc_common_extra_warnings += -Wno-unused-parameter