Skip to content

Commit

Permalink
Decide namespace of gflags in config_brpc.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
gejun committed Sep 19, 2017
1 parent ce673b5 commit 8ae7b0c
Show file tree
Hide file tree
Showing 76 changed files with 145 additions and 150 deletions.
10 changes: 9 additions & 1 deletion config_brpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ fi
PROTOC=$(find_bin_or_die protoc)

GFLAGS_HDR=$(find_dir_of_header_or_die gflags/gflags.h)
# namespace of gflags may not be google, grep it from source.
GFLAGS_NS=$(grep "namespace [a-z0-9]\+ {" $GFLAGS_HDR/gflags/gflags.h | head -1 | awk '{print $2}')
if [ -z "$GFLAGS_NS" ]; then
>&2 $ECHO "Fail to grep namespace of gflags source $GFLAGS_HDR/gflags/gflags.h"
exit 1
fi

PROTOBUF_HDR=$(find_dir_of_header_or_die google/protobuf/message.h)
LEVELDB_HDR=$(find_dir_of_header_or_die leveldb/db.h)

Expand Down Expand Up @@ -301,7 +308,8 @@ if [ $WITH_GLOG != 0 ]; then
rm -f libglog.deps
fi
fi
append_to_output "CPPFLAGS+=-DBRPC_WITH_GLOG=$WITH_GLOG"
append_to_output "CPPFLAGS+=-DBRPC_WITH_GLOG=$WITH_GLOG -DGFLAGS_NS=$GFLAGS_NS"


if [ ! -z "$REQUIRE_UNWIND" ]; then
append_to_output_libs "$UNWIND_LIB" " "
Expand Down
2 changes: 1 addition & 1 deletion example/asynchronous_echo_c++/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void HandleEchoResponse(

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::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.
Expand Down
2 changes: 1 addition & 1 deletion example/asynchronous_echo_c++/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class EchoServiceImpl : public example::EchoService {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);

// Generally you only need one Server.
brpc::Server server;
Expand Down
2 changes: 1 addition & 1 deletion example/backup_request_c++/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,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.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::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.
Expand Down
2 changes: 1 addition & 1 deletion example/backup_request_c++/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class SleepyEchoService : public EchoService

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);

// Generally you only need one Server.
brpc::Server server;
Expand Down
2 changes: 1 addition & 1 deletion example/cancel_c++/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class CancelRPC : public google::protobuf::Closure {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::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.
Expand Down
2 changes: 1 addition & 1 deletion example/cancel_c++/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class EchoServiceImpl : public EchoService {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);

// Generally you only need one Server.
brpc::Server server;
Expand Down
4 changes: 2 additions & 2 deletions example/cascade_echo_c++/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ void* sender(void* arg) {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::SetUsageMessage("Send EchoRequest to server every second");
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::SetUsageMessage("Send EchoRequest to server every second");
GFLAGS_NS::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.
Expand Down
4 changes: 2 additions & 2 deletions example/cascade_echo_c++/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ class CascadeEchoService : public EchoService {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::SetUsageMessage("A server that may call itself");
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::SetUsageMessage("A server that may call itself");
GFLAGS_NS::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.
Expand Down
2 changes: 1 addition & 1 deletion example/dynamic_partition_echo_c++/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class MyPartitionParser : public brpc::PartitionParser {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::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.
Expand Down
2 changes: 1 addition & 1 deletion example/dynamic_partition_echo_c++/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);

if (FLAGS_server_num <= 0) {
LOG(ERROR) << "server_num must be positive";
Expand Down
2 changes: 1 addition & 1 deletion example/echo_c++/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ DEFINE_string(http_content_type, "application/json", "Content type of http reque

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::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.
Expand Down
2 changes: 1 addition & 1 deletion example/echo_c++/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class EchoServiceImpl : public EchoService {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);

// Generally you only need one Server.
brpc::Server server;
Expand Down
2 changes: 1 addition & 1 deletion example/echo_c++_hulu_pbrpc/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,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.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::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.
Expand Down
2 changes: 1 addition & 1 deletion example/echo_c++_hulu_pbrpc/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class EchoServiceImpl : public EchoService {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);

// Generally you only need one Server.
brpc::Server server;
Expand Down
2 changes: 1 addition & 1 deletion example/echo_c++_sofa_pbrpc/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ DEFINE_string(protocol, "sofa_pbrpc", "Protocol type. Defined in src/brpc/option

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::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.
Expand Down
2 changes: 1 addition & 1 deletion example/echo_c++_sofa_pbrpc/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class EchoServiceImpl : public EchoService {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);

// Generally you only need one Server.
brpc::Server server;
Expand Down
2 changes: 1 addition & 1 deletion example/echo_c++_ubrpc_compack/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ DEFINE_bool(multi_args, false,

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::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.
Expand Down
2 changes: 1 addition & 1 deletion example/echo_c++_ubrpc_compack/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class EchoServiceImpl : public EchoService {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);

// Generally you only need one Server.
brpc::Server server;
Expand Down
2 changes: 1 addition & 1 deletion example/http_c++/benchmark_http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static void* sender(void* arg) {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::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.
Expand Down
2 changes: 1 addition & 1 deletion example/http_c++/http_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ DECLARE_bool(http_verbose);

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);

if (argc != 2) {
LOG(ERROR) << "Usage: ./http_client \"www.foo.com\"";
Expand Down
2 changes: 1 addition & 1 deletion example/http_c++/http_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class QueueServiceImpl : public example::QueueService {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);

// Generally you only need one Server.
brpc::Server server;
Expand Down
2 changes: 1 addition & 1 deletion example/memcache_c++/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);
if (FLAGS_exptime < 0) {
FLAGS_exptime = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion example/multi_threaded_echo_c++/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::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.
Expand Down
4 changes: 2 additions & 2 deletions example/multi_threaded_echo_c++/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ DEFINE_bool(h, false, "print help information");

int main(int argc, char* argv[]) {
std::string help_str = "dummy help infomation";
google::SetUsageMessage(help_str);
GFLAGS_NS::SetUsageMessage(help_str);

// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::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());
Expand Down
2 changes: 1 addition & 1 deletion example/multi_threaded_echo_fns_c++/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static void* sender(void* arg) {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::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.
Expand Down
2 changes: 1 addition & 1 deletion example/multi_threaded_echo_fns_c++/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class EchoServiceImpl : public example::EchoService {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);

if (FLAGS_server_num <= 0) {
LOG(ERROR) << "server_num must be positive";
Expand Down
2 changes: 1 addition & 1 deletion example/multi_threaded_mcpack_c++/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::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.
Expand Down
2 changes: 1 addition & 1 deletion example/multi_threaded_mcpack_c++/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class EchoServiceImpl : public EchoService {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);

// Generally you only need one Server.
brpc::Server server;
Expand Down
2 changes: 1 addition & 1 deletion example/nshead_extension_c++/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,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.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::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.
Expand Down
2 changes: 1 addition & 1 deletion example/nshead_extension_c++/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class MyNsheadProtocol : public brpc::NsheadService {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);

brpc::Server server;
brpc::ServerOptions options;
Expand Down
2 changes: 1 addition & 1 deletion example/nshead_pb_extension_c++/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,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.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::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.
Expand Down
2 changes: 1 addition & 1 deletion example/nshead_pb_extension_c++/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class MyNsheadProtocol : public brpc::NsheadPbServiceAdaptor {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);

brpc::Server server;
example::EchoServiceImpl echo_service_impl;
Expand Down
2 changes: 1 addition & 1 deletion example/parallel_echo_c++/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::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.
Expand Down
2 changes: 1 addition & 1 deletion example/parallel_echo_c++/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class EchoServiceImpl : public example::EchoService {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);

// Generally you only need one Server.
brpc::Server server;
Expand Down
2 changes: 1 addition & 1 deletion example/partition_echo_c++/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class MyPartitionParser : public brpc::PartitionParser {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::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.
Expand Down
2 changes: 1 addition & 1 deletion example/partition_echo_c++/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class EchoServiceImpl : public example::EchoService {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);

// Generally you only need one Server.
brpc::Server server;
Expand Down
2 changes: 1 addition & 1 deletion example/redis_c++/redis_cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static int cli_getc(FILE *stream) {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::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.
Expand Down
2 changes: 1 addition & 1 deletion example/redis_c++/redis_press.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static void* sender(void* void_args) {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::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.
Expand Down
2 changes: 1 addition & 1 deletion example/selective_echo_c++/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ static void* sender(void* arg) {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::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.
Expand Down
2 changes: 1 addition & 1 deletion example/selective_echo_c++/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class EchoServiceImpl : public example::EchoService {

int main(int argc, char* argv[]) {
// Parse gflags. We recommend you to use gflags as well.
google::ParseCommandLineFlags(&argc, &argv, true);
GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);

if (FLAGS_server_num <= 0) {
LOG(ERROR) << "server_num must be positive";
Expand Down
Loading

0 comments on commit 8ae7b0c

Please sign in to comment.