Commit 9f510165 authored by jamesge's avatar jamesge

fix warnings on MACOS

parent 4e519089
...@@ -101,9 +101,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") ...@@ -101,9 +101,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
if(NOT HAVE_CLOCK_GETTIME) if(NOT HAVE_CLOCK_GETTIME)
set(DEFINE_CLOCK_GETTIME "-DNO_CLOCK_GETTIME_IN_MAC") set(DEFINE_CLOCK_GETTIME "-DNO_CLOCK_GETTIME_IN_MAC")
endif() endif()
set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -Wno-deprecated-declarations -Wno-inconsistent-missing-override")
endif() 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) if(WITH_MESALINK)
set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -DUSE_MESALINK") set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -DUSE_MESALINK")
endif() endif()
......
...@@ -319,7 +319,7 @@ if [ ! -z "$DEBUGSYMBOLS" ]; then ...@@ -319,7 +319,7 @@ if [ ! -z "$DEBUGSYMBOLS" ]; then
CPPFLAGS="${CPPFLAGS} $DEBUGSYMBOLS" CPPFLAGS="${CPPFLAGS} $DEBUGSYMBOLS"
fi fi
if [ "$SYSTEM" = "Darwin" ]; then 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}'` version=`sw_vers -productVersion | awk -F '.' '{print $1 "." $2}'`
if [[ `echo "$version<10.12" | bc -l` == 1 ]]; then if [[ `echo "$version<10.12" | bc -l` == 1 ]]; then
CPPFLAGS="${CPPFLAGS} -DNO_CLOCK_GETTIME_IN_MAC" CPPFLAGS="${CPPFLAGS} -DNO_CLOCK_GETTIME_IN_MAC"
......
...@@ -103,7 +103,7 @@ static std::string GeneratePerlScriptPath(const std::string& filename) { ...@@ -103,7 +103,7 @@ static std::string GeneratePerlScriptPath(const std::string& filename) {
path += FLAGS_rpc_profiling_dir; path += FLAGS_rpc_profiling_dir;
path.push_back('/'); path.push_back('/');
path += filename; path += filename;
return std::move(path); return path;
} }
extern bool cpu_profiler_enabled; extern bool cpu_profiler_enabled;
......
...@@ -583,7 +583,7 @@ void SerializeHttpRequest(butil::IOBuf* /*not used*/, ...@@ -583,7 +583,7 @@ void SerializeHttpRequest(butil::IOBuf* /*not used*/,
hreq.SetHeader(common->TE, common->TRAILERS); hreq.SetHeader(common->TE, common->TRAILERS);
if (cntl->timeout_ms() >= 0) { if (cntl->timeout_ms() >= 0) {
hreq.SetHeader(common->GRPC_TIMEOUT, 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 // Append compressed and length before body
AddGrpcPrefix(&cntl->request_attachment(), grpc_compressed); AddGrpcPrefix(&cntl->request_attachment(), grpc_compressed);
......
...@@ -240,7 +240,7 @@ enum RedisCommandHandlerResult { ...@@ -240,7 +240,7 @@ enum RedisCommandHandlerResult {
// The Command handler for a redis request. User should impletement Run(). // The Command handler for a redis request. User should impletement Run().
class RedisCommandHandler { class RedisCommandHandler {
public: public:
~RedisCommandHandler() {} virtual ~RedisCommandHandler() {}
// Once Server receives commands, it will first find the corresponding handlers and // 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, // call them sequentially(one by one) according to the order that requests arrive,
......
...@@ -47,7 +47,8 @@ DECLARE_bool(rpc_dump); ...@@ -47,7 +47,8 @@ DECLARE_bool(rpc_dump);
// In practice, sampled requests are just small fraction of all requests. // In practice, sampled requests are just small fraction of all requests.
// The overhead of sampling should be negligible for overall performance. // The overhead of sampling should be negligible for overall performance.
struct SampledRequest : public bvar::Collected { class SampledRequest : public bvar::Collected {
public:
butil::IOBuf request; butil::IOBuf request;
RpcDumpMeta meta; RpcDumpMeta meta;
......
...@@ -434,7 +434,7 @@ short epoll_to_poll_events(uint32_t epoll_events) { ...@@ -434,7 +434,7 @@ short epoll_to_poll_events(uint32_t epoll_events) {
return poll_events; return poll_events;
} }
#elif defined(OS_MACOSX) #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? //TODO: add more values?
short poll_events = 0; short poll_events = 0;
if (kqueue_events == EVFILT_READ) { if (kqueue_events == EVFILT_READ) {
......
...@@ -106,7 +106,7 @@ static void PrintIOBuf(Appender* appender, const IOBuf& b, size_t max_length) { ...@@ -106,7 +106,7 @@ static void PrintIOBuf(Appender* appender, const IOBuf& b, size_t max_length) {
printer.Flush(); printer.Flush();
char buf[48]; char buf[48];
int len = snprintf(buf, sizeof(buf), "...<skipping %" PRIu64 " bytes>", int len = snprintf(buf, sizeof(buf), "...<skipping %" PRIu64 " bytes>",
b.size() - nw); (uint64_t)(b.size() - nw));
appender->Append(buf, len); appender->Append(buf, len);
return; return;
} }
...@@ -124,7 +124,7 @@ static void PrintString(Appender* appender, const StringPiece& s, size_t max_len ...@@ -124,7 +124,7 @@ static void PrintString(Appender* appender, const StringPiece& s, size_t max_len
printer.Flush(); printer.Flush();
char buf[48]; char buf[48];
int len = snprintf(buf, sizeof(buf), "...<skipping %" PRIu64 " bytes>", int len = snprintf(buf, sizeof(buf), "...<skipping %" PRIu64 " bytes>",
s.size() - i); (uint64_t)(s.size() - i));
appender->Append(buf, len); appender->Append(buf, len);
return; return;
} }
......
...@@ -111,7 +111,6 @@ private: ...@@ -111,7 +111,6 @@ private:
private: private:
bool _created; bool _created;
bool _stop; bool _stop;
pid_t _created_pid;
int64_t _cumulated_time_us; int64_t _cumulated_time_us;
pthread_t _tid; pthread_t _tid;
}; };
......
...@@ -15,9 +15,6 @@ ...@@ -15,9 +15,6 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # 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) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/output/bin)
add_subdirectory(parallel_http) add_subdirectory(parallel_http)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment