This is an automated email from the ASF dual-hosted git repository.
chenBright pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git
The following commit(s) were added to refs/heads/master by this push:
new 03131022 build(cxx): align all builds on a C++14 baseline (#3419)
03131022 is described below
commit 031310227616ad49e5d096616e19572f638b592a
Author: darion-yaphet <[email protected]>
AuthorDate: Thu Aug 6 17:34:49 2026 +0800
build(cxx): align all builds on a C++14 baseline (#3419)
* 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.
* 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.
* revert src/butil/type_traits.h
---
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 ++++----
test/Makefile | 4 ++--
test/run_tests.sh | 5 ++++-
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, 59 insertions(+), 49 deletions(-)
diff --git a/CLAUDE.md b/CLAUDE.md
index 56179636..fccb197c 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 2b92dca1..9419ac3a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -49,14 +49,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.")
@@ -69,7 +69,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 e3185076..753bced2 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 3237d663..85692de3 100755
--- a/config_brpc.sh
+++ b/config_brpc.sh
@@ -128,8 +128,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
@@ -385,7 +385,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 6dee100c..334906a1 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 e4dd4039..32d47337 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 7afb3bd3..9eec3c0f 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 fddde8cb..4aab63bf 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 51545655..ad4d7ccc 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 03b3d4cd..19cea043 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 cd344f98..b584eb68 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 60c59702..c112f1c3 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 c1225af1..92d3ffec 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 47b381fd..50f106ad 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 729381cc..43621862 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/test/Makefile b/test/Makefile
index 15169937..136b6f68 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/test/run_tests.sh b/test/run_tests.sh
index ced02976..dd80afd9 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.
diff --git a/tools/parallel_http/Makefile b/tools/parallel_http/Makefile
index a57c5d5f..f919b511 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 00abf6cc..55bc9d96 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 8cae3033..bef6d30e 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 8f4eadde..9ea388d5 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 13f026cb..72cf5d37 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 5bdd53f8..d6eb71c3 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
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]