From ac03c4feccc4a629b834be31bd445d037b0518f7 Mon Sep 17 00:00:00 2001 From: Laurent Stacul Date: Fri, 1 Mar 2019 08:36:15 +0000 Subject: [PATCH 01/14] Fix gcc -Wdeprecated-copy --- include/boost/regex/v4/regex_iterator.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/boost/regex/v4/regex_iterator.hpp b/include/boost/regex/v4/regex_iterator.hpp index 380a9a71..bbdeed58 100644 --- a/include/boost/regex/v4/regex_iterator.hpp +++ b/include/boost/regex/v4/regex_iterator.hpp @@ -50,6 +50,8 @@ class regex_iterator_implementation public: regex_iterator_implementation(const regex_type* p, BidirectionalIterator last, match_flag_type f) : base(), end(last), re(*p), flags(f){} + regex_iterator_implementation(const regex_iterator_implementation& other) + :what(other.what), base(other.base), end(other.end), re(other.re), flags(other.flags){} bool init(BidirectionalIterator first) { base = first; From 9b6a8e5e82eb12df3aa094fedf072ebcb63dab24 Mon Sep 17 00:00:00 2001 From: Deniz Bahadir Date: Tue, 8 Oct 2019 10:49:01 +0200 Subject: [PATCH 02/14] Point for issues to Github instead of old Trac. --- doc/history.qbk | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/history.qbk b/doc/history.qbk index 85319026..7a8a5f9e 100644 --- a/doc/history.qbk +++ b/doc/history.qbk @@ -8,12 +8,11 @@ [section:history History] -New issues should be submitted at [@http://svn.boost.org svn.boost.org] - don't forget to include your -email address in the ticket! +New issues should be submitted at [@https://github.com/boostorg/regex/issues https://github.com/boostorg/regex/issues] -Currently open issues can be viewed [@https://svn.boost.org/trac/boost/query?status=assigned&status=new&status=reopened&component=regex&order=priority&col=id&col=summary&col=status&col=type&col=milestone&col=component here]. +Currently open issues can be viewed [@https://github.com/boostorg/regex/issues?q=is%3Aopen+is%3Aissue here]. -All issues including closed ones can be viewed [@https://svn.boost.org/trac/boost/query?status=assigned&status=closed&status=new&status=reopened&component=regex&order=priority&col=id&col=summary&col=status&col=type&col=milestone&col=component here]. +All issues including closed ones can be viewed [@https://github.com/boostorg/regex/issues?q=is%3Aissue+is%3Aclosed here]. [h4 Boost.Regex-5.1.3 (Boost-1.64.0)] From 0baf08108feb2e8ca9f9faf538ecd60038b9ec64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Tue, 5 Nov 2019 22:21:35 +0100 Subject: [PATCH 03/14] Minor spelling fix. --- include/boost/regex/v4/regex_traits_defaults.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/regex/v4/regex_traits_defaults.hpp b/include/boost/regex/v4/regex_traits_defaults.hpp index e58d6bae..361ade96 100644 --- a/include/boost/regex/v4/regex_traits_defaults.hpp +++ b/include/boost/regex/v4/regex_traits_defaults.hpp @@ -141,7 +141,7 @@ inline bool is_separator(char c) BOOST_REGEX_DECL std::string BOOST_REGEX_CALL lookup_default_collate_name(const std::string& name); // -// get the state_id of a character clasification, the individual +// get the state_id of a character classification, the individual // traits classes then transform that state_id into a bitmask: // template From 3d72b06e9d80e2783c2b46d6e589ffc85c11f72c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Fri, 8 Nov 2019 11:11:01 +0100 Subject: [PATCH 04/14] regex_traits_defaults: Do not export arrays only used in same compilation unit. Exporting variables is unreliable on some platforms including Windows, and it seems can cause compilation errors in some cases. Also symbols should not be exported unnecessarily purely on principle. It would even be possible to move the arrays into the function, but as they are a bit large that seems to be worse for readability. --- src/regex_traits_defaults.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/regex_traits_defaults.cpp b/src/regex_traits_defaults.cpp index 0b66c68d..5ac46d2d 100644 --- a/src/regex_traits_defaults.cpp +++ b/src/regex_traits_defaults.cpp @@ -193,7 +193,7 @@ BOOST_REGEX_DECL bool BOOST_REGEX_CALL is_combining_implementation(boost::uint_l // // these are the POSIX collating names: // -BOOST_REGEX_DECL const char* def_coll_names[] = { +static const char* def_coll_names[] = { "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "alert", "backspace", "tab", "newline", "vertical-tab", "form-feed", "carriage-return", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", "CAN", "EM", "SUB", "ESC", "IS4", "IS3", "IS2", "IS1", "space", "exclamation-mark", @@ -214,7 +214,7 @@ BOOST_REGEX_DECL const char* def_coll_names[] = { // little more - but this will have to do for // now: -BOOST_REGEX_DECL const char* def_multi_coll[] = { +static const char* def_multi_coll[] = { "ae", "Ae", "AE", From e72490638a8801a1830a909d6a09f34b35a543a1 Mon Sep 17 00:00:00 2001 From: Mike Dev Date: Tue, 2 Oct 2018 22:04:12 +0200 Subject: [PATCH 05/14] [CMake] Add minimal cmake file Generate cmake target that builds the library and which can be used by other libraries to express their dependency on this library and retrieve any configuration information such as the include directory, binary to link to, transitive dependencies, necessary compiler options or the required c++ standards level. --- CMakeLists.txt | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..598cbd9d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,31 @@ +# Copyright 2018 Mike Dev +# Distributed under the Boost Software License, Version 1.0. +# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt + +cmake_minimum_required(VERSION 3.5) +project(BoostRegex LANGUAGES CXX) + + +file(GLOB BOOST_REGEX_SRC ./src/*.cpp) + +add_library(boost_regex ${BOOST_REGEX_SRC}) +add_library(Boost::regex ALIAS boost_regex) + +target_include_directories(boost_regex PUBLIC include) + +target_link_libraries(boost_regex + PUBLIC + Boost::assert + Boost::concept_check + Boost::config + Boost::container_hash + Boost::core + Boost::integer + Boost::iterator + Boost::mpl + Boost::predef + Boost::smart_ptr + Boost::static_assert + Boost::throw_exception + Boost::type_traits +) From 3d44eca405e4a930e75d7f50862e803c67ba98e3 Mon Sep 17 00:00:00 2001 From: Mike Dev Date: Sun, 16 Jun 2019 19:47:22 +0200 Subject: [PATCH 06/14] [CMake] Add option to build some of the examples --- CMakeLists.txt | 27 ++++++++++++++++++--------- example/snippets/CMakeLists.txt | 30 ++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 example/snippets/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 598cbd9d..bce463c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,19 +1,23 @@ -# Copyright 2018 Mike Dev +# Copyright 2018-2019 Mike Dev # Distributed under the Boost Software License, Version 1.0. -# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt +# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt +# +# NOTE: CMake support for Boost.Regex is currently experimental at best +# and the interface is likely to change in the future -cmake_minimum_required(VERSION 3.5) -project(BoostRegex LANGUAGES CXX) +cmake_minimum_required( VERSION 3.5 ) +project( BoostRegex LANGUAGES CXX ) +option( BOOST_REGEX_INCLUDE_EXAMPLES "Also build (some) boost regex examples" OFF ) -file(GLOB BOOST_REGEX_SRC ./src/*.cpp) +file( GLOB BOOST_REGEX_SRC ./src/*.cpp ) -add_library(boost_regex ${BOOST_REGEX_SRC}) -add_library(Boost::regex ALIAS boost_regex) +add_library( boost_regex ${BOOST_REGEX_SRC} ) +add_library( Boost::regex ALIAS boost_regex ) -target_include_directories(boost_regex PUBLIC include) +target_include_directories( boost_regex PUBLIC include ) -target_link_libraries(boost_regex +target_link_libraries( boost_regex PUBLIC Boost::assert Boost::concept_check @@ -29,3 +33,8 @@ target_link_libraries(boost_regex Boost::throw_exception Boost::type_traits ) + +if( BOOST_REGEX_INCLUDE_EXAMPLES ) + add_subdirectory( example/snippets ) +endif() + diff --git a/example/snippets/CMakeLists.txt b/example/snippets/CMakeLists.txt new file mode 100644 index 00000000..f672785b --- /dev/null +++ b/example/snippets/CMakeLists.txt @@ -0,0 +1,30 @@ +# Copyright 2019 Mike Dev +# Distributed under the Boost Software License, Version 1.0. +# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt +# +# NOTE: CMake support for Boost.Regex is currently experimental at best +# and we are currently only building a few examples + +set(examples + partial_regex_grep + partial_regex_iterate + partial_regex_match + regex_grep_example_1 + regex_grep_example_2 + regex_grep_example_3 + regex_grep_example_4 + regex_iterator_example + regex_match_example + regex_merge_example + regex_replace_example + regex_search_example + regex_split_example_1 + regex_split_example_2 + regex_token_iterator_eg_1 + regex_token_iterator_eg_2 +) + +foreach( example IN LISTS examples ) + add_executable( boost_regex_ex_${example} ${example}.cpp ) + target_link_libraries( boost_regex_ex_${example} Boost::regex ) +endforeach() From bb0c6105911b307ada3d83f2f2d54ebb493499cc Mon Sep 17 00:00:00 2001 From: Mike Dev Date: Sun, 8 Dec 2019 16:21:30 +0100 Subject: [PATCH 07/14] [CMake] Add option for compilation with ICU support --- CMakeLists.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index bce463c4..3e1fe28c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ cmake_minimum_required( VERSION 3.5 ) project( BoostRegex LANGUAGES CXX ) option( BOOST_REGEX_INCLUDE_EXAMPLES "Also build (some) boost regex examples" OFF ) +option( BOOST_REGEX_USE_ICU "Enable ICU support in boost regex" OFF ) file( GLOB BOOST_REGEX_SRC ./src/*.cpp ) @@ -34,6 +35,19 @@ target_link_libraries( boost_regex Boost::type_traits ) +if( BOOST_REGEX_USE_ICU ) + if( NOT TARGET ICU::dt ) + # components need to be listed explicitly + find_package( ICU COMPONENTS dt in uc REQUIRED ) + endif() + + target_link_libraries( boost_regex + PRIVATE + ICU::dt ICU::in ICU::uc + ) + target_compile_definitions( boost_regex PRIVATE BOOST_HAS_ICU=1 ) +endif() + if( BOOST_REGEX_INCLUDE_EXAMPLES ) add_subdirectory( example/snippets ) endif() From e54e8e01738445b8d42c360675ec8fb021c60ab4 Mon Sep 17 00:00:00 2001 From: Mike Dev Date: Sat, 28 Dec 2019 11:55:46 +0100 Subject: [PATCH 08/14] [CMake] Disable autolink for regex --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e1fe28c..1c0fdd27 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,7 @@ add_library( boost_regex ${BOOST_REGEX_SRC} ) add_library( Boost::regex ALIAS boost_regex ) target_include_directories( boost_regex PUBLIC include ) +target_compile_definitions( boost_regex PUBLIC BOOST_REGEX_NO_LIB) target_link_libraries( boost_regex PUBLIC From 7ec82a06d4f17f3f70b66a5118d2f6cb5de2f7f9 Mon Sep 17 00:00:00 2001 From: Mike Dev Date: Sat, 28 Dec 2019 12:14:26 +0100 Subject: [PATCH 09/14] [CI] Enable travis script to run with other branches than master or develop --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2bc5872d..3b8daa5f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -243,8 +243,9 @@ matrix: osx_image: xcode6.4 install: + - BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true - cd .. - - git clone -b $TRAVIS_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root + - git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root - cd boost-root - git submodule update --init tools/build - git submodule update --init tools/boost_install From 634fa6847eec9d12817ce2e70c16be370c096282 Mon Sep 17 00:00:00 2001 From: Mike Dev Date: Sat, 28 Dec 2019 12:06:34 +0100 Subject: [PATCH 10/14] [CMake/CI] Add basic cmake run to travis --- .travis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.travis.yml b/.travis.yml index 3b8daa5f..d7abf7e4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,6 +30,14 @@ matrix: - os: linux env: TOOLSET=gcc COMPILER=g++ CXXSTD=03 + - os: linux + env: TEST_CMAKE=true + script: + - mkdir __build__ + - cd __build__ + - cmake .. -DBOOST_ENABLE_CMAKE=ON -DBOOST_REGEX_INCLUDE_EXAMPLES=ON + - cmake --build . + - os: linux env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=03,11 addons: @@ -242,6 +250,8 @@ matrix: env: TOOLSET=clang COMPILER=clang++ CXXSTD=11 osx_image: xcode6.4 + + install: - BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true - cd .. From 45d12f199d92f2d0cf23f37b4368bf76151bc533 Mon Sep 17 00:00:00 2001 From: Mike Dev Date: Sat, 28 Dec 2019 12:22:27 +0100 Subject: [PATCH 11/14] [CMake/CI] Clone additional transitive dependencies --- .travis.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d7abf7e4..56dffdc5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,8 +31,13 @@ matrix: env: TOOLSET=gcc COMPILER=g++ CXXSTD=03 - os: linux - env: TEST_CMAKE=true + env: TEST_CMAKE=true # unused - just for identification in travis ci gui script: + - git submodule update --init tools/cmake + - git submodule update --init libs/typeof + - git submodule update --init libs/conversion + - git submodule update --init libs/function_types + - git submodule update --init libs/fusion - mkdir __build__ - cd __build__ - cmake .. -DBOOST_ENABLE_CMAKE=ON -DBOOST_REGEX_INCLUDE_EXAMPLES=ON From c07e8c4f8076581682e17be2437ac98bce65b646 Mon Sep 17 00:00:00 2001 From: Mike Dev Date: Sat, 28 Dec 2019 13:51:31 +0100 Subject: [PATCH 12/14] [CMake] Add support for building shared library and restrict absolute include path to build interface --- CMakeLists.txt | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c0fdd27..621e28a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,9 +16,26 @@ file( GLOB BOOST_REGEX_SRC ./src/*.cpp ) add_library( boost_regex ${BOOST_REGEX_SRC} ) add_library( Boost::regex ALIAS boost_regex ) -target_include_directories( boost_regex PUBLIC include ) -target_compile_definitions( boost_regex PUBLIC BOOST_REGEX_NO_LIB) +# Currently, installation isn't supported directly, +# but someone else might install this target from the parent +# CMake script, so lets proactively differentiate between +# the include directory during regular use (BUILD_INTERFACE) +# and after installation +target_include_directories( boost_regex + PUBLIC + $ + $ +) +target_compile_definitions( boost_regex + PUBLIC + # No need for autolink and we don't mangle library name anyway + BOOST_REGEX_NO_LIB + $<$,SHARED_LIBRARY>:BOOST_REGEX_DYN_LINK=1> + $<$,STATIC_LIBRARY>:BOOST_REGEX_STATIC_LINK=1> +) + +# Specify dependencies (including header-only libraries) target_link_libraries( boost_regex PUBLIC Boost::assert From 957d2f1bca51b44af9360c3aadc2068567b3e3aa Mon Sep 17 00:00:00 2001 From: Mike Dev Date: Sat, 28 Dec 2019 13:52:21 +0100 Subject: [PATCH 13/14] [CMake] Add some comments about how to use the file --- CMakeLists.txt | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 621e28a1..d7e190be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,45 @@ # NOTE: CMake support for Boost.Regex is currently experimental at best # and the interface is likely to change in the future + +##### How-To: +# +# If you have a cmake project that wants to use and compile +# boost_regex, as part of a single build system run, do the following: +# 1) clone the boost project and all its sub-projects: +# +# git clone --branch develop --depth 1 --recursive --shallow-submodules https://github.com/boostorg/boost.git boost-root +# +# 2) add to your cmake script: +# +# add_subdirectory( []) +# target_link_libraries( PUBLIC Boost::regex) +# +# 3) run your cmake build as usual +# +# ## Explanation: +# +# Currently this file does not work standalone. It is expected to be +# invoked from a parent script via add_subdirectory. That parent script +# is responsible for providing targets for direct and indirect dependencies, +# such as Boost::assert, Boost::concept_check, e.g. by also adding those +# libraries via add_submodule (order doesn't matter). +# The parent script can be your own cmake script, but it is easier to just +# use add the CMakeLists in the root of the boost super project, which +# will in turn add all boost libraries usable with the add_subdirectory +# Workflow. +# +# Note: You don't need to actually clone all boost libraries. E.g. look +# into the travis ci file to see on which libraries boost_regex actually +# depends or use boostdep https://github.com/boostorg/boostdep + + +##### Current Limitations: +# +# - Doesn't compile or run tests +# - Doesn't support installation +# + cmake_minimum_required( VERSION 3.5 ) project( BoostRegex LANGUAGES CXX ) @@ -54,6 +93,8 @@ target_link_libraries( boost_regex ) if( BOOST_REGEX_USE_ICU ) + # ICU Targets could be provided by parent project, + # if not, look for them ourselves if( NOT TARGET ICU::dt ) # components need to be listed explicitly find_package( ICU COMPONENTS dt in uc REQUIRED ) From 92f6a803a5c497e0da5d8fd8304758a4c1cb18ff Mon Sep 17 00:00:00 2001 From: Mike Dev Date: Sat, 28 Dec 2019 13:54:25 +0100 Subject: [PATCH 14/14] [CMake/CI] Also test build as shared library on travis Also, as a minor tweak, put cmake builds to the front as they complete the most quickly --- .travis.yml | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 56dffdc5..bad8a07e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,21 +28,32 @@ matrix: include: - os: linux - env: TOOLSET=gcc COMPILER=g++ CXXSTD=03 - - - os: linux - env: TEST_CMAKE=true # unused - just for identification in travis ci gui - script: + env: TEST_CMAKE=true # variables unused - just for identification in travis ci gui + script: - git submodule update --init tools/cmake - - git submodule update --init libs/typeof - git submodule update --init libs/conversion - git submodule update --init libs/function_types - git submodule update --init libs/fusion - - mkdir __build__ - - cd __build__ - - cmake .. -DBOOST_ENABLE_CMAKE=ON -DBOOST_REGEX_INCLUDE_EXAMPLES=ON + - git submodule update --init libs/typeof + - mkdir __build__ && cd __build__ + - cmake .. -DBOOST_ENABLE_CMAKE=ON -DBOOST_REGEX_INCLUDE_EXAMPLES=ON - cmake --build . + - os: linux + env: TEST_CMAKE=true BUILD_SHARED_LIBS=On # variables unused - just for identification in travis ci gui + script: + - git submodule update --init tools/cmake + - git submodule update --init libs/conversion + - git submodule update --init libs/function_types + - git submodule update --init libs/fusion + - git submodule update --init libs/typeof + - mkdir __build__ && cd __build__ + - cmake .. -DBUILD_SHARED_LIBS=ON -DBOOST_ENABLE_CMAKE=ON -DBOOST_REGEX_INCLUDE_EXAMPLES=ON + - cmake --build . + + - os: linux + env: TOOLSET=gcc COMPILER=g++ CXXSTD=03 + - os: linux env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=03,11 addons: