From bcc57fa493724972ffa8a50276c10ba4b8017430 Mon Sep 17 00:00:00 2001 From: "Dan S. Camper" Date: Wed, 28 Feb 2024 13:57:02 -0600 Subject: [PATCH] HPCC-31365 Unconditionally use Boost regex Remove CentOS6-specific build support --- cmake_modules/commonSetup.cmake | 30 ++------- cmake_modules/options.cmake | 5 -- cmake_modules/plugins.cmake | 5 -- .../configmgr/configmgrlib/CMakeLists.txt | 3 - lib2/CMakeLists.txt | 4 +- rtl/eclrtl/CMakeLists.txt | 7 +-- rtl/eclrtl/eclregex.cpp | 62 ------------------- vcpkg.json.in | 5 +- 8 files changed, 8 insertions(+), 113 deletions(-) diff --git a/cmake_modules/commonSetup.cmake b/cmake_modules/commonSetup.cmake index 660b68fefd9..36608e3fc59 100644 --- a/cmake_modules/commonSetup.cmake +++ b/cmake_modules/commonSetup.cmake @@ -839,32 +839,10 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "") endif() endif(USE_URIPARSER) - if(USE_BOOST_REGEX) - if(CENTOS_6_BOOST) - include(${CMAKE_MODULE_PATH}/buildBOOST_REGEX.cmake) - message(STATUS "CENTOS_6_BOOST_REGEX enabled") - add_definitions (-D_USE_BOOST_REGEX) - else() - find_package(Boost COMPONENTS regex) - if (Boost_REGEX_FOUND) - message(STATUS "BOOST_REGEX enabled") - add_definitions (-D_USE_BOOST_REGEX) - else() - message(FATAL_ERROR "BOOST_REGEX requested but package not found") - endif() - endif() - else(USE_BOOST_REGEX) - if (USE_C11_REGEX) - if ((NOT CMAKE_COMPILER_IS_GNUCC) OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9.0)) - message(STATUS "C11_REGEX enabled") - add_definitions (-D_USE_C11_REGEX) - else() - message(STATUS "C11_REGEX requested but not supported on this platform") - endif() - else(USE_C11_REGEX) - message(STATUS "NO REGEX requested") - endif(USE_C11_REGEX) - endif(USE_BOOST_REGEX) + find_package(Boost COMPONENTS regex) + if (NOT Boost_REGEX_FOUND) + message(FATAL_ERROR "BOOST_REGEX required but package not found") + endif() if(USE_PARQUET) message(STATUS "Parquet enabled") diff --git a/cmake_modules/options.cmake b/cmake_modules/options.cmake index 10355a37a95..c40809f97bb 100644 --- a/cmake_modules/options.cmake +++ b/cmake_modules/options.cmake @@ -17,11 +17,6 @@ option(SIGN_MODULES "Enable signing of ecl standard library modules" OFF) option(USE_CPPUNIT "Enable unit tests (requires cppunit)" OFF) option(USE_OPENLDAP "Enable OpenLDAP support (requires OpenLDAP)" ON) option(USE_ICU "Enable unicode support (requires ICU)" ON) -option(USE_BOOST_REGEX "Configure use of boost regex" ON) -option(CENTOS_6_BOOST "Supply regex library on CentOS 6" OFF) -# USE_C11_REGEX is only checked if USE_BOOST_REGEX is OFF -# to disable REGEX altogether turn both off -option(USE_C11_REGEX "Configure use of c++11 std::regex" ON) option(Boost_USE_STATIC_LIBS "Use boost_regex static library for RPM BUILD" OFF) option(USE_OPENSSL "Configure use of OpenSSL" ON) option(USE_OPENSSLV3 "Configure use of OpenSSL Version 3 or newer" ON) diff --git a/cmake_modules/plugins.cmake b/cmake_modules/plugins.cmake index 228e43a7760..334bd302f15 100644 --- a/cmake_modules/plugins.cmake +++ b/cmake_modules/plugins.cmake @@ -95,11 +95,6 @@ if (USE_AZURE) set(VCPKG_AZURE "${VCPKG_INCLUDE}") endif() -set(VCPKG_BOOST_REGEX "${VCPKG_SUPPRESS}") -if (USE_BOOST_REGEX) - set(VCPKG_BOOST_REGEX "${VCPKG_INCLUDE}") -endif() - set(VCPKG_CPPUNIT "${VCPKG_SUPPRESS}") if (USE_CPPUNIT) set(VCPKG_CPPUNIT "${VCPKG_INCLUDE}") diff --git a/configuration/configmgr/configmgrlib/CMakeLists.txt b/configuration/configmgr/configmgrlib/CMakeLists.txt index 8c855d8c166..81977d58f18 100644 --- a/configuration/configmgr/configmgrlib/CMakeLists.txt +++ b/configuration/configmgr/configmgrlib/CMakeLists.txt @@ -69,9 +69,6 @@ INCLUDE_DIRECTORIES( ADD_DEFINITIONS( -D_USRDLL -DCFGMGRLIB_EXPORTS) HPCC_ADD_LIBRARY( configmgr SHARED ${SRCS} ) -if(CENTOS_6_BOOST) - add_dependencies(configmgr generate-boost-regex) -endif() TARGET_LINK_LIBRARIES( configmgr jlib) INSTALL ( TARGETS configmgr RUNTIME DESTINATION ${EXEC_DIR} LIBRARY DESTINATION ${LIB_DIR} ) diff --git a/lib2/CMakeLists.txt b/lib2/CMakeLists.txt index 0135812a5c4..e119165a6f9 100644 --- a/lib2/CMakeLists.txt +++ b/lib2/CMakeLists.txt @@ -80,9 +80,9 @@ elseif (WIN32) find_file (ZLIB_BIN "zlib.dll" "${EXTERNALS_DIRECTORY}/zlib/1.2.8/lib/Win32" NO_DEFAULT_PATH) endif() set(DYLIBS "") - if (NOT USE_NATIVE_LIBRARIES AND USE_BOOST_REGEX) + if (NOT USE_NATIVE_LIBRARIES) list(APPEND DYLIBS ${BOOST_REGEX_BIN}) - endif (NOT USE_NATIVE_LIBRARIES AND USE_BOOST_REGEX) + endif (NOT USE_NATIVE_LIBRARIES) list(APPEND DYLIBS ${ICU_DT_BIN} ${ICU_IN_BIN} ${ICU_UC_BIN}) list(APPEND DYLIBS ${OPENSSL_LIB_BIN} ${OPENSSL_SSL_BIN}) list(APPEND DYLIBS ${XALAN_C_BIN} ${XALAN_MESSAGES_BIN}) diff --git a/rtl/eclrtl/CMakeLists.txt b/rtl/eclrtl/CMakeLists.txt index 52dcb0ffc2f..b097e1fbcc4 100644 --- a/rtl/eclrtl/CMakeLists.txt +++ b/rtl/eclrtl/CMakeLists.txt @@ -87,12 +87,7 @@ endif () HPCC_ADD_LIBRARY( eclrtl SHARED ${SRCS} ) -if(CENTOS_6_BOOST) - add_dependencies(eclrtl boost-regex) - target_link_libraries( eclrtl boost-regex) -elseif(USE_BOOST_REGEX) - target_link_libraries( eclrtl Boost::boost Boost::regex ) -endif() +target_link_libraries( eclrtl Boost::boost Boost::regex ) target_link_libraries ( eclrtl jlib diff --git a/rtl/eclrtl/eclregex.cpp b/rtl/eclrtl/eclregex.cpp index 0d3bdace4a1..75362531721 100644 --- a/rtl/eclrtl/eclregex.cpp +++ b/rtl/eclrtl/eclregex.cpp @@ -16,11 +16,7 @@ ############################################################################## */ #include "limits.h" -#if defined(_USE_BOOST_REGEX) #include "boost/regex.hpp" // must precede platform.h ; n.b. this uses a #pragma comment(lib, ...) to link the appropriate .lib in MSVC -#elif defined(_USE_C11_REGEX) -#include -#endif #include "platform.h" #include "eclrtl.hpp" #include "eclrtl_imp.hpp" @@ -31,23 +27,12 @@ #define UTF8_CODEPAGE "UTF-8" #define UTF8_MAXSIZE 4 -#if defined(_USE_BOOST_REGEX) || defined(_USE_C11_REGEX) - -#if defined(_USE_BOOST_REGEX) using boost::regex; using boost::regex_search; using boost::regex_replace; using boost::regex_iterator; using boost::cmatch; using boost::match_results; -#else -using std::regex; -using std::regex_search; -using std::regex_replace; -using std::regex_iterator; -using std::cmatch; -using std::match_results; -#endif class CStrRegExprFindInstance : implements IStrRegExprFindInstance { @@ -81,11 +66,9 @@ class CStrRegExprFindInstance : implements IStrRegExprFindInstance { std::string msg = "Error in regex search: "; msg += e.what(); -#if defined(_USE_BOOST_REGEX) msg += "(regex: "; msg += regEx->str(); msg += ")"; -#endif rtlFail(0, msg.c_str()); } @@ -145,23 +128,12 @@ class CCompiledStrRegExpr : implements ICompiledStrRegExpr { try { -#if defined(_USE_BOOST_REGEX) if (_isCaseSensitive) regEx.assign(_regExp, regex::perl); else regEx.assign(_regExp, regex::perl | regex::icase); -#else - if (_isCaseSensitive) - regEx.assign(_regExp, regex::ECMAScript); - else - regEx.assign(_regExp, regex::ECMAScript | regex::icase); -#endif } -#if defined(_USE_BOOST_REGEX) catch(const boost::bad_expression & e) -#else - catch(const std::regex_error & e) -#endif { std::string msg = "Bad regular expression: "; msg += e.what(); @@ -181,21 +153,15 @@ class CCompiledStrRegExpr : implements ICompiledStrRegExpr try { // tgt = boost::regex_merge(src, cre->regEx, fmt, boost::format_perl); //Algorithm regex_merge has been renamed regex_replace, existing code will continue to compile, but new code should use regex_replace instead. -#if defined(_USE_BOOST_REGEX) tgt = regex_replace(src, regEx, fmt, boost::format_perl); -#else - tgt = regex_replace(src, regEx, fmt); -#endif } catch(const std::runtime_error & e) { std::string msg = "Error in regex replace: "; msg += e.what(); -#if defined(_USE_BOOST_REGEX) msg += "(regex: "; msg += regEx.str(); msg += ")"; -#endif rtlFail(0, msg.c_str()); } outlen = tgt.length(); @@ -469,31 +435,3 @@ ECLRTL_API void rtlDestroyUStrRegExprFindInstance(IUStrRegExprFindInstance * fin { } #endif - -#else // _USE_BOOST_REGEX or _USE_C11_REGEX not set -ECLRTL_API ICompiledStrRegExpr * rtlCreateCompiledStrRegExpr(const char * regExpr, bool isCaseSensitive) -{ - rtlFail(0, "Boost/C++11 regex disabled"); -} - -ECLRTL_API void rtlDestroyCompiledStrRegExpr(ICompiledStrRegExpr * compiledExpr) -{ -} - -ECLRTL_API void rtlDestroyStrRegExprFindInstance(IStrRegExprFindInstance * findInst) -{ -} - -ECLRTL_API ICompiledUStrRegExpr * rtlCreateCompiledUStrRegExpr(const UChar * regExpr, bool isCaseSensitive) -{ - rtlFail(0, "Boost/C++11 regex disabled"); -} - -ECLRTL_API void rtlDestroyCompiledUStrRegExpr(ICompiledUStrRegExpr * compiledExpr) -{ -} - -ECLRTL_API void rtlDestroyUStrRegExprFindInstance(IUStrRegExprFindInstance * findInst) -{ -} -#endif // _USE_BOOST_REGEX or _USE_C11_REGEX diff --git a/vcpkg.json.in b/vcpkg.json.in index 9afef0a36e2..62861804aa7 100644 --- a/vcpkg.json.in +++ b/vcpkg.json.in @@ -40,10 +40,7 @@ "platform": "@VCPKG_AZURE@" }, "boost-property-tree", - { - "name": "boost-regex", - "platform": "@VCPKG_BOOST_REGEX@" - }, + "boost-regex", { "name": "cpp-driver", "platform": "@VCPKG_CASSANDRAEMBED@"