From a20fd8ad119fc69cc7890dd91d6def5149df9a4b Mon Sep 17 00:00:00 2001 From: wangchenguang Date: Thu, 30 Jul 2026 14:19:27 +0800 Subject: [PATCH 1/3] build(cxx): align all builds on a C++14 baseline CMake, Make, tests, tools, and examples now require C++14 so every supported build path shares the same minimum language level. The compiler checks and user-facing documentation reflect that baseline. --- CLAUDE.md | 2 +- CMakeLists.txt | 14 ++++++------- THREAT_MODEL.md | 3 +-- config_brpc.sh | 6 +++--- docs/cn/getting_started.md | 8 ++++---- docs/en/getting_started.md | 6 +++--- example/cmake/BrpcExample.cmake | 2 +- example/echo_c++/Makefile | 2 +- example/http_c++/Makefile | 2 +- example/memcache_c++/Makefile | 2 +- example/multi_threaded_echo_c++/Makefile | 2 +- example/rdma_performance/Makefile | 4 ++-- example/redis_c++/Makefile | 2 +- example/thrift_extension_c++/Makefile | 2 +- example/ubring_performance/CMakeLists.txt | 8 ++++---- src/butil/type_traits.h | 4 ++-- test/Makefile | 4 ++-- tools/parallel_http/Makefile | 2 +- tools/print_gcc_version.sh | 24 +++++++++++++++-------- tools/rpc_press/Makefile | 2 +- tools/rpc_replay/Makefile | 2 +- tools/rpc_view/Makefile | 2 +- tools/trackme_server/Makefile | 2 +- 23 files changed, 57 insertions(+), 50 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 56179636e3..fccb197c7b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -112,7 +112,7 @@ ASAN is used in CI: `ASAN_OPTIONS="detect_leaks=0:detect_stack_use_after_return= - General modifications should not be hidden inside protocol-specific files - All changes require unit tests - CI runs on GitHub Actions (Linux gcc/clang, macOS) — must pass before merge -- Uses C++11 minimum; some C++17 features with compiler guards. Legacy patterns (`DISALLOW_COPY_AND_ASSIGN` macro) still prevalent. +- Uses C++14 minimum; some C++17 features with compiler guards. Legacy patterns (`DISALLOW_COPY_AND_ASSIGN` macro) still prevalent. ## Dependencies diff --git a/CMakeLists.txt b/CMakeLists.txt index 915b7d2977..025ac1e93d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,14 +48,14 @@ SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "brpc authors") INCLUDE(CPack) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - # require at least gcc 4.8 - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) - message(FATAL_ERROR "GCC is too old, please install a newer version supporting C++11") + # require at least gcc 5.0 + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) + message(FATAL_ERROR "GCC is too old, please install a newer version supporting C++14") endif() elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - # require at least clang 3.3 - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3) - message(FATAL_ERROR "Clang is too old, please install a newer version supporting C++11") + # require at least clang 3.5 + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5) + message(FATAL_ERROR "Clang is too old, please install a newer version supporting C++14") endif() else() message(WARNING "You are using an unsupported compiler! Compilation has only been tested with Clang and GCC.") @@ -68,7 +68,7 @@ set(BRPC_COMMON_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} ) set(BRPC_COMMON_LINK_OPTIONS) -set(BRPC_CXX_STANDARD 11) +set(BRPC_CXX_STANDARD 14) set(WITH_GLOG_VAL "0") if(WITH_GLOG) diff --git a/THREAT_MODEL.md b/THREAT_MODEL.md index e318507634..753bced2ad 100644 --- a/THREAT_MODEL.md +++ b/THREAT_MODEL.md @@ -153,7 +153,7 @@ bRPC is a C++ library that normally runs on Linux/macOS with POSIX sockets, Open ### OS / runtime / hardware - Linux and macOS are supported; Windows is not included in the security support scope for now. -- A C++11 or newer toolchain is required. +- A C++14 or newer toolchain is required. - POSIX sockets and Linux epoll or macOS kqueue are required. - TLS depends on OpenSSL; risks from old OpenSSL versions are managed by the operator. - gflags, protobuf, and leveldb are regular dependencies; tcmalloc/gperftools is optional. @@ -624,4 +624,3 @@ Once the PMC publishes `SECURITY.md` or an official security policy, that artifa --- *End of v1 draft.* - diff --git a/config_brpc.sh b/config_brpc.sh index 1c05942068..5850e18105 100755 --- a/config_brpc.sh +++ b/config_brpc.sh @@ -126,8 +126,8 @@ fi print_info "CC=$CC, CXX=$CXX" GCC_VERSION=$(CXX=$CXX tools/print_gcc_version.sh) -if [ $GCC_VERSION -gt 0 ] && [ $GCC_VERSION -lt 40800 ]; then - >&2 $ECHO "GCC is too old, please install a newer version supporting C++11" +if [ $GCC_VERSION -eq 0 ] || [ $GCC_VERSION -lt 50000 ]; then + >&2 $ECHO "C++ compiler is too old, please install GCC 5.0+ or Clang 3.5+ with C++14 support" exit 1 fi @@ -383,7 +383,7 @@ if [ "$PROTOBUF_VERSION" -ge 4022000 ]; then CXXFLAGS="-std=c++17" print_success "Found protobuf version $PROTOBUF_VERSION (>= v22, using C++17 with abseil)" else - CXXFLAGS="-std=c++0x" + CXXFLAGS="-std=c++14" print_success "Found protobuf version $PROTOBUF_VERSION" fi diff --git a/docs/cn/getting_started.md b/docs/cn/getting_started.md index 6dee100cc5..334906a125 100644 --- a/docs/cn/getting_started.md +++ b/docs/cn/getting_started.md @@ -260,7 +260,7 @@ brew install gperftools 如果你要运行测试,需安装gtest。先运行`brew install googletest`看看homebrew是否支持(老版本没有),没有的话请下载和编译googletest: ```shell -git clone https://github.com/google/googletest -b release-1.10.0 && cd googletest/googletest && mkdir build && cd build && cmake -DCMAKE_CXX_FLAGS="-std=c++11" .. && make +git clone https://github.com/google/googletest -b release-1.10.0 && cd googletest/googletest && mkdir build && cd build && cmake -DCMAKE_CXX_FLAGS="-std=c++14" .. && make ``` 在编译完成后,复制`include/`和`lib/`目录到`/usr/local/include`和`/usr/local/lib`目录中,以便于让所有应用都能使用gtest。 @@ -324,13 +324,13 @@ $ docker run -it brpc:master /bin/bash # 支持的依赖 -## GCC: 4.8-11.2 +## GCC: 5.0-11.2 **推荐 8.2 及以上版本。** -默认启用 c++11,以去除对 boost 的依赖(比如 atomic)。 +默认启用 c++14,以去除对 boost 的依赖(比如 atomic)。 -理论支持 c++11 的编译器都应可以,但部分编译器版本对 c++11 的支持存在问题。目前 GCC 4.8 可支持编译的最高版本为 1.5.0。 +理论支持 c++14 的编译器都应可以,但部分编译器版本对 c++14 的支持存在问题。 GCC7中over-aligned的问题暂时被禁止。 diff --git a/docs/en/getting_started.md b/docs/en/getting_started.md index e4dd40390c..32d4733766 100644 --- a/docs/en/getting_started.md +++ b/docs/en/getting_started.md @@ -266,7 +266,7 @@ brew install gperftools If you need to run tests, googletest is required. Run `brew install googletest` first to see if it works. If not (old homebrew does not have googletest), you can download and compile googletest by your own: ```shell -git clone https://github.com/google/googletest -b release-1.10.0 && cd googletest/googletest && mkdir build && cd build && cmake -DCMAKE_CXX_FLAGS="-std=c++11" .. && make +git clone https://github.com/google/googletest -b release-1.10.0 && cd googletest/googletest && mkdir build && cd build && cmake -DCMAKE_CXX_FLAGS="-std=c++14" .. && make ``` After the compilation, copy `include/` and `lib/` into `/usr/local/include` and `/usr/local/lib` respectively to expose gtest to all apps @@ -320,11 +320,11 @@ Same with [here](#compile-brpc-with-cmake) # Supported deps -## GCC: 4.8-11.2 +## GCC: 5.0-11.2 **Prefer GCC 8.2+** -c++11 is turned on by default to remove dependencies on boost (atomic). +c++14 is turned on by default to remove dependencies on boost (atomic). The over-aligned issues in GCC7 is suppressed temporarily now. diff --git a/example/cmake/BrpcExample.cmake b/example/cmake/BrpcExample.cmake index 7afb3bd3a9..9eec3c0f86 100644 --- a/example/cmake/BrpcExample.cmake +++ b/example/cmake/BrpcExample.cmake @@ -124,7 +124,7 @@ function(brpc_example_configure_target target_name) target_include_directories(${target_name} PRIVATE ${_include_dirs}) endif() - target_compile_features(${target_name} PRIVATE cxx_std_11) + target_compile_features(${target_name} PRIVATE cxx_std_14) target_compile_definitions(${target_name} PRIVATE NDEBUG __const__=__unused__ diff --git a/example/echo_c++/Makefile b/example/echo_c++/Makefile index fddde8cbc1..4aab63bfcb 100644 --- a/example/echo_c++/Makefile +++ b/example/echo_c++/Makefile @@ -20,7 +20,7 @@ BRPC_PATH=../.. include $(BRPC_PATH)/config.mk # Notes on the flags: # 1. Added -fno-omit-frame-pointer: perf/tcmalloc-profiler use frame pointers by default -CXXFLAGS+=$(CPPFLAGS) -std=c++0x -DNDEBUG -O2 -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer +CXXFLAGS+=$(CPPFLAGS) -std=c++14 -DNDEBUG -O2 -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer ifeq ($(NEED_GPERFTOOLS), 1) CXXFLAGS+=-DBRPC_ENABLE_CPU_PROFILER endif diff --git a/example/http_c++/Makefile b/example/http_c++/Makefile index 515456559b..ad4d7ccc14 100644 --- a/example/http_c++/Makefile +++ b/example/http_c++/Makefile @@ -20,7 +20,7 @@ BRPC_PATH=../../ include $(BRPC_PATH)/config.mk # Notes on the flags: # 1. Added -fno-omit-frame-pointer: perf/tcmalloc-profiler use frame pointers by default -CXXFLAGS+=$(CPPFLAGS) -std=c++0x -DNDEBUG -O2 -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer +CXXFLAGS+=$(CPPFLAGS) -std=c++14 -DNDEBUG -O2 -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer ifeq ($(NEED_GPERFTOOLS), 1) CXXFLAGS+=-DBRPC_ENABLE_CPU_PROFILER endif diff --git a/example/memcache_c++/Makefile b/example/memcache_c++/Makefile index 03b3d4cd76..19cea04386 100644 --- a/example/memcache_c++/Makefile +++ b/example/memcache_c++/Makefile @@ -17,7 +17,7 @@ BRPC_PATH = ../../ include $(BRPC_PATH)/config.mk -CXXFLAGS+=$(CPPFLAGS) -std=c++0x -DNDEBUG -O2 -pipe -W -Wall -fPIC -fno-omit-frame-pointer +CXXFLAGS+=$(CPPFLAGS) -std=c++14 -DNDEBUG -O2 -pipe -W -Wall -fPIC -fno-omit-frame-pointer HDRS+=$(BRPC_PATH)/output/include LIBS+=$(BRPC_PATH)/output/lib HDRPATHS = $(addprefix -I, $(HDRS)) diff --git a/example/multi_threaded_echo_c++/Makefile b/example/multi_threaded_echo_c++/Makefile index cd344f98db..b584eb6881 100644 --- a/example/multi_threaded_echo_c++/Makefile +++ b/example/multi_threaded_echo_c++/Makefile @@ -20,7 +20,7 @@ BRPC_PATH=../.. include $(BRPC_PATH)/config.mk # Notes on the flags: # 1. Added -fno-omit-frame-pointer: perf/tcmalloc-profiler use frame pointers by default -CXXFLAGS+=$(CPPFLAGS) -std=c++0x -DNDEBUG -O2 -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer +CXXFLAGS+=$(CPPFLAGS) -std=c++14 -DNDEBUG -O2 -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer ifeq ($(NEED_GPERFTOOLS), 1) CXXFLAGS+=-DBRPC_ENABLE_CPU_PROFILER endif diff --git a/example/rdma_performance/Makefile b/example/rdma_performance/Makefile index 60c59702a7..c112f1c330 100644 --- a/example/rdma_performance/Makefile +++ b/example/rdma_performance/Makefile @@ -21,7 +21,7 @@ include $(BRPC_PATH)/config.mk # Notes on the flags: # 1. Added -fno-omit-frame-pointer: perf/tcmalloc-profiler use frame pointers by default # 2. Added -D__const__= : Avoid over-optimizations of TLS variables by GCC>=4.8 -CXXFLAGS+=$(CPPFLAGS) -std=c++0x -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer +CXXFLAGS+=$(CPPFLAGS) -std=c++14 -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer ifeq ($(NEED_GPERFTOOLS), 1) CXXFLAGS+=-DBRPC_ENABLE_CPU_PROFILER endif @@ -93,7 +93,7 @@ endif @echo "> Compiling $@" $(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@ + %.o:%.cc @echo "> Compiling $@" $(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@ - diff --git a/example/redis_c++/Makefile b/example/redis_c++/Makefile index c1225af18b..92d3ffec73 100644 --- a/example/redis_c++/Makefile +++ b/example/redis_c++/Makefile @@ -17,7 +17,7 @@ BRPC_PATH = ../../ include $(BRPC_PATH)/config.mk -CXXFLAGS+=$(CPPFLAGS) -std=c++0x -DNDEBUG -O2 -pipe -W -Wall -fPIC -fno-omit-frame-pointer +CXXFLAGS+=$(CPPFLAGS) -std=c++14 -DNDEBUG -O2 -pipe -W -Wall -fPIC -fno-omit-frame-pointer HDRS+=$(BRPC_PATH)/output/include LIBS+=$(BRPC_PATH)/output/lib HDRPATHS = $(addprefix -I, $(HDRS)) diff --git a/example/thrift_extension_c++/Makefile b/example/thrift_extension_c++/Makefile index 47b381fdb2..50f106ade8 100644 --- a/example/thrift_extension_c++/Makefile +++ b/example/thrift_extension_c++/Makefile @@ -20,7 +20,7 @@ BRPC_PATH = ../../ include $(BRPC_PATH)/config.mk # Notes on the flags: # 1. Added -fno-omit-frame-pointer: perf/tcmalloc-profiler use frame pointers by default -CXXFLAGS = $(CPPFLAGS) -std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer +CXXFLAGS = $(CPPFLAGS) -std=c++14 -g -DNDEBUG -O2 -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer ifeq ($(NEED_GPERFTOOLS), 1) CXXFLAGS+=-DBRPC_ENABLE_CPU_PROFILER endif diff --git a/example/ubring_performance/CMakeLists.txt b/example/ubring_performance/CMakeLists.txt index 729381ccb8..43621862f9 100644 --- a/example/ubring_performance/CMakeLists.txt +++ b/example/ubring_performance/CMakeLists.txt @@ -71,13 +71,13 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pip if(CMAKE_VERSION VERSION_LESS "3.1.3") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") endif() if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") endif() else() - set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) endif() @@ -131,4 +131,4 @@ add_executable(ubring_performance_client client.cpp ${PROTO_SRC} ${PROTO_HEADER} add_executable(ubring_performance_server server.cpp ${PROTO_SRC} ${PROTO_HEADER}) target_link_libraries(ubring_performance_client ${BRPC_LIB} ${DYNAMIC_LIB}) -target_link_libraries(ubring_performance_server ${BRPC_LIB} ${DYNAMIC_LIB}) \ No newline at end of file +target_link_libraries(ubring_performance_server ${BRPC_LIB} ${DYNAMIC_LIB}) diff --git a/src/butil/type_traits.h b/src/butil/type_traits.h index 735e1e55ce..6e3909caac 100644 --- a/src/butil/type_traits.h +++ b/src/butil/type_traits.h @@ -373,11 +373,11 @@ template struct result_of; template struct result_of : std::invoke_result {}; -#elif __cplusplus >= 201103L +#elif __cplusplus >= 201402L template using result_of = std::result_of; #else -#error Only C++11 or later is supported. +#error Only C++14 or later is supported. #endif // __cplusplus template diff --git a/test/Makefile b/test/Makefile index 15169937ef..136b6f6803 100644 --- a/test/Makefile +++ b/test/Makefile @@ -19,7 +19,7 @@ NEED_GPERFTOOLS=1 NEED_GTEST=1 include ../config.mk CPPFLAGS+=-DBTHREAD_USE_FAST_PTHREAD_MUTEX -D_GNU_SOURCE -DUSE_SYMBOLIZE -DNO_TCMALLOC -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DUNIT_TEST -DBVAR_NOT_LINK_DEFAULT_VARIABLES -CXXFLAGS+=$(CPPFLAGS) -pipe -Wall -W -fPIC -fstrict-aliasing -Wno-invalid-offsetof -Wno-unused-parameter -fno-omit-frame-pointer -fno-access-control -std=c++0x +CXXFLAGS+=$(CPPFLAGS) -pipe -Wall -W -fPIC -fstrict-aliasing -Wno-invalid-offsetof -Wno-unused-parameter -fno-omit-frame-pointer -fno-access-control -std=c++14 # On Darwin, only gtest library is needed, other libraries have been linked in `brpc.dbg.dylib` ifeq ($(SYSTEM),Darwin) @@ -258,7 +258,7 @@ brpc_h2_unsent_message_unittest.o:brpc_h2_unsent_message_unittest.cpp | libbrpc. @echo "> Compiling $@" $(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@ + %.o:%.cc | libbrpc.dbg.$(SOEXT) @echo "> Compiling $@" $(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@ - diff --git a/tools/parallel_http/Makefile b/tools/parallel_http/Makefile index a57c5d5f53..f919b5111e 100644 --- a/tools/parallel_http/Makefile +++ b/tools/parallel_http/Makefile @@ -17,7 +17,7 @@ BRPC_PATH = ../../ include $(BRPC_PATH)/config.mk -CXXFLAGS = $(CPPFLAGS) -std=c++0x -DNDEBUG -O2 -pipe -W -Wall -fPIC -fno-omit-frame-pointer -Wno-unused-parameter +CXXFLAGS = $(CPPFLAGS) -std=c++14 -DNDEBUG -O2 -pipe -W -Wall -fPIC -fno-omit-frame-pointer -Wno-unused-parameter HDRPATHS = -I$(BRPC_PATH)/output/include $(addprefix -I, $(HDRS)) LIBPATHS = -L$(BRPC_PATH)/output/lib $(addprefix -L, $(LIBS)) STATIC_LINKINGS += $(BRPC_PATH)/output/lib/libbrpc.a diff --git a/tools/print_gcc_version.sh b/tools/print_gcc_version.sh index 00abf6cc1b..55bc9d9675 100755 --- a/tools/print_gcc_version.sh +++ b/tools/print_gcc_version.sh @@ -17,7 +17,11 @@ while read -r line; do val=$(echo "$line" | awk '{print $3}') - if [[ $line =~ __clang__ ]]; then + if [[ $line =~ __clang_major__ ]]; then + CLANG_MAJOR=${val} + elif [[ $line =~ __clang_minor__ ]]; then + CLANG_MINOR=${val} + elif [[ $line =~ __clang__ ]]; then CLANG=${val} elif [[ $line =~ __GNUC__ ]]; then GNUC=${val} @@ -26,15 +30,19 @@ while read -r line; do elif [[ $line =~ __GNUC_PATCHLEVEL__ ]]; then GNUC_PATCHLEVEL=${val} fi -done < <("${CXX:-c++}" -dM -E - < /dev/null | grep "__clang__\|__GNUC__\|__GNUC_MINOR__\|__GNUC_PATCHLEVEL__") +done < <("${CXX:-c++}" -dM -E - < /dev/null | grep "__clang__\|__clang_major__\|__clang_minor__\|__GNUC__\|__GNUC_MINOR__\|__GNUC_PATCHLEVEL__") -if [ -n "$GNUC" ] && [ -n "$GNUC_MINOR" ] && [ -n "$GNUC_PATCHLEVEL" ]; then - # Calculate GCC/Clang version - GCC_VERSION=$((GNUC * 10000 + GNUC_MINOR * 100 + GNUC_PATCHLEVEL)) - if [ -n "$CLANG" ] && [ "40000" -lt $GCC_VERSION ] && [ $GCC_VERSION -lt "40800" ]; then - # Make version of clang >= 4.8 so that it's not rejected by config_brpc.sh - GCC_VERSION=40800 +if [ -n "$CLANG" ] && [ -n "$CLANG_MAJOR" ] && [ -n "$CLANG_MINOR" ]; then + if [ "$CLANG_MAJOR" -gt 3 ] || \ + { [ "$CLANG_MAJOR" -eq 3 ] && [ "$CLANG_MINOR" -ge 5 ]; }; then + # config_brpc.sh uses the GCC-equivalent version threshold. + echo 50000 + else + echo 0 fi +elif [ -n "$GNUC" ] && [ -n "$GNUC_MINOR" ] && [ -n "$GNUC_PATCHLEVEL" ]; then + # Calculate GCC version. + GCC_VERSION=$((GNUC * 10000 + GNUC_MINOR * 100 + GNUC_PATCHLEVEL)) echo $GCC_VERSION else echo 0 diff --git a/tools/rpc_press/Makefile b/tools/rpc_press/Makefile index 8cae3033c2..bef6d30eb5 100644 --- a/tools/rpc_press/Makefile +++ b/tools/rpc_press/Makefile @@ -17,7 +17,7 @@ BRPC_PATH = ../../ include $(BRPC_PATH)/config.mk -CXXFLAGS = $(CPPFLAGS) -std=c++0x -DNDEBUG -O2 -pipe -W -Wall -fPIC -fno-omit-frame-pointer -Wno-unused-parameter +CXXFLAGS = $(CPPFLAGS) -std=c++14 -DNDEBUG -O2 -pipe -W -Wall -fPIC -fno-omit-frame-pointer -Wno-unused-parameter HDRPATHS = -I$(BRPC_PATH)/output/include $(addprefix -I, $(HDRS)) LIBPATHS = -L$(BRPC_PATH)/output/lib $(addprefix -L, $(LIBS)) STATIC_LINKINGS += $(BRPC_PATH)/output/lib/libbrpc.a diff --git a/tools/rpc_replay/Makefile b/tools/rpc_replay/Makefile index 8f4eadde85..9ea388d529 100644 --- a/tools/rpc_replay/Makefile +++ b/tools/rpc_replay/Makefile @@ -17,7 +17,7 @@ BRPC_PATH = ../../ include $(BRPC_PATH)/config.mk -CXXFLAGS = $(CPPFLAGS) -std=c++0x -DNDEBUG -O2 -pipe -W -Wall -fPIC -fno-omit-frame-pointer -Wno-unused-parameter +CXXFLAGS = $(CPPFLAGS) -std=c++14 -DNDEBUG -O2 -pipe -W -Wall -fPIC -fno-omit-frame-pointer -Wno-unused-parameter HDRPATHS = -I$(BRPC_PATH)/output/include $(addprefix -I, $(HDRS)) LIBPATHS = -L$(BRPC_PATH)/output/lib $(addprefix -L, $(LIBS)) STATIC_LINKINGS += $(BRPC_PATH)/output/lib/libbrpc.a diff --git a/tools/rpc_view/Makefile b/tools/rpc_view/Makefile index 13f026cbeb..72cf5d379f 100644 --- a/tools/rpc_view/Makefile +++ b/tools/rpc_view/Makefile @@ -19,7 +19,7 @@ BRPC_PATH = ../../ include $(BRPC_PATH)/config.mk # Notes on the flags: # 1. Added -fno-omit-frame-pointer: perf/tcmalloc-profiler use frame pointers by default -CXXFLAGS = $(CPPFLAGS) -std=c++0x -DNDEBUG -O2 -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer +CXXFLAGS = $(CPPFLAGS) -std=c++14 -DNDEBUG -O2 -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer HDRPATHS = -I$(BRPC_PATH)/output/include $(addprefix -I, $(HDRS)) LIBPATHS = -L$(BRPC_PATH)/output/lib $(addprefix -L, $(LIBS)) STATIC_LINKINGS += $(BRPC_PATH)/output/lib/libbrpc.a diff --git a/tools/trackme_server/Makefile b/tools/trackme_server/Makefile index 5bdd53f86f..d6eb71c3ef 100644 --- a/tools/trackme_server/Makefile +++ b/tools/trackme_server/Makefile @@ -17,7 +17,7 @@ BRPC_PATH = ../../ include $(BRPC_PATH)/config.mk -CXXFLAGS = $(CPPFLAGS) -std=c++0x -DNDEBUG -O2 -pipe -W -Wall -fPIC -fno-omit-frame-pointer +CXXFLAGS = $(CPPFLAGS) -std=c++14 -DNDEBUG -O2 -pipe -W -Wall -fPIC -fno-omit-frame-pointer HDRPATHS = -I$(BRPC_PATH)/output/include $(addprefix -I, $(HDRS)) LIBPATHS = -L$(BRPC_PATH)/output/lib $(addprefix -L, $(LIBS)) STATIC_LINKINGS += $(BRPC_PATH)/output/lib/libbrpc.a From 1a952b52959ea21df5f0e97a207d72dbe5459174 Mon Sep 17 00:00:00 2001 From: wangchenguang Date: Thu, 30 Jul 2026 23:29:57 +0800 Subject: [PATCH 2/3] fix(test): keep cores scoped to the failing test Clear prior cores before each test binary. A passing death test can leave a core that would otherwise be used to diagnose an unrelated later failure. --- test/run_tests.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/run_tests.sh b/test/run_tests.sh index ced0297686..dd80afd94f 100755 --- a/test/run_tests.sh +++ b/test/run_tests.sh @@ -17,7 +17,7 @@ # turn on coredumps ulimit -c unlimited -rm core.* +rm -f core.* test_num=0 failed_test="" @@ -27,6 +27,9 @@ export ASAN_OPTIONS="detect_leaks=1:detect_stack_use_after_return=1" for test_bin in $test_bins; do test_num=$((test_num + 1)) >&2 echo "[runtest] $test_bin" + # A passing death test may leave a core behind. Keep only cores from the + # binary about to run so a later failure is symbolized against its core. + rm -f core.* ./$test_bin # If ASan abort without detailed call stack of new/delete, # try to disable fast_unwind_on_malloc, which would be a performance killer. From 1bf6119845ad5a068b6aa1ecfa8588d68bb7cbae Mon Sep 17 00:00:00 2001 From: wangchenguang Date: Wed, 5 Aug 2026 13:57:24 +0800 Subject: [PATCH 3/3] revert src/butil/type_traits.h --- src/butil/type_traits.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/butil/type_traits.h b/src/butil/type_traits.h index 6e3909caac..735e1e55ce 100644 --- a/src/butil/type_traits.h +++ b/src/butil/type_traits.h @@ -373,11 +373,11 @@ template struct result_of; template struct result_of : std::invoke_result {}; -#elif __cplusplus >= 201402L +#elif __cplusplus >= 201103L template using result_of = std::result_of; #else -#error Only C++14 or later is supported. +#error Only C++11 or later is supported. #endif // __cplusplus template