From 8ee75c80eaf53ea0a2737c7948c0cba868860b86 Mon Sep 17 00:00:00 2001 From: Bright Chen Date: Sat, 18 Jan 2025 17:54:14 +0800 Subject: [PATCH] Fix gflag namespace of example and tools --- CMakeLists.txt | 13 +------------ example/BUILD.bazel | 1 - example/asynchronous_echo_c++/CMakeLists.txt | 13 +------------ example/asynchronous_echo_c++/client.cpp | 2 +- example/asynchronous_echo_c++/server.cpp | 2 +- example/auto_concurrency_limiter/CMakeLists.txt | 13 +------------ example/auto_concurrency_limiter/client.cpp | 2 +- example/auto_concurrency_limiter/server.cpp | 2 +- example/backup_request_c++/CMakeLists.txt | 13 +------------ example/backup_request_c++/client.cpp | 2 +- example/backup_request_c++/server.cpp | 2 +- .../baidu_proxy_and_generic_call/CMakeLists.txt | 13 +------------ example/baidu_proxy_and_generic_call/client.cpp | 2 +- example/baidu_proxy_and_generic_call/proxy.cpp | 2 +- example/baidu_proxy_and_generic_call/server.cpp | 2 +- example/bthread_tag_echo_c++/CMakeLists.txt | 13 +------------ example/bthread_tag_echo_c++/client.cpp | 2 +- example/bthread_tag_echo_c++/server.cpp | 4 ++-- example/cancel_c++/CMakeLists.txt | 13 +------------ example/cancel_c++/client.cpp | 2 +- example/cancel_c++/server.cpp | 2 +- example/cascade_echo_c++/CMakeLists.txt | 13 +------------ example/cascade_echo_c++/client.cpp | 4 ++-- example/cascade_echo_c++/server.cpp | 4 ++-- example/coroutine/coroutine_server.cpp | 4 ++-- example/dynamic_partition_echo_c++/CMakeLists.txt | 13 +------------ example/dynamic_partition_echo_c++/client.cpp | 2 +- example/dynamic_partition_echo_c++/server.cpp | 2 +- example/echo_c++/CMakeLists.txt | 13 +------------ example/echo_c++/client.cpp | 2 +- example/echo_c++/server.cpp | 2 +- example/grpc_c++/CMakeLists.txt | 14 +------------- example/grpc_c++/client.cpp | 4 ++-- example/grpc_c++/server.cpp | 2 +- example/http_c++/CMakeLists.txt | 14 +------------- example/http_c++/benchmark_http.cpp | 2 +- example/http_c++/http_client.cpp | 2 +- example/http_c++/http_server.cpp | 2 +- example/memcache_c++/CMakeLists.txt | 13 +------------ example/memcache_c++/client.cpp | 2 +- example/multi_threaded_echo_c++/CMakeLists.txt | 13 +------------ example/multi_threaded_echo_c++/client.cpp | 2 +- example/multi_threaded_echo_c++/server.cpp | 4 ++-- example/multi_threaded_echo_fns_c++/CMakeLists.txt | 13 +------------ example/multi_threaded_echo_fns_c++/client.cpp | 2 +- example/multi_threaded_echo_fns_c++/server.cpp | 2 +- example/nshead_extension_c++/CMakeLists.txt | 13 +------------ example/nshead_extension_c++/client.cpp | 2 +- example/nshead_extension_c++/server.cpp | 2 +- example/nshead_pb_extension_c++/CMakeLists.txt | 13 +------------ example/nshead_pb_extension_c++/client.cpp | 2 +- example/nshead_pb_extension_c++/server.cpp | 2 +- example/parallel_echo_c++/CMakeLists.txt | 13 +------------ example/parallel_echo_c++/client.cpp | 2 +- example/parallel_echo_c++/server.cpp | 2 +- example/partition_echo_c++/CMakeLists.txt | 13 +------------ example/partition_echo_c++/client.cpp | 2 +- example/partition_echo_c++/server.cpp | 2 +- example/rdma_performance/CMakeLists.txt | 12 +----------- example/rdma_performance/client.cpp | 2 +- example/rdma_performance/server.cpp | 2 +- example/redis_c++/CMakeLists.txt | 13 +------------ example/redis_c++/redis_cli.cpp | 2 +- example/redis_c++/redis_press.cpp | 2 +- example/rpcz_echo_c++/CMakeLists.txt | 13 +------------ example/rpcz_echo_c++/client.cpp | 2 +- example/rpcz_echo_c++/server.cpp | 2 +- example/selective_echo_c++/CMakeLists.txt | 13 +------------ example/selective_echo_c++/client.cpp | 2 +- example/selective_echo_c++/server.cpp | 2 +- .../session_data_and_thread_local/CMakeLists.txt | 13 +------------ example/session_data_and_thread_local/client.cpp | 2 +- example/session_data_and_thread_local/server.cpp | 2 +- example/streaming_batch_echo_c++/CMakeLists.txt | 13 +------------ example/streaming_batch_echo_c++/client.cpp | 2 +- example/streaming_batch_echo_c++/server.cpp | 2 +- example/streaming_echo_c++/CMakeLists.txt | 13 +------------ example/streaming_echo_c++/client.cpp | 2 +- example/streaming_echo_c++/server.cpp | 2 +- example/thrift_extension_c++/client2.cpp | 2 +- tools/BUILD | 1 - tools/parallel_http/parallel_http.cpp | 2 +- tools/rpc_press/rpc_press.cpp | 2 +- tools/rpc_replay/rpc_replay.cpp | 2 +- tools/rpc_view/rpc_view.cpp | 10 +++++----- tools/trackme_server/trackme_server.cpp | 2 +- 86 files changed, 94 insertions(+), 383 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 284f27fe10..afc2de4d31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,17 +114,6 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") find_package(GFLAGS REQUIRED) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() - include_directories( ${PROJECT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR} @@ -144,7 +133,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -Wno-deprecated-declarations -Wno-inconsistent-missing-override") endif() -set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} ${DEFINE_CLOCK_GETTIME} -DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DBRPC_WITH_RDMA=${WITH_RDMA_VAL} -DGFLAGS_NS=${GFLAGS_NS} -DBRPC_DEBUG_BTHREAD_SCHE_SAFETY=${WITH_DEBUG_BTHREAD_SCHE_SAFETY_VAL} -DBRPC_DEBUG_LOCK=${WITH_DEBUG_LOCK_VAL}") +set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} ${DEFINE_CLOCK_GETTIME} -DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DBRPC_WITH_RDMA=${WITH_RDMA_VAL} -DBRPC_DEBUG_BTHREAD_SCHE_SAFETY=${WITH_DEBUG_BTHREAD_SCHE_SAFETY_VAL} -DBRPC_DEBUG_LOCK=${WITH_DEBUG_LOCK_VAL}") if(WITH_MESALINK) set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -DUSE_MESALINK") endif() diff --git a/example/BUILD.bazel b/example/BUILD.bazel index afc525a331..b38cd5a156 100644 --- a/example/BUILD.bazel +++ b/example/BUILD.bazel @@ -28,7 +28,6 @@ COPTS = [ "-fPIC", "-Wno-unused-parameter", "-fno-omit-frame-pointer", - "-DGFLAGS_NS=google", ] + select({ "//bazel/config:brpc_with_glog": ["-DBRPC_WITH_GLOG=1"], "//conditions:default": ["-DBRPC_WITH_GLOG=0"], diff --git a/example/asynchronous_echo_c++/CMakeLists.txt b/example/asynchronous_echo_c++/CMakeLists.txt index 2946e29963..37cb5f380c 100644 --- a/example/asynchronous_echo_c++/CMakeLists.txt +++ b/example/asynchronous_echo_c++/CMakeLists.txt @@ -58,16 +58,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -76,8 +66,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") if(CMAKE_VERSION VERSION_LESS "3.1.3") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") diff --git a/example/asynchronous_echo_c++/client.cpp b/example/asynchronous_echo_c++/client.cpp index e77918cbb8..b52297b4b5 100644 --- a/example/asynchronous_echo_c++/client.cpp +++ b/example/asynchronous_echo_c++/client.cpp @@ -51,7 +51,7 @@ void HandleEchoResponse( int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/example/asynchronous_echo_c++/server.cpp b/example/asynchronous_echo_c++/server.cpp index 7aad241f6a..dcce19a80b 100644 --- a/example/asynchronous_echo_c++/server.cpp +++ b/example/asynchronous_echo_c++/server.cpp @@ -87,7 +87,7 @@ class EchoServiceImpl : public example::EchoService { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // Generally you only need one Server. brpc::Server server; diff --git a/example/auto_concurrency_limiter/CMakeLists.txt b/example/auto_concurrency_limiter/CMakeLists.txt index 4d4802c8d4..a496dd572b 100644 --- a/example/auto_concurrency_limiter/CMakeLists.txt +++ b/example/auto_concurrency_limiter/CMakeLists.txt @@ -51,16 +51,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -69,8 +59,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") if(CMAKE_VERSION VERSION_LESS "3.1.3") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") diff --git a/example/auto_concurrency_limiter/client.cpp b/example/auto_concurrency_limiter/client.cpp index 13377f04ba..d33325ddf9 100644 --- a/example/auto_concurrency_limiter/client.cpp +++ b/example/auto_concurrency_limiter/client.cpp @@ -215,7 +215,7 @@ void RunCase(test::ControlService_Stub &cntl_stub, int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); Expose(); brpc::Channel channel; diff --git a/example/auto_concurrency_limiter/server.cpp b/example/auto_concurrency_limiter/server.cpp index 5d7314548d..61f826fab7 100644 --- a/example/auto_concurrency_limiter/server.cpp +++ b/example/auto_concurrency_limiter/server.cpp @@ -271,7 +271,7 @@ class ControlServiceImpl : public test::ControlService { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); bthread::FLAGS_bthread_concurrency= FLAGS_server_bthread_concurrency; brpc::Server server; diff --git a/example/backup_request_c++/CMakeLists.txt b/example/backup_request_c++/CMakeLists.txt index 5b91114b50..3c8d34a0a8 100644 --- a/example/backup_request_c++/CMakeLists.txt +++ b/example/backup_request_c++/CMakeLists.txt @@ -58,16 +58,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -76,8 +66,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") if(CMAKE_VERSION VERSION_LESS "3.1.3") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") diff --git a/example/backup_request_c++/client.cpp b/example/backup_request_c++/client.cpp index dfbb5856dc..07005e3770 100644 --- a/example/backup_request_c++/client.cpp +++ b/example/backup_request_c++/client.cpp @@ -35,7 +35,7 @@ DEFINE_int32(backup_request_ms, 2, "Timeout for sending backup request"); int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/example/backup_request_c++/server.cpp b/example/backup_request_c++/server.cpp index 198120f19b..9bc8a578b2 100644 --- a/example/backup_request_c++/server.cpp +++ b/example/backup_request_c++/server.cpp @@ -78,7 +78,7 @@ class SleepyEchoService : public EchoService int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // Generally you only need one Server. brpc::Server server; diff --git a/example/baidu_proxy_and_generic_call/CMakeLists.txt b/example/baidu_proxy_and_generic_call/CMakeLists.txt index 88c691dff5..7e34d0a83d 100644 --- a/example/baidu_proxy_and_generic_call/CMakeLists.txt +++ b/example/baidu_proxy_and_generic_call/CMakeLists.txt @@ -51,16 +51,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -69,8 +59,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") if(CMAKE_VERSION VERSION_LESS "3.1.3") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") diff --git a/example/baidu_proxy_and_generic_call/client.cpp b/example/baidu_proxy_and_generic_call/client.cpp index d8040740a8..b8fd3101bb 100644 --- a/example/baidu_proxy_and_generic_call/client.cpp +++ b/example/baidu_proxy_and_generic_call/client.cpp @@ -34,7 +34,7 @@ DEFINE_int32(interval_ms, 1000, "Milliseconds between consecutive requests"); int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/example/baidu_proxy_and_generic_call/proxy.cpp b/example/baidu_proxy_and_generic_call/proxy.cpp index 81e1176ba2..a7f24fbcc5 100644 --- a/example/baidu_proxy_and_generic_call/proxy.cpp +++ b/example/baidu_proxy_and_generic_call/proxy.cpp @@ -111,7 +111,7 @@ class BaiduMasterServiceImpl : public brpc::BaiduMasterService { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // Generally you only need one Server. brpc::Server server; diff --git a/example/baidu_proxy_and_generic_call/server.cpp b/example/baidu_proxy_and_generic_call/server.cpp index b3f161736e..64d4936696 100644 --- a/example/baidu_proxy_and_generic_call/server.cpp +++ b/example/baidu_proxy_and_generic_call/server.cpp @@ -78,7 +78,7 @@ class EchoServiceImpl : public EchoService { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // Generally you only need one Server. brpc::Server server; diff --git a/example/bthread_tag_echo_c++/CMakeLists.txt b/example/bthread_tag_echo_c++/CMakeLists.txt index 3dd7a24522..d91aa6ca23 100644 --- a/example/bthread_tag_echo_c++/CMakeLists.txt +++ b/example/bthread_tag_echo_c++/CMakeLists.txt @@ -62,16 +62,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -80,8 +70,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBRPC_ENABLE_CPU_PROFILER") if(CMAKE_VERSION VERSION_LESS "3.1.3") diff --git a/example/bthread_tag_echo_c++/client.cpp b/example/bthread_tag_echo_c++/client.cpp index 2af1a8a66f..2b5a9e0bb5 100644 --- a/example/bthread_tag_echo_c++/client.cpp +++ b/example/bthread_tag_echo_c++/client.cpp @@ -84,7 +84,7 @@ static void* sender(void* arg) { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/example/bthread_tag_echo_c++/server.cpp b/example/bthread_tag_echo_c++/server.cpp index ed4ba4d6c3..0d14bd1dcf 100644 --- a/example/bthread_tag_echo_c++/server.cpp +++ b/example/bthread_tag_echo_c++/server.cpp @@ -74,10 +74,10 @@ static void* my_background_task(void*) { int main(int argc, char* argv[]) { std::string help_str = "dummy help infomation"; - GFLAGS_NS::SetUsageMessage(help_str); + GFLAGS_NAMESPACE::SetUsageMessage(help_str); // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); if (FLAGS_h) { fprintf(stderr, "%s\n%s\n%s", help_str.c_str(), help_str.c_str(), help_str.c_str()); diff --git a/example/cancel_c++/CMakeLists.txt b/example/cancel_c++/CMakeLists.txt index d6246c67fe..b8d64ddad5 100644 --- a/example/cancel_c++/CMakeLists.txt +++ b/example/cancel_c++/CMakeLists.txt @@ -58,16 +58,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -76,8 +66,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") if(CMAKE_VERSION VERSION_LESS "3.1.3") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") diff --git a/example/cancel_c++/client.cpp b/example/cancel_c++/client.cpp index b1ba1aeb6a..dd23b679e9 100644 --- a/example/cancel_c++/client.cpp +++ b/example/cancel_c++/client.cpp @@ -45,7 +45,7 @@ class CancelRPC : public google::protobuf::Closure { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/example/cancel_c++/server.cpp b/example/cancel_c++/server.cpp index 5fa5e17acf..b85ec09a97 100644 --- a/example/cancel_c++/server.cpp +++ b/example/cancel_c++/server.cpp @@ -73,7 +73,7 @@ class EchoServiceImpl : public EchoService { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // Generally you only need one Server. brpc::Server server; diff --git a/example/cascade_echo_c++/CMakeLists.txt b/example/cascade_echo_c++/CMakeLists.txt index bfb11025fd..453067b105 100644 --- a/example/cascade_echo_c++/CMakeLists.txt +++ b/example/cascade_echo_c++/CMakeLists.txt @@ -57,16 +57,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -75,8 +65,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") if(CMAKE_VERSION VERSION_LESS "3.1.3") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") diff --git a/example/cascade_echo_c++/client.cpp b/example/cascade_echo_c++/client.cpp index cb545b6e32..25a1b52fa7 100644 --- a/example/cascade_echo_c++/client.cpp +++ b/example/cascade_echo_c++/client.cpp @@ -87,8 +87,8 @@ void* sender(void* arg) { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::SetUsageMessage("Send EchoRequest to server every second"); - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::SetUsageMessage("Send EchoRequest to server every second"); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/example/cascade_echo_c++/server.cpp b/example/cascade_echo_c++/server.cpp index de19e660fd..c329073c56 100644 --- a/example/cascade_echo_c++/server.cpp +++ b/example/cascade_echo_c++/server.cpp @@ -85,8 +85,8 @@ class CascadeEchoService : public EchoService { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::SetUsageMessage("A server that may call itself"); - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::SetUsageMessage("A server that may call itself"); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/example/coroutine/coroutine_server.cpp b/example/coroutine/coroutine_server.cpp index 9df50b04b6..51ef7fcba0 100644 --- a/example/coroutine/coroutine_server.cpp +++ b/example/coroutine/coroutine_server.cpp @@ -111,9 +111,9 @@ int main(int argc, char* argv[]) { bthread_setconcurrency(BTHREAD_MIN_CONCURRENCY); // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); if (FLAGS_enable_coroutine) { - GFLAGS_NS::SetCommandLineOption("usercode_in_coroutine", "true"); + GFLAGS_NAMESPACE::SetCommandLineOption("usercode_in_coroutine", "true"); } // Generally you only need one Server. diff --git a/example/dynamic_partition_echo_c++/CMakeLists.txt b/example/dynamic_partition_echo_c++/CMakeLists.txt index a5724d2ce8..cf79c8cb09 100644 --- a/example/dynamic_partition_echo_c++/CMakeLists.txt +++ b/example/dynamic_partition_echo_c++/CMakeLists.txt @@ -62,16 +62,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -80,8 +70,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBRPC_ENABLE_CPU_PROFILER") if(CMAKE_VERSION VERSION_LESS "3.1.3") diff --git a/example/dynamic_partition_echo_c++/client.cpp b/example/dynamic_partition_echo_c++/client.cpp index 6c83b086ef..fd25514ccd 100644 --- a/example/dynamic_partition_echo_c++/client.cpp +++ b/example/dynamic_partition_echo_c++/client.cpp @@ -122,7 +122,7 @@ class MyPartitionParser : public brpc::PartitionParser { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/example/dynamic_partition_echo_c++/server.cpp b/example/dynamic_partition_echo_c++/server.cpp index 0047e01c6a..e86affaa91 100644 --- a/example/dynamic_partition_echo_c++/server.cpp +++ b/example/dynamic_partition_echo_c++/server.cpp @@ -94,7 +94,7 @@ class EchoServiceImpl : public example::EchoService { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); if (FLAGS_server_num <= 0) { LOG(ERROR) << "server_num must be positive"; diff --git a/example/echo_c++/CMakeLists.txt b/example/echo_c++/CMakeLists.txt index 54fdd5707a..02d2477914 100644 --- a/example/echo_c++/CMakeLists.txt +++ b/example/echo_c++/CMakeLists.txt @@ -58,16 +58,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -76,8 +66,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") if(CMAKE_VERSION VERSION_LESS "3.1.3") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") diff --git a/example/echo_c++/client.cpp b/example/echo_c++/client.cpp index 337aa6e90d..3cc83f7203 100644 --- a/example/echo_c++/client.cpp +++ b/example/echo_c++/client.cpp @@ -34,7 +34,7 @@ DEFINE_int32(interval_ms, 1000, "Milliseconds between consecutive requests"); int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/example/echo_c++/server.cpp b/example/echo_c++/server.cpp index d1f0605178..cc0050aea5 100644 --- a/example/echo_c++/server.cpp +++ b/example/echo_c++/server.cpp @@ -94,7 +94,7 @@ class EchoServiceImpl : public EchoService { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // Generally you only need one Server. brpc::Server server; diff --git a/example/grpc_c++/CMakeLists.txt b/example/grpc_c++/CMakeLists.txt index 6250d2aba9..3d947688d2 100644 --- a/example/grpc_c++/CMakeLists.txt +++ b/example/grpc_c++/CMakeLists.txt @@ -55,17 +55,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -74,8 +63,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBRPC_ENABLE_CPU_PROFILER") if(CMAKE_VERSION VERSION_LESS "3.1.3") diff --git a/example/grpc_c++/client.cpp b/example/grpc_c++/client.cpp index 0ce4b90b7c..4318ed885e 100644 --- a/example/grpc_c++/client.cpp +++ b/example/grpc_c++/client.cpp @@ -33,9 +33,9 @@ DEFINE_bool(gzip, false, "compress body using gzip"); int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); if (FLAGS_gzip) { - GFLAGS_NS::SetCommandLineOption("http_body_compress_threshold", 0); + GFLAGS_NAMESPACE::SetCommandLineOption("http_body_compress_threshold", 0); } // A Channel represents a communication line to a Server. Notice that diff --git a/example/grpc_c++/server.cpp b/example/grpc_c++/server.cpp index 50e21dba76..7658556e65 100644 --- a/example/grpc_c++/server.cpp +++ b/example/grpc_c++/server.cpp @@ -47,7 +47,7 @@ class GreeterImpl : public helloworld::Greeter { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // Generally you only need one Server. brpc::Server server; diff --git a/example/http_c++/CMakeLists.txt b/example/http_c++/CMakeLists.txt index c5e7d40a5a..66c4deec97 100644 --- a/example/http_c++/CMakeLists.txt +++ b/example/http_c++/CMakeLists.txt @@ -62,17 +62,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -81,8 +70,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBRPC_ENABLE_CPU_PROFILER") if(CMAKE_VERSION VERSION_LESS "3.1.3") diff --git a/example/http_c++/benchmark_http.cpp b/example/http_c++/benchmark_http.cpp index 3ddcfe14bb..7fc879d190 100644 --- a/example/http_c++/benchmark_http.cpp +++ b/example/http_c++/benchmark_http.cpp @@ -74,7 +74,7 @@ static void* sender(void* arg) { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/example/http_c++/http_client.cpp b/example/http_c++/http_client.cpp index d9984c886f..23222dee9b 100644 --- a/example/http_c++/http_client.cpp +++ b/example/http_c++/http_client.cpp @@ -38,7 +38,7 @@ DECLARE_bool(http_verbose); int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); if (argc != 2) { LOG(ERROR) << "Usage: ./http_client \"http(s)://www.foo.com\""; diff --git a/example/http_c++/http_server.cpp b/example/http_c++/http_server.cpp index 3a806c43ea..05c9a0ee4c 100644 --- a/example/http_c++/http_server.cpp +++ b/example/http_c++/http_server.cpp @@ -225,7 +225,7 @@ class HttpSSEServiceImpl : public HttpSSEService { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // Generally you only need one Server. brpc::Server server; diff --git a/example/memcache_c++/CMakeLists.txt b/example/memcache_c++/CMakeLists.txt index 7236f01c43..e3e70f96b7 100644 --- a/example/memcache_c++/CMakeLists.txt +++ b/example/memcache_c++/CMakeLists.txt @@ -58,16 +58,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -76,8 +66,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") if(CMAKE_VERSION VERSION_LESS "3.1.3") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") diff --git a/example/memcache_c++/client.cpp b/example/memcache_c++/client.cpp index 01b03651d3..5f32198867 100644 --- a/example/memcache_c++/client.cpp +++ b/example/memcache_c++/client.cpp @@ -101,7 +101,7 @@ static void* sender(void* arg) { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); if (FLAGS_exptime < 0) { FLAGS_exptime = 0; } diff --git a/example/multi_threaded_echo_c++/CMakeLists.txt b/example/multi_threaded_echo_c++/CMakeLists.txt index 896483afc5..d57886b6f1 100644 --- a/example/multi_threaded_echo_c++/CMakeLists.txt +++ b/example/multi_threaded_echo_c++/CMakeLists.txt @@ -62,16 +62,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -80,8 +70,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBRPC_ENABLE_CPU_PROFILER") if(CMAKE_VERSION VERSION_LESS "3.1.3") diff --git a/example/multi_threaded_echo_c++/client.cpp b/example/multi_threaded_echo_c++/client.cpp index 0b7ea28ce1..fa9768c726 100644 --- a/example/multi_threaded_echo_c++/client.cpp +++ b/example/multi_threaded_echo_c++/client.cpp @@ -85,7 +85,7 @@ static void* sender(void* arg) { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/example/multi_threaded_echo_c++/server.cpp b/example/multi_threaded_echo_c++/server.cpp index b747487f2a..54ca096016 100644 --- a/example/multi_threaded_echo_c++/server.cpp +++ b/example/multi_threaded_echo_c++/server.cpp @@ -56,10 +56,10 @@ DEFINE_bool(h, false, "print help information"); int main(int argc, char* argv[]) { std::string help_str = "dummy help infomation"; - GFLAGS_NS::SetUsageMessage(help_str); + GFLAGS_NAMESPACE::SetUsageMessage(help_str); // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); if (FLAGS_h) { fprintf(stderr, "%s\n%s\n%s", help_str.c_str(), help_str.c_str(), help_str.c_str()); diff --git a/example/multi_threaded_echo_fns_c++/CMakeLists.txt b/example/multi_threaded_echo_fns_c++/CMakeLists.txt index c934f7aa88..0805485d95 100644 --- a/example/multi_threaded_echo_fns_c++/CMakeLists.txt +++ b/example/multi_threaded_echo_fns_c++/CMakeLists.txt @@ -62,16 +62,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -80,8 +70,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBRPC_ENABLE_CPU_PROFILER") if(CMAKE_VERSION VERSION_LESS "3.1.3") diff --git a/example/multi_threaded_echo_fns_c++/client.cpp b/example/multi_threaded_echo_fns_c++/client.cpp index cec7f0d463..895b3e5523 100644 --- a/example/multi_threaded_echo_fns_c++/client.cpp +++ b/example/multi_threaded_echo_fns_c++/client.cpp @@ -91,7 +91,7 @@ static void* sender(void* arg) { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/example/multi_threaded_echo_fns_c++/server.cpp b/example/multi_threaded_echo_fns_c++/server.cpp index c9576e68ca..2e837bbf46 100644 --- a/example/multi_threaded_echo_fns_c++/server.cpp +++ b/example/multi_threaded_echo_fns_c++/server.cpp @@ -97,7 +97,7 @@ class EchoServiceImpl : public example::EchoService { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); if (FLAGS_server_num <= 0) { LOG(ERROR) << "server_num must be positive"; diff --git a/example/nshead_extension_c++/CMakeLists.txt b/example/nshead_extension_c++/CMakeLists.txt index 5aa496ac63..244bca6876 100644 --- a/example/nshead_extension_c++/CMakeLists.txt +++ b/example/nshead_extension_c++/CMakeLists.txt @@ -58,16 +58,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -76,8 +66,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") if(CMAKE_VERSION VERSION_LESS "3.1.3") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") diff --git a/example/nshead_extension_c++/client.cpp b/example/nshead_extension_c++/client.cpp index b5263d5286..bfc48b6f7e 100644 --- a/example/nshead_extension_c++/client.cpp +++ b/example/nshead_extension_c++/client.cpp @@ -35,7 +35,7 @@ DEFINE_int32(max_retry, 3, "Max retries(not including the first RPC)"); int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/example/nshead_extension_c++/server.cpp b/example/nshead_extension_c++/server.cpp index b59c2c0442..1cbd57289c 100644 --- a/example/nshead_extension_c++/server.cpp +++ b/example/nshead_extension_c++/server.cpp @@ -51,7 +51,7 @@ class MyNsheadProtocol : public brpc::NsheadService { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); brpc::Server server; brpc::ServerOptions options; diff --git a/example/nshead_pb_extension_c++/CMakeLists.txt b/example/nshead_pb_extension_c++/CMakeLists.txt index 0516a9ebe6..b630294965 100644 --- a/example/nshead_pb_extension_c++/CMakeLists.txt +++ b/example/nshead_pb_extension_c++/CMakeLists.txt @@ -58,16 +58,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -76,8 +66,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") if(CMAKE_VERSION VERSION_LESS "3.1.3") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") diff --git a/example/nshead_pb_extension_c++/client.cpp b/example/nshead_pb_extension_c++/client.cpp index b5263d5286..bfc48b6f7e 100644 --- a/example/nshead_pb_extension_c++/client.cpp +++ b/example/nshead_pb_extension_c++/client.cpp @@ -35,7 +35,7 @@ DEFINE_int32(max_retry, 3, "Max retries(not including the first RPC)"); int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/example/nshead_pb_extension_c++/server.cpp b/example/nshead_pb_extension_c++/server.cpp index 4f67ecd8a6..d87c9a2743 100644 --- a/example/nshead_pb_extension_c++/server.cpp +++ b/example/nshead_pb_extension_c++/server.cpp @@ -97,7 +97,7 @@ class MyNsheadProtocol : public brpc::NsheadPbServiceAdaptor { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); brpc::Server server; example::EchoServiceImpl echo_service_impl; diff --git a/example/parallel_echo_c++/CMakeLists.txt b/example/parallel_echo_c++/CMakeLists.txt index b70d7571be..7cdb412ae5 100644 --- a/example/parallel_echo_c++/CMakeLists.txt +++ b/example/parallel_echo_c++/CMakeLists.txt @@ -62,16 +62,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -80,8 +70,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBRPC_ENABLE_CPU_PROFILER") if(CMAKE_VERSION VERSION_LESS "3.1.3") diff --git a/example/parallel_echo_c++/client.cpp b/example/parallel_echo_c++/client.cpp index 933e2b655a..54ce661dd8 100644 --- a/example/parallel_echo_c++/client.cpp +++ b/example/parallel_echo_c++/client.cpp @@ -94,7 +94,7 @@ static void* sender(void* arg) { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/example/parallel_echo_c++/server.cpp b/example/parallel_echo_c++/server.cpp index 364b29ed61..c57e0011ce 100644 --- a/example/parallel_echo_c++/server.cpp +++ b/example/parallel_echo_c++/server.cpp @@ -52,7 +52,7 @@ class EchoServiceImpl : public example::EchoService { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // Generally you only need one Server. brpc::Server server; diff --git a/example/partition_echo_c++/CMakeLists.txt b/example/partition_echo_c++/CMakeLists.txt index 2e09c388ca..4d845c724e 100644 --- a/example/partition_echo_c++/CMakeLists.txt +++ b/example/partition_echo_c++/CMakeLists.txt @@ -62,16 +62,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -80,8 +70,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBRPC_ENABLE_CPU_PROFILER") if(CMAKE_VERSION VERSION_LESS "3.1.3") diff --git a/example/partition_echo_c++/client.cpp b/example/partition_echo_c++/client.cpp index 83fa001e7a..b60a63d032 100644 --- a/example/partition_echo_c++/client.cpp +++ b/example/partition_echo_c++/client.cpp @@ -123,7 +123,7 @@ class MyPartitionParser : public brpc::PartitionParser { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/example/partition_echo_c++/server.cpp b/example/partition_echo_c++/server.cpp index 4c2053f832..aa65d41b7a 100644 --- a/example/partition_echo_c++/server.cpp +++ b/example/partition_echo_c++/server.cpp @@ -94,7 +94,7 @@ class EchoServiceImpl : public example::EchoService { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); if (FLAGS_server_num <= 0) { LOG(ERROR) << "server_num must be positive"; diff --git a/example/rdma_performance/CMakeLists.txt b/example/rdma_performance/CMakeLists.txt index de730720be..2812b0b03b 100644 --- a/example/rdma_performance/CMakeLists.txt +++ b/example/rdma_performance/CMakeLists.txt @@ -58,16 +58,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -76,7 +66,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS} -DBRPC_WITH_RDMA=1") +set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DBRPC_WITH_RDMA=1") set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") if(CMAKE_VERSION VERSION_LESS "3.1.3") diff --git a/example/rdma_performance/client.cpp b/example/rdma_performance/client.cpp index e6013b55ca..57d0c06c93 100644 --- a/example/rdma_performance/client.cpp +++ b/example/rdma_performance/client.cpp @@ -272,7 +272,7 @@ void Test(int thread_num, int attachment_size) { } int main(int argc, char* argv[]) { - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // Initialize RDMA environment in advance. if (FLAGS_use_rdma) { diff --git a/example/rdma_performance/server.cpp b/example/rdma_performance/server.cpp index 9920cbb24d..d3d00057f4 100644 --- a/example/rdma_performance/server.cpp +++ b/example/rdma_performance/server.cpp @@ -63,7 +63,7 @@ class PerfTestServiceImpl : public PerfTestService { } int main(int argc, char* argv[]) { - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); brpc::Server server; test::PerfTestServiceImpl perf_test_service_impl; diff --git a/example/redis_c++/CMakeLists.txt b/example/redis_c++/CMakeLists.txt index fc4745c872..e29dcbeb45 100644 --- a/example/redis_c++/CMakeLists.txt +++ b/example/redis_c++/CMakeLists.txt @@ -67,16 +67,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -85,8 +75,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") if(CMAKE_VERSION VERSION_LESS "3.1.3") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") diff --git a/example/redis_c++/redis_cli.cpp b/example/redis_c++/redis_cli.cpp index d4cbf63a95..02124aa34e 100644 --- a/example/redis_c++/redis_cli.cpp +++ b/example/redis_c++/redis_cli.cpp @@ -77,7 +77,7 @@ static int cli_getc(FILE *stream) { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/example/redis_c++/redis_press.cpp b/example/redis_c++/redis_press.cpp index 7c4e5a5c9b..165b8bf1f9 100644 --- a/example/redis_c++/redis_press.cpp +++ b/example/redis_c++/redis_press.cpp @@ -97,7 +97,7 @@ static void* sender(void* void_args) { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/example/rpcz_echo_c++/CMakeLists.txt b/example/rpcz_echo_c++/CMakeLists.txt index e377acc1d1..d1f1d924be 100644 --- a/example/rpcz_echo_c++/CMakeLists.txt +++ b/example/rpcz_echo_c++/CMakeLists.txt @@ -58,16 +58,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -76,8 +66,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") if(CMAKE_VERSION VERSION_LESS "3.1.3") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") diff --git a/example/rpcz_echo_c++/client.cpp b/example/rpcz_echo_c++/client.cpp index ad80de0f50..8cb86866fe 100644 --- a/example/rpcz_echo_c++/client.cpp +++ b/example/rpcz_echo_c++/client.cpp @@ -37,7 +37,7 @@ DEFINE_int32(interval_ms, 1000, "Milliseconds between consecutive requests"); int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // brpc::FLAGS_enable_rpcz = true; // A Channel represents a communication line to a Server. Notice that diff --git a/example/rpcz_echo_c++/server.cpp b/example/rpcz_echo_c++/server.cpp index 0f5f7f26f5..8503e99583 100644 --- a/example/rpcz_echo_c++/server.cpp +++ b/example/rpcz_echo_c++/server.cpp @@ -132,7 +132,7 @@ class EchoServiceImpl : public EchoService { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // Generally you only need one Server. brpc::Server server; diff --git a/example/selective_echo_c++/CMakeLists.txt b/example/selective_echo_c++/CMakeLists.txt index 4931121821..809bd22a59 100644 --- a/example/selective_echo_c++/CMakeLists.txt +++ b/example/selective_echo_c++/CMakeLists.txt @@ -62,16 +62,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -80,8 +70,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBRPC_ENABLE_CPU_PROFILER") if(CMAKE_VERSION VERSION_LESS "3.1.3") diff --git a/example/selective_echo_c++/client.cpp b/example/selective_echo_c++/client.cpp index 99f9f0fd52..6f0c413a2b 100644 --- a/example/selective_echo_c++/client.cpp +++ b/example/selective_echo_c++/client.cpp @@ -86,7 +86,7 @@ static void* sender(void* arg) { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/example/selective_echo_c++/server.cpp b/example/selective_echo_c++/server.cpp index cd075ac7a8..0705a32890 100644 --- a/example/selective_echo_c++/server.cpp +++ b/example/selective_echo_c++/server.cpp @@ -93,7 +93,7 @@ class EchoServiceImpl : public example::EchoService { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); if (FLAGS_server_num <= 0) { LOG(ERROR) << "server_num must be positive"; diff --git a/example/session_data_and_thread_local/CMakeLists.txt b/example/session_data_and_thread_local/CMakeLists.txt index ea1c838174..27f60e58ac 100644 --- a/example/session_data_and_thread_local/CMakeLists.txt +++ b/example/session_data_and_thread_local/CMakeLists.txt @@ -62,16 +62,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -80,8 +70,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBRPC_ENABLE_CPU_PROFILER") if(CMAKE_VERSION VERSION_LESS "3.1.3") diff --git a/example/session_data_and_thread_local/client.cpp b/example/session_data_and_thread_local/client.cpp index f0cc9892a4..f075e70451 100644 --- a/example/session_data_and_thread_local/client.cpp +++ b/example/session_data_and_thread_local/client.cpp @@ -85,7 +85,7 @@ static void* sender(void* arg) { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/example/session_data_and_thread_local/server.cpp b/example/session_data_and_thread_local/server.cpp index 5d5efc1c71..c196c33edc 100644 --- a/example/session_data_and_thread_local/server.cpp +++ b/example/session_data_and_thread_local/server.cpp @@ -211,7 +211,7 @@ void AsyncJob::run() { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // The factory to create MySessionLocalData. Must be valid when server is running. MySessionLocalDataFactory session_local_data_factory; diff --git a/example/streaming_batch_echo_c++/CMakeLists.txt b/example/streaming_batch_echo_c++/CMakeLists.txt index 1d152ef9a0..c434067257 100644 --- a/example/streaming_batch_echo_c++/CMakeLists.txt +++ b/example/streaming_batch_echo_c++/CMakeLists.txt @@ -58,16 +58,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -76,8 +66,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") if(CMAKE_VERSION VERSION_LESS "3.1.3") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") diff --git a/example/streaming_batch_echo_c++/client.cpp b/example/streaming_batch_echo_c++/client.cpp index ea58a191b8..23f2b06d3a 100644 --- a/example/streaming_batch_echo_c++/client.cpp +++ b/example/streaming_batch_echo_c++/client.cpp @@ -55,7 +55,7 @@ class StreamClientReceiver : public brpc::StreamInputHandler { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/example/streaming_batch_echo_c++/server.cpp b/example/streaming_batch_echo_c++/server.cpp index 3690344a8f..88ea8981de 100644 --- a/example/streaming_batch_echo_c++/server.cpp +++ b/example/streaming_batch_echo_c++/server.cpp @@ -91,7 +91,7 @@ class StreamingBatchEchoService : public example::EchoService { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // Generally you only need one Server. brpc::Server server; diff --git a/example/streaming_echo_c++/CMakeLists.txt b/example/streaming_echo_c++/CMakeLists.txt index ebefaf4f06..571991e0b4 100644 --- a/example/streaming_echo_c++/CMakeLists.txt +++ b/example/streaming_echo_c++/CMakeLists.txt @@ -58,16 +58,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY)) endif() include_directories(${GFLAGS_INCLUDE_PATH}) -execute_process( - COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS -) -if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE") - execute_process( - COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'" - OUTPUT_VARIABLE GFLAGS_NS - ) -endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) @@ -76,8 +66,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() endif() -set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") +set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer") if(CMAKE_VERSION VERSION_LESS "3.1.3") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") diff --git a/example/streaming_echo_c++/client.cpp b/example/streaming_echo_c++/client.cpp index d593625138..619f579a61 100644 --- a/example/streaming_echo_c++/client.cpp +++ b/example/streaming_echo_c++/client.cpp @@ -31,7 +31,7 @@ DEFINE_int32(max_retry, 3, "Max retries(not including the first RPC)"); int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/example/streaming_echo_c++/server.cpp b/example/streaming_echo_c++/server.cpp index 072105c70a..808d88d03b 100644 --- a/example/streaming_echo_c++/server.cpp +++ b/example/streaming_echo_c++/server.cpp @@ -82,7 +82,7 @@ class StreamingEchoService : public example::EchoService { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // Generally you only need one Server. brpc::Server server; diff --git a/example/thrift_extension_c++/client2.cpp b/example/thrift_extension_c++/client2.cpp index 276dbac065..c6caa0a890 100644 --- a/example/thrift_extension_c++/client2.cpp +++ b/example/thrift_extension_c++/client2.cpp @@ -79,7 +79,7 @@ static void* sender(void* arg) { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program. diff --git a/tools/BUILD b/tools/BUILD index a836cb0449..3abad2412c 100644 --- a/tools/BUILD +++ b/tools/BUILD @@ -25,7 +25,6 @@ COPTS = [ "-fPIC", "-Wno-unused-parameter", "-fno-omit-frame-pointer", - "-DGFLAGS_NS=google", ] + select({ "//bazel/config:brpc_with_glog": ["-DBRPC_WITH_GLOG=1"], "//conditions:default": ["-DBRPC_WITH_GLOG=0"], diff --git a/tools/parallel_http/parallel_http.cpp b/tools/parallel_http/parallel_http.cpp index 6b863e0b63..24ae855cde 100644 --- a/tools/parallel_http/parallel_http.cpp +++ b/tools/parallel_http/parallel_http.cpp @@ -99,7 +99,7 @@ void* access_thread(void* void_args) { int main(int argc, char** argv) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // if (FLAGS_path.empty() || FLAGS_path[0] != '/') { // FLAGS_path = "/" + FLAGS_path; diff --git a/tools/rpc_press/rpc_press.cpp b/tools/rpc_press/rpc_press.cpp index 997a9fb03c..cb69ccfc16 100644 --- a/tools/rpc_press/rpc_press.cpp +++ b/tools/rpc_press/rpc_press.cpp @@ -97,7 +97,7 @@ bool set_press_options(pbrpcframework::PressOptions* options){ int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); // set global log option if (FLAGS_dummy_port >= 0) { diff --git a/tools/rpc_replay/rpc_replay.cpp b/tools/rpc_replay/rpc_replay.cpp index 2065c238e5..c3cd7c4c3a 100644 --- a/tools/rpc_replay/rpc_replay.cpp +++ b/tools/rpc_replay/rpc_replay.cpp @@ -217,7 +217,7 @@ static void* replay_thread(void* arg) { int main(int argc, char* argv[]) { // Parse gflags. We recommend you to use gflags as well. - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); if (FLAGS_dir.empty() || !butil::DirectoryExists(butil::FilePath(FLAGS_dir))) { diff --git a/tools/rpc_view/rpc_view.cpp b/tools/rpc_view/rpc_view.cpp index 51de9150da..cdfb523d14 100644 --- a/tools/rpc_view/rpc_view.cpp +++ b/tools/rpc_view/rpc_view.cpp @@ -82,13 +82,13 @@ class ViewServiceImpl : public ViewService { const std::string* newtarget = server_cntl->http_request().uri().GetQuery("changetarget"); if (newtarget) { - if (GFLAGS_NS::SetCommandLineOption("target", newtarget->c_str()).empty()) { + if (GFLAGS_NAMESPACE::SetCommandLineOption("target", newtarget->c_str()).empty()) { server_cntl->SetFailed("Fail to change value of -target"); return; } target = *newtarget; } else { - if (!GFLAGS_NS::GetCommandLineOption("target", &target)) { + if (!GFLAGS_NAMESPACE::GetCommandLineOption("target", &target)) { server_cntl->SetFailed("Fail to get value of -target"); return; } @@ -153,15 +153,15 @@ class ViewServiceImpl : public ViewService { }; int main(int argc, char* argv[]) { - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); if (FLAGS_target.empty() && (argc != 2 || - GFLAGS_NS::SetCommandLineOption("target", argv[1]).empty())) { + GFLAGS_NAMESPACE::SetCommandLineOption("target", argv[1]).empty())) { LOG(ERROR) << "Usage: ./rpc_view :"; return -1; } // This keeps ad-hoc creation of channels reuse previous connections. - GFLAGS_NS::SetCommandLineOption("defer_close_second", "10"); + GFLAGS_NAMESPACE::SetCommandLineOption("defer_close_second", "10"); brpc::Server server; server.set_version("rpc_view_server"); diff --git a/tools/trackme_server/trackme_server.cpp b/tools/trackme_server/trackme_server.cpp index 541f544a98..76e09da9ea 100644 --- a/tools/trackme_server/trackme_server.cpp +++ b/tools/trackme_server/trackme_server.cpp @@ -88,7 +88,7 @@ class TrackMeServiceImpl : public brpc::TrackMeService { }; int main(int argc, char* argv[]) { - GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); brpc::Server server; server.set_version("trackme_server");