From 76e7a4218e17ee952df7c3fedbca594f3a259e80 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Mon, 7 Mar 2022 16:32:43 +0000 Subject: [PATCH] Fix for building with BOOST_REGEX_MAX_CACHE_BLOCKS=0. Also fix some msvc warnings in test_sets.cpp. Add test case. Fixes the issues in https://github.com/boostorg/regex/pull/171 --- include/boost/regex/v5/mem_block_cache.hpp | 2 ++ test/Jamfile.v2 | 9 ++++++++ test/regress/test_sets.cpp | 26 +++++++++++----------- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/include/boost/regex/v5/mem_block_cache.hpp b/include/boost/regex/v5/mem_block_cache.hpp index eb3ec776..3e1216d0 100644 --- a/include/boost/regex/v5/mem_block_cache.hpp +++ b/include/boost/regex/v5/mem_block_cache.hpp @@ -34,6 +34,7 @@ namespace boost{ namespace BOOST_REGEX_DETAIL_NS{ +#if BOOST_REGEX_MAX_CACHE_BLOCKS != 0 #ifdef BOOST_REGEX_MEM_BLOCK_CACHE_LOCK_FREE /* lock free implementation */ struct mem_block_cache { @@ -138,6 +139,7 @@ struct mem_block_cache } }; #endif +#endif #if BOOST_REGEX_MAX_CACHE_BLOCKS == 0 diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 87bc1607..edbe190a 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -94,6 +94,15 @@ test-suite regex TEST_THREADS : regex_regress_threaded ] + [ run regress/$(R_SOURCE) ../build//boost_regex + ../../thread/build//boost_thread ../build//icu_options + : # command line + : # input files + : # requirements + TEST_THREADS + BOOST_REGEX_MAX_CACHE_BLOCKS=0 + : regex_regress_threaded_no_cache ] + [ regex-test posix_api_check : c_compiler_checks/posix_api_check.c ] [ compile c_compiler_checks/wide_posix_api_check.c diff --git a/test/regress/test_sets.cpp b/test/regress/test_sets.cpp index 3cd7a520..32f10450 100644 --- a/test/regress/test_sets.cpp +++ b/test/regress/test_sets.cpp @@ -170,19 +170,19 @@ void test_sets2() TEST_INVALID_REGEX("[[.NUL.]", perl); TEST_INVALID_REGEX("[[:<:]z]", perl); TEST_INVALID_REGEX("[a[:>:]]", perl); - TEST_REGEX_SEARCH("[[.A.]]", boost::regex::extended|icase, "A", match_default, make_array(0, 1, -2, -2)); - TEST_REGEX_SEARCH("[[.A.]]", boost::regex::extended|icase, "a", match_default, make_array(0, 1, -2, -2)); - TEST_REGEX_SEARCH("[[.A.]-b]+", boost::regex::extended|icase, "AaBb", match_default, make_array(0, 4, -2, -2)); - TEST_REGEX_SEARCH("[A-[.b.]]+", boost::regex::extended|icase, "AaBb", match_default, make_array(0, 4, -2, -2)); - TEST_REGEX_SEARCH("[[.a.]-B]+", boost::regex::extended|icase, "AaBb", match_default, make_array(0, 4, -2, -2)); - TEST_REGEX_SEARCH("[a-[.B.]]+", boost::regex::extended|icase, "AaBb", match_default, make_array(0, 4, -2, -2)); - TEST_REGEX_SEARCH("[\x61]", boost::regex::extended, "a", match_default, make_array(0, 1, -2, -2)); - TEST_REGEX_SEARCH("[\x61-c]+", boost::regex::extended, "abcd", match_default, make_array(0, 3, -2, -2)); - TEST_REGEX_SEARCH("[a-\x63]+", boost::regex::extended, "abcd", match_default, make_array(0, 3, -2, -2)); - TEST_REGEX_SEARCH("[[.a.]-c]+", boost::regex::extended, "abcd", match_default, make_array(0, 3, -2, -2)); - TEST_REGEX_SEARCH("[a-[.c.]]+", boost::regex::extended, "abcd", match_default, make_array(0, 3, -2, -2)); - TEST_INVALID_REGEX("[[:alpha:]-a]", boost::regex::extended); - TEST_INVALID_REGEX("[a-[:alpha:]]", boost::regex::extended); + TEST_REGEX_SEARCH("[[.A.]]", extended|icase, "A", match_default, make_array(0, 1, -2, -2)); + TEST_REGEX_SEARCH("[[.A.]]", extended|icase, "a", match_default, make_array(0, 1, -2, -2)); + TEST_REGEX_SEARCH("[[.A.]-b]+", extended|icase, "AaBb", match_default, make_array(0, 4, -2, -2)); + TEST_REGEX_SEARCH("[A-[.b.]]+", extended|icase, "AaBb", match_default, make_array(0, 4, -2, -2)); + TEST_REGEX_SEARCH("[[.a.]-B]+", extended|icase, "AaBb", match_default, make_array(0, 4, -2, -2)); + TEST_REGEX_SEARCH("[a-[.B.]]+", extended|icase, "AaBb", match_default, make_array(0, 4, -2, -2)); + TEST_REGEX_SEARCH("[\x61]", extended, "a", match_default, make_array(0, 1, -2, -2)); + TEST_REGEX_SEARCH("[\x61-c]+", extended, "abcd", match_default, make_array(0, 3, -2, -2)); + TEST_REGEX_SEARCH("[a-\x63]+", extended, "abcd", match_default, make_array(0, 3, -2, -2)); + TEST_REGEX_SEARCH("[[.a.]-c]+", extended, "abcd", match_default, make_array(0, 3, -2, -2)); + TEST_REGEX_SEARCH("[a-[.c.]]+", extended, "abcd", match_default, make_array(0, 3, -2, -2)); + TEST_INVALID_REGEX("[[:alpha:]-a]", extended); + TEST_INVALID_REGEX("[a-[:alpha:]]", extended); TEST_REGEX_SEARCH("[[.ae.]]", basic, "ae", match_default, make_array(0, 2, -2, -2)); TEST_REGEX_SEARCH("[[.ae.]]", basic, "aE", match_default, make_array(-2, -2)); TEST_REGEX_SEARCH("[[.AE.]]", basic, "AE", match_default, make_array(0, 2, -2, -2));