You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by ja...@apache.org on 2020/01/21 08:25:57 UTC

[incubator-brpc] branch master updated: fix warnings on MACOS

This is an automated email from the ASF dual-hosted git repository.

jamesge pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-brpc.git


The following commit(s) were added to refs/heads/master by this push:
     new 9f51016  fix warnings on MACOS
9f51016 is described below

commit 9f510165bcefc9fd40e6342b8793f7762dddbcb8
Author: jamesge <jg...@gmail.com>
AuthorDate: Tue Jan 21 16:25:30 2020 +0800

    fix warnings on MACOS
---
 CMakeLists.txt                        | 3 ++-
 config_brpc.sh                        | 2 +-
 src/brpc/builtin/hotspots_service.cpp | 2 +-
 src/brpc/policy/http_rpc_protocol.cpp | 2 +-
 src/brpc/redis.h                      | 2 +-
 src/brpc/rpc_dump.h                   | 3 ++-
 src/bthread/fd.cpp                    | 2 +-
 src/butil/binary_printer.cpp          | 4 ++--
 src/bvar/detail/sampler.cpp           | 1 -
 tools/CMakeLists.txt                  | 3 ---
 10 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3deb734..ff78100 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -101,9 +101,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
     if(NOT HAVE_CLOCK_GETTIME)
         set(DEFINE_CLOCK_GETTIME "-DNO_CLOCK_GETTIME_IN_MAC")
     endif()
+    set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -Wno-deprecated-declarations -Wno-inconsistent-missing-override")
 endif()
 
-set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
+set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} ${DEFINE_CLOCK_GETTIME} -DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
 if(WITH_MESALINK)
     set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -DUSE_MESALINK")
 endif()
diff --git a/config_brpc.sh b/config_brpc.sh
index 971dad4..1720031 100755
--- a/config_brpc.sh
+++ b/config_brpc.sh
@@ -319,7 +319,7 @@ if [ ! -z "$DEBUGSYMBOLS" ]; then
     CPPFLAGS="${CPPFLAGS} $DEBUGSYMBOLS"
 fi
 if [ "$SYSTEM" = "Darwin" ]; then
-    CPPFLAGS="${CPPFLAGS} -Wno-deprecated-declarations"
+    CPPFLAGS="${CPPFLAGS} -Wno-deprecated-declarations -Wno-inconsistent-missing-override"
     version=`sw_vers -productVersion | awk -F '.' '{print $1 "." $2}'`
     if [[ `echo "$version<10.12" | bc -l` == 1 ]]; then
         CPPFLAGS="${CPPFLAGS} -DNO_CLOCK_GETTIME_IN_MAC"
diff --git a/src/brpc/builtin/hotspots_service.cpp b/src/brpc/builtin/hotspots_service.cpp
index 5961274..b4e8fcf 100644
--- a/src/brpc/builtin/hotspots_service.cpp
+++ b/src/brpc/builtin/hotspots_service.cpp
@@ -103,7 +103,7 @@ static std::string GeneratePerlScriptPath(const std::string& filename) {
     path += FLAGS_rpc_profiling_dir;
     path.push_back('/');
     path += filename;
-    return std::move(path);
+    return path;
 }
 
 extern bool cpu_profiler_enabled;
diff --git a/src/brpc/policy/http_rpc_protocol.cpp b/src/brpc/policy/http_rpc_protocol.cpp
index 450e28b..3776109 100644
--- a/src/brpc/policy/http_rpc_protocol.cpp
+++ b/src/brpc/policy/http_rpc_protocol.cpp
@@ -583,7 +583,7 @@ void SerializeHttpRequest(butil::IOBuf* /*not used*/,
             hreq.SetHeader(common->TE, common->TRAILERS);
             if (cntl->timeout_ms() >= 0) {
                 hreq.SetHeader(common->GRPC_TIMEOUT,
-                        butil::string_printf("%ldm", cntl->timeout_ms()));
+                        butil::string_printf("%" PRId64, cntl->timeout_ms()));
             }
             // Append compressed and length before body
             AddGrpcPrefix(&cntl->request_attachment(), grpc_compressed);
diff --git a/src/brpc/redis.h b/src/brpc/redis.h
index d3f09e8..199e6d1 100644
--- a/src/brpc/redis.h
+++ b/src/brpc/redis.h
@@ -240,7 +240,7 @@ enum RedisCommandHandlerResult {
 // The Command handler for a redis request. User should impletement Run().
 class RedisCommandHandler {
 public:
-    ~RedisCommandHandler() {}
+    virtual ~RedisCommandHandler() {}
 
     // Once Server receives commands, it will first find the corresponding handlers and
     // call them sequentially(one by one) according to the order that requests arrive,
diff --git a/src/brpc/rpc_dump.h b/src/brpc/rpc_dump.h
index 5ab558f..1f572fe 100644
--- a/src/brpc/rpc_dump.h
+++ b/src/brpc/rpc_dump.h
@@ -47,7 +47,8 @@ DECLARE_bool(rpc_dump);
 // In practice, sampled requests are just small fraction of all requests.
 // The overhead of sampling should be negligible for overall performance.
 
-struct SampledRequest : public bvar::Collected {
+class SampledRequest : public bvar::Collected {
+public:
     butil::IOBuf request;
     RpcDumpMeta meta;
 
diff --git a/src/bthread/fd.cpp b/src/bthread/fd.cpp
index 7d8e138..53063c5 100644
--- a/src/bthread/fd.cpp
+++ b/src/bthread/fd.cpp
@@ -434,7 +434,7 @@ short epoll_to_poll_events(uint32_t epoll_events) {
     return poll_events;
 }
 #elif defined(OS_MACOSX)
-short kqueue_to_poll_events(uint32_t kqueue_events) {
+static short kqueue_to_poll_events(int kqueue_events) {
     //TODO: add more values?
     short poll_events = 0;
     if (kqueue_events == EVFILT_READ) {
diff --git a/src/butil/binary_printer.cpp b/src/butil/binary_printer.cpp
index 1b17134..182589a 100644
--- a/src/butil/binary_printer.cpp
+++ b/src/butil/binary_printer.cpp
@@ -106,7 +106,7 @@ static void PrintIOBuf(Appender* appender, const IOBuf& b, size_t max_length) {
                 printer.Flush();
                 char buf[48];
                 int len = snprintf(buf, sizeof(buf), "...<skipping %" PRIu64 " bytes>",
-                         b.size() - nw);
+                        (uint64_t)(b.size() - nw));
                 appender->Append(buf, len);
                 return;
             }
@@ -124,7 +124,7 @@ static void PrintString(Appender* appender, const StringPiece& s, size_t max_len
             printer.Flush();
             char buf[48];
             int len = snprintf(buf, sizeof(buf), "...<skipping %" PRIu64 " bytes>",
-                               s.size() - i);
+                               (uint64_t)(s.size() - i));
             appender->Append(buf, len);
             return;
         }
diff --git a/src/bvar/detail/sampler.cpp b/src/bvar/detail/sampler.cpp
index f2ca308..fd49991 100644
--- a/src/bvar/detail/sampler.cpp
+++ b/src/bvar/detail/sampler.cpp
@@ -111,7 +111,6 @@ private:
 private:
     bool _created;
     bool _stop;
-    pid_t _created_pid;
     int64_t _cumulated_time_us;
     pthread_t _tid;
 };
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 376ae85..bc2ae0e 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -15,9 +15,6 @@
 # specific language governing permissions and limitations
 # under the License.
 
-set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
-set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -D__STRICT_ANSI__ -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
-use_cxx11()
 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/output/bin)
 
 add_subdirectory(parallel_http)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org