Skip to content

Commit

Permalink
refactor(regex): use std::regex instead of boost::regex (apache#1697)
Browse files Browse the repository at this point in the history
This patch removes to build and link Boost::filesystem library, and use std::regex
instead of boost::regex.
  • Loading branch information
acelyc111 authored Nov 28, 2023
1 parent da54c58 commit 6cb3f5e
Show file tree
Hide file tree
Showing 49 changed files with 54 additions and 72 deletions.
2 changes: 1 addition & 1 deletion cmake_modules/BaseFunctions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ function(dsn_setup_thirdparty_libs)

set(CMAKE_PREFIX_PATH ${THIRDPARTY_INSTALL_DIR};${CMAKE_PREFIX_PATH})
message(STATUS "CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}")
find_package(Boost COMPONENTS system filesystem regex REQUIRED)
find_package(Boost COMPONENTS system filesystem REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})

find_library(THRIFT_LIB NAMES libthrift.a PATHS ${THIRDPARTY_INSTALL_DIR}/lib NO_DEFAULT_PATH)
Expand Down
2 changes: 1 addition & 1 deletion src/aio/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS gtest dsn_runtime dsn_aio test_utils rocksdb)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

# Extra files that will be installed
set(MY_BINPLACES
Expand Down
2 changes: 1 addition & 1 deletion src/base/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ set(MY_PROJ_LIBS
pegasus_base
gtest)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES config.ini run.sh)

Expand Down
2 changes: 1 addition & 1 deletion src/block_service/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ set(MY_PROJ_LIBS
test_utils
rocksdb)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES
config-test.ini
Expand Down
2 changes: 1 addition & 1 deletion src/client/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ set(MY_PROJ_LIBS
gtest
rocksdb)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES
"${CMAKE_CURRENT_SOURCE_DIR}/run.sh"
Expand Down
2 changes: 1 addition & 1 deletion src/common/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ set(MY_PROJ_LIBS
gtest
rocksdb)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES
config-test.ini
Expand Down
2 changes: 1 addition & 1 deletion src/failure_detector/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ set(MY_PROJ_LIBS
hashtable
rocksdb)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

# Extra files that will be installed
set(MY_BINPLACES
Expand Down
2 changes: 1 addition & 1 deletion src/geo/bench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ set(MY_PROJ_LIBS
dsn_utils
)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES "config.ini")

Expand Down
2 changes: 1 addition & 1 deletion src/geo/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ set(MY_PROJ_LIBS
dsn_utils
gtest)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

add_definitions(-Wno-attributes)

Expand Down
2 changes: 1 addition & 1 deletion src/http/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ set(MY_PROJ_LIBS
rocksdb
)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES
"${CMAKE_CURRENT_SOURCE_DIR}/run.sh"
Expand Down
2 changes: 1 addition & 1 deletion src/meta/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ set(MY_PROJ_LIBS
hdfs
rocksdb)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

# Extra files that will be installed
set(MY_BINPLACES "")
Expand Down
2 changes: 1 addition & 1 deletion src/meta/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ set(MY_PROJ_LIBS
gtest
hdfs)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

# Extra files that will be installed
set(MY_BINPLACES clear.sh run.sh config-test.ini suite1 suite2)
Expand Down
2 changes: 1 addition & 1 deletion src/meta/test/balancer_simulator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ set(MY_PROJ_LIBS
hashtable
gtest)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

# Extra files that will be installed
set(MY_BINPLACES "")
Expand Down
2 changes: 1 addition & 1 deletion src/meta/test/meta_state/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ set(MY_PROJ_LIBS
gtest
)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

# Extra files that will be installed
set(MY_BINPLACES
Expand Down
2 changes: 1 addition & 1 deletion src/nfs/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS dsn_nfs dsn_runtime gtest dsn_aio rocksdb test_utils)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

# Extra files that will be installed
set(MY_BINPLACES
Expand Down
2 changes: 1 addition & 1 deletion src/perf_counter/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS gtest dsn_runtime rocksdb)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

# Extra files that will be installed
set(MY_BINPLACES
Expand Down
2 changes: 1 addition & 1 deletion src/redis_protocol/proxy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ set(MY_PROJ_LIBS pegasus.rproxylib

set(MY_BINPLACES "config.ini")

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

# Avoid megabytes of warnings like:
# thirdparty/output/include/s2/s1angle.h:288:28: error:
Expand Down
2 changes: 1 addition & 1 deletion src/redis_protocol/proxy_ut/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ set(MY_PROJ_SRC "")
# "GLOB" for non-recursive search
set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_PROJ_LIBS pegasus.rproxylib
pegasus_base
Expand Down
2 changes: 1 addition & 1 deletion src/replica/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ set(MY_PROJ_LIBS
PocoJSON
rocksdb)

set(MY_BOOST_LIBS Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::filesystem)

# Extra files that will be installed
set(MY_BINPLACES "")
Expand Down
2 changes: 1 addition & 1 deletion src/replica/backup/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ set(MY_PROJ_LIBS dsn_meta_server
gtest
rocksdb)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES
config-test.ini
Expand Down
2 changes: 1 addition & 1 deletion src/replica/bulk_load/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ set(MY_PROJ_LIBS dsn_meta_server
test_utils
rocksdb)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex rocksdb test_utils)
set(MY_BOOST_LIBS Boost::system Boost::filesystem rocksdb test_utils)

set(MY_BINPLACES
config-test.ini
Expand Down
2 changes: 1 addition & 1 deletion src/replica/duplication/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ set(MY_PROJ_LIBS dsn_meta_server
test_utils
rocksdb)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES
config-test.ini
Expand Down
2 changes: 1 addition & 1 deletion src/replica/split/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ set(MY_PROJ_LIBS dsn_meta_server
gtest
)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES
config-test.ini
Expand Down
2 changes: 1 addition & 1 deletion src/replica/storage/simple_kv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS dsn_replica_server dsn_meta_server dsn_client dsn_runtime hashtable rocksdb)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(INI_FILES "")
file(GLOB
Expand Down
2 changes: 1 addition & 1 deletion src/replica/storage/simple_kv/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ set(MY_PROJ_LIBS dsn_replica_server
dsn_utils
rocksdb)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

# Extra files that will be installed
FILE(GLOB CASE_FILES "case-*")
Expand Down
2 changes: 1 addition & 1 deletion src/replica/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ set(MY_PROJ_LIBS dsn_meta_server
test_utils
rocksdb)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

#Extra files that will be installed
set(MY_BINPLACES clear.sh run.sh config-test.ini)
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ set(MY_PROJ_LIBS gtest
rocksdb
)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

# Extra files that will be installed
set(MY_BINPLACES "${CMAKE_CURRENT_SOURCE_DIR}/config-test-corrupt-message.ini"
Expand Down
6 changes: 1 addition & 5 deletions src/sample/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ set(MY_PROJ_LIBS
pegasus_client_static
)

set(MY_BOOST_LIBS
Boost::filesystem
Boost::system
Boost::regex
)
set(MY_BOOST_LIBS Boost::filesystem Boost::system)

set(MY_BINPLACES config.ini run.sh)

Expand Down
2 changes: 1 addition & 1 deletion src/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ set(MY_PROJ_LIBS
hashtable
)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES "${CMAKE_CURRENT_SOURCE_DIR}/config.ini")

Expand Down
2 changes: 1 addition & 1 deletion src/server/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ set(MY_PROJ_LIBS
add_definitions(-DPEGASUS_UNIT_TEST)
add_definitions(-DENABLE_FAIL)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES config.ini run.sh)

Expand Down
6 changes: 1 addition & 5 deletions src/shell/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,7 @@ set(MY_PROJ_LIBS

set(MY_BINPLACES "${CMAKE_CURRENT_SOURCE_DIR}/config.ini")

set(MY_BOOST_LIBS
Boost::system
Boost::filesystem
Boost::regex # dsn_replica_server.so needs
)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

SET(CMAKE_INSTALL_RPATH ".")
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
Expand Down
2 changes: 1 addition & 1 deletion src/test/bench_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ set(MY_PROJ_LIBS
krb5
)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES "config.ini")

Expand Down
2 changes: 1 addition & 1 deletion src/test/function_test/backup_restore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ set(MY_PROJ_LIBS
function_test_utils
)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES "../config.ini" "../run.sh")

Expand Down
2 changes: 1 addition & 1 deletion src/test/function_test/base_api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ set(MY_PROJ_LIBS
test_utils
)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES "../config.ini" "../run.sh")

Expand Down
2 changes: 1 addition & 1 deletion src/test/function_test/bulk_load/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ set(MY_PROJ_LIBS
test_utils
rocksdb)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES "../config.ini" "../run.sh")

Expand Down
2 changes: 1 addition & 1 deletion src/test/function_test/detect_hotspot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ set(MY_PROJ_LIBS
function_test_utils
)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES "../config.ini" "../run.sh")

Expand Down
2 changes: 1 addition & 1 deletion src/test/function_test/partition_split/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ set(MY_PROJ_LIBS
test_utils
)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES "../config.ini" "../run.sh")

Expand Down
2 changes: 1 addition & 1 deletion src/test/function_test/recovery/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ set(MY_PROJ_LIBS
function_test_utils
)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES "../config.ini" "../run.sh")

Expand Down
2 changes: 1 addition & 1 deletion src/test/function_test/restore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ set(MY_PROJ_LIBS
test_utils
)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES "../config.ini" "../run.sh")

Expand Down
2 changes: 1 addition & 1 deletion src/test/function_test/throttle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ set(MY_PROJ_LIBS
test_utils
)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES "../config.ini" "../run.sh")

Expand Down
2 changes: 1 addition & 1 deletion src/test/kill_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ set(MY_PROJ_LIBS
)
set(MY_BINPLACES "${CMAKE_CURRENT_SOURCE_DIR}/config.ini")

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

if (UNIX)
SET(CMAKE_INSTALL_RPATH ".")
Expand Down
2 changes: 1 addition & 1 deletion src/test/pressure_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ set(MY_PROJ_LIBS

set(MY_BINPLACES "${CMAKE_CURRENT_SOURCE_DIR}/config-pressure.ini")

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

if (UNIX)
SET(CMAKE_INSTALL_RPATH ".")
Expand Down
2 changes: 1 addition & 1 deletion src/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ set(MY_PROJ_NAME dsn_utils)
# "GLOB" for non-recursive search
set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_PROJ_LIBS dsn_http rocksdb)

Expand Down
Loading

0 comments on commit 6cb3f5e

Please sign in to comment.