Skip to content

Commit 0608aa1

Browse files
authored
Fix gflag namespace of example and tools (#2879)
1 parent c93d0e0 commit 0608aa1

File tree

86 files changed

+94
-383
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+94
-383
lines changed

CMakeLists.txt

+1-12
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,6 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
114114

115115
find_package(GFLAGS REQUIRED)
116116

117-
execute_process(
118-
COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'"
119-
OUTPUT_VARIABLE GFLAGS_NS
120-
)
121-
if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE")
122-
execute_process(
123-
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'"
124-
OUTPUT_VARIABLE GFLAGS_NS
125-
)
126-
endif()
127-
128117
include_directories(
129118
${PROJECT_SOURCE_DIR}/src
130119
${CMAKE_CURRENT_BINARY_DIR}
@@ -144,7 +133,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
144133
set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -Wno-deprecated-declarations -Wno-inconsistent-missing-override")
145134
endif()
146135

147-
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}")
136+
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}")
148137
if(WITH_MESALINK)
149138
set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -DUSE_MESALINK")
150139
endif()

example/BUILD.bazel

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ COPTS = [
2828
"-fPIC",
2929
"-Wno-unused-parameter",
3030
"-fno-omit-frame-pointer",
31-
"-DGFLAGS_NS=google",
3231
] + select({
3332
"//bazel/config:brpc_with_glog": ["-DBRPC_WITH_GLOG=1"],
3433
"//conditions:default": ["-DBRPC_WITH_GLOG=0"],

example/asynchronous_echo_c++/CMakeLists.txt

+1-12
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY))
5858
endif()
5959
include_directories(${GFLAGS_INCLUDE_PATH})
6060

61-
execute_process(
62-
COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'"
63-
OUTPUT_VARIABLE GFLAGS_NS
64-
)
65-
if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE")
66-
execute_process(
67-
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'"
68-
OUTPUT_VARIABLE GFLAGS_NS
69-
)
70-
endif()
7161
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
7262
include(CheckFunctionExists)
7363
CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME)
@@ -76,8 +66,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
7666
endif()
7767
endif()
7868

79-
set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}")
80-
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
69+
set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
8170

8271
if(CMAKE_VERSION VERSION_LESS "3.1.3")
8372
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")

example/asynchronous_echo_c++/client.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void HandleEchoResponse(
5151

5252
int main(int argc, char* argv[]) {
5353
// Parse gflags. We recommend you to use gflags as well.
54-
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);
54+
GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
5555

5656
// A Channel represents a communication line to a Server. Notice that
5757
// Channel is thread-safe and can be shared by all threads in your program.

example/asynchronous_echo_c++/server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class EchoServiceImpl : public example::EchoService {
8787

8888
int main(int argc, char* argv[]) {
8989
// Parse gflags. We recommend you to use gflags as well.
90-
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);
90+
GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
9191

9292
// Generally you only need one Server.
9393
brpc::Server server;

example/auto_concurrency_limiter/CMakeLists.txt

+1-12
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY))
5151
endif()
5252
include_directories(${GFLAGS_INCLUDE_PATH})
5353

54-
execute_process(
55-
COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'"
56-
OUTPUT_VARIABLE GFLAGS_NS
57-
)
58-
if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE")
59-
execute_process(
60-
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'"
61-
OUTPUT_VARIABLE GFLAGS_NS
62-
)
63-
endif()
6454
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
6555
include(CheckFunctionExists)
6656
CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME)
@@ -69,8 +59,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
6959
endif()
7060
endif()
7161

72-
set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}")
73-
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
62+
set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
7463

7564
if(CMAKE_VERSION VERSION_LESS "3.1.3")
7665
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")

example/auto_concurrency_limiter/client.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ void RunCase(test::ControlService_Stub &cntl_stub,
215215

216216
int main(int argc, char* argv[]) {
217217
// Parse gflags. We recommend you to use gflags as well.
218-
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);
218+
GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
219219
Expose();
220220

221221
brpc::Channel channel;

example/auto_concurrency_limiter/server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ class ControlServiceImpl : public test::ControlService {
271271

272272
int main(int argc, char* argv[]) {
273273
// Parse gflags. We recommend you to use gflags as well.
274-
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);
274+
GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
275275
bthread::FLAGS_bthread_concurrency= FLAGS_server_bthread_concurrency;
276276

277277
brpc::Server server;

example/backup_request_c++/CMakeLists.txt

+1-12
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY))
5858
endif()
5959
include_directories(${GFLAGS_INCLUDE_PATH})
6060

61-
execute_process(
62-
COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'"
63-
OUTPUT_VARIABLE GFLAGS_NS
64-
)
65-
if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE")
66-
execute_process(
67-
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'"
68-
OUTPUT_VARIABLE GFLAGS_NS
69-
)
70-
endif()
7161
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
7262
include(CheckFunctionExists)
7363
CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME)
@@ -76,8 +66,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
7666
endif()
7767
endif()
7868

79-
set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}")
80-
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
69+
set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
8170

8271
if(CMAKE_VERSION VERSION_LESS "3.1.3")
8372
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")

example/backup_request_c++/client.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ DEFINE_int32(backup_request_ms, 2, "Timeout for sending backup request");
3535

3636
int main(int argc, char* argv[]) {
3737
// Parse gflags. We recommend you to use gflags as well.
38-
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);
38+
GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
3939

4040
// A Channel represents a communication line to a Server. Notice that
4141
// Channel is thread-safe and can be shared by all threads in your program.

example/backup_request_c++/server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class SleepyEchoService : public EchoService
7878

7979
int main(int argc, char* argv[]) {
8080
// Parse gflags. We recommend you to use gflags as well.
81-
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);
81+
GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
8282

8383
// Generally you only need one Server.
8484
brpc::Server server;

example/baidu_proxy_and_generic_call/CMakeLists.txt

+1-12
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY))
5151
endif()
5252
include_directories(${GFLAGS_INCLUDE_PATH})
5353

54-
execute_process(
55-
COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'"
56-
OUTPUT_VARIABLE GFLAGS_NS
57-
)
58-
if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE")
59-
execute_process(
60-
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'"
61-
OUTPUT_VARIABLE GFLAGS_NS
62-
)
63-
endif()
6454
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
6555
include(CheckFunctionExists)
6656
CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME)
@@ -69,8 +59,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
6959
endif()
7060
endif()
7161

72-
set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}")
73-
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
62+
set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
7463

7564
if(CMAKE_VERSION VERSION_LESS "3.1.3")
7665
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")

example/baidu_proxy_and_generic_call/client.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ DEFINE_int32(interval_ms, 1000, "Milliseconds between consecutive requests");
3434

3535
int main(int argc, char* argv[]) {
3636
// Parse gflags. We recommend you to use gflags as well.
37-
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);
37+
GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
3838

3939
// A Channel represents a communication line to a Server. Notice that
4040
// Channel is thread-safe and can be shared by all threads in your program.

example/baidu_proxy_and_generic_call/proxy.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class BaiduMasterServiceImpl : public brpc::BaiduMasterService {
111111

112112
int main(int argc, char* argv[]) {
113113
// Parse gflags. We recommend you to use gflags as well.
114-
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);
114+
GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
115115

116116
// Generally you only need one Server.
117117
brpc::Server server;

example/baidu_proxy_and_generic_call/server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class EchoServiceImpl : public EchoService {
7878

7979
int main(int argc, char* argv[]) {
8080
// Parse gflags. We recommend you to use gflags as well.
81-
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);
81+
GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
8282

8383
// Generally you only need one Server.
8484
brpc::Server server;

example/bthread_tag_echo_c++/CMakeLists.txt

+1-12
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY))
6262
endif()
6363
include_directories(${GFLAGS_INCLUDE_PATH})
6464

65-
execute_process(
66-
COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'"
67-
OUTPUT_VARIABLE GFLAGS_NS
68-
)
69-
if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE")
70-
execute_process(
71-
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'"
72-
OUTPUT_VARIABLE GFLAGS_NS
73-
)
74-
endif()
7565
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
7666
include(CheckFunctionExists)
7767
CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME)
@@ -80,8 +70,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
8070
endif()
8171
endif()
8272

83-
set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}")
84-
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
73+
set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
8574
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBRPC_ENABLE_CPU_PROFILER")
8675

8776
if(CMAKE_VERSION VERSION_LESS "3.1.3")

example/bthread_tag_echo_c++/client.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static void* sender(void* arg) {
8484

8585
int main(int argc, char* argv[]) {
8686
// Parse gflags. We recommend you to use gflags as well.
87-
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);
87+
GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
8888

8989
// A Channel represents a communication line to a Server. Notice that
9090
// Channel is thread-safe and can be shared by all threads in your program.

example/bthread_tag_echo_c++/server.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ static void* my_background_task(void*) {
7474

7575
int main(int argc, char* argv[]) {
7676
std::string help_str = "dummy help infomation";
77-
GFLAGS_NS::SetUsageMessage(help_str);
77+
GFLAGS_NAMESPACE::SetUsageMessage(help_str);
7878

7979
// Parse gflags. We recommend you to use gflags as well.
80-
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);
80+
GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
8181

8282
if (FLAGS_h) {
8383
fprintf(stderr, "%s\n%s\n%s", help_str.c_str(), help_str.c_str(), help_str.c_str());

example/cancel_c++/CMakeLists.txt

+1-12
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY))
5858
endif()
5959
include_directories(${GFLAGS_INCLUDE_PATH})
6060

61-
execute_process(
62-
COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'"
63-
OUTPUT_VARIABLE GFLAGS_NS
64-
)
65-
if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE")
66-
execute_process(
67-
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'"
68-
OUTPUT_VARIABLE GFLAGS_NS
69-
)
70-
endif()
7161
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
7262
include(CheckFunctionExists)
7363
CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME)
@@ -76,8 +66,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
7666
endif()
7767
endif()
7868

79-
set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}")
80-
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
69+
set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
8170

8271
if(CMAKE_VERSION VERSION_LESS "3.1.3")
8372
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")

example/cancel_c++/client.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class CancelRPC : public google::protobuf::Closure {
4545

4646
int main(int argc, char* argv[]) {
4747
// Parse gflags. We recommend you to use gflags as well.
48-
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);
48+
GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
4949

5050
// A Channel represents a communication line to a Server. Notice that
5151
// Channel is thread-safe and can be shared by all threads in your program.

example/cancel_c++/server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class EchoServiceImpl : public EchoService {
7373

7474
int main(int argc, char* argv[]) {
7575
// Parse gflags. We recommend you to use gflags as well.
76-
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);
76+
GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
7777

7878
// Generally you only need one Server.
7979
brpc::Server server;

example/cascade_echo_c++/CMakeLists.txt

+1-12
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,6 @@ if((NOT GFLAGS_INCLUDE_PATH) OR (NOT GFLAGS_LIBRARY))
5757
endif()
5858
include_directories(${GFLAGS_INCLUDE_PATH})
5959

60-
execute_process(
61-
COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'"
62-
OUTPUT_VARIABLE GFLAGS_NS
63-
)
64-
if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE")
65-
execute_process(
66-
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'"
67-
OUTPUT_VARIABLE GFLAGS_NS
68-
)
69-
endif()
7060
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
7161
include(CheckFunctionExists)
7262
CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME)
@@ -75,8 +65,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
7565
endif()
7666
endif()
7767

78-
set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DGFLAGS_NS=${GFLAGS_NS}")
79-
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
68+
set(CMAKE_CXX_FLAGS "${DEFINE_CLOCK_GETTIME} -DNDEBUG -O2 -D__const__=__unused__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
8069

8170
if(CMAKE_VERSION VERSION_LESS "3.1.3")
8271
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")

example/cascade_echo_c++/client.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ void* sender(void* arg) {
8787

8888
int main(int argc, char* argv[]) {
8989
// Parse gflags. We recommend you to use gflags as well.
90-
GFLAGS_NS::SetUsageMessage("Send EchoRequest to server every second");
91-
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);
90+
GFLAGS_NAMESPACE::SetUsageMessage("Send EchoRequest to server every second");
91+
GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
9292

9393
// A Channel represents a communication line to a Server. Notice that
9494
// Channel is thread-safe and can be shared by all threads in your program.

example/cascade_echo_c++/server.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ class CascadeEchoService : public EchoService {
8585

8686
int main(int argc, char* argv[]) {
8787
// Parse gflags. We recommend you to use gflags as well.
88-
GFLAGS_NS::SetUsageMessage("A server that may call itself");
89-
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);
88+
GFLAGS_NAMESPACE::SetUsageMessage("A server that may call itself");
89+
GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
9090

9191
// A Channel represents a communication line to a Server. Notice that
9292
// Channel is thread-safe and can be shared by all threads in your program.

example/coroutine/coroutine_server.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ int main(int argc, char* argv[]) {
111111
bthread_setconcurrency(BTHREAD_MIN_CONCURRENCY);
112112

113113
// Parse gflags. We recommend you to use gflags as well.
114-
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);
114+
GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
115115
if (FLAGS_enable_coroutine) {
116-
GFLAGS_NS::SetCommandLineOption("usercode_in_coroutine", "true");
116+
GFLAGS_NAMESPACE::SetCommandLineOption("usercode_in_coroutine", "true");
117117
}
118118

119119
// Generally you only need one Server.

0 commit comments

Comments
 (0)