From f8b5bec4f5d4d9f85e9d2480785419903c836c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Szab=C3=B3?= Date: Tue, 10 Dec 2024 13:08:41 +0100 Subject: [PATCH] Fix OSS compiler warnings --- mcrouter/Server-inl.h | 1 - mcrouter/StandaloneConfig.cpp | 6 +++--- mcrouter/ThriftAcceptor-impl.h | 2 +- mcrouter/ThriftAcceptor.cpp | 1 - mcrouter/lib/SelectionRouteFactory.h | 2 +- mcrouter/lib/carbon/Artillery-inl.h | 4 ++-- mcrouter/lib/network/FBTrace-inl.h | 4 ++-- mcrouter/mcrouter_config.cpp | 6 +++--- mcrouter/mcrouter_config.h | 6 +++--- mcrouter/mcrouter_sr_deps-impl.h | 6 ++++-- mcrouter/routes/LatestRoute.h | 2 +- mcrouter/routes/ProxyRoute-inl.h | 2 +- mcrouter/routes/test/RouteHandleTestUtil.h | 1 - 13 files changed, 21 insertions(+), 22 deletions(-) diff --git a/mcrouter/Server-inl.h b/mcrouter/Server-inl.h index 6a391c34e..e10a8a882 100644 --- a/mcrouter/Server-inl.h +++ b/mcrouter/Server-inl.h @@ -292,7 +292,6 @@ bool runServerDual( const McrouterOptions& mcrouterOpts, const McrouterStandaloneOptions& standaloneOpts, StandalonePreRunCb preRunCb) { - using RequestHandlerType = RequestHandler>; std::shared_ptr ioThreadPool; CarbonRouterInstance* router; std::shared_ptr asyncMcServer; diff --git a/mcrouter/StandaloneConfig.cpp b/mcrouter/StandaloneConfig.cpp index 8a06a40d8..19a34cd38 100644 --- a/mcrouter/StandaloneConfig.cpp +++ b/mcrouter/StandaloneConfig.cpp @@ -15,12 +15,12 @@ namespace memcache { namespace mcrouter { void standalonePreInitFromCommandLineOpts( - const std::unordered_map& standaloneOptionsDict) { + const std::unordered_map& /* standaloneOptionsDict */) { } void standaloneInit( - const McrouterOptions& opts, - const McrouterStandaloneOptions& standaloneOpts) {} + const McrouterOptions& /* opts */, + const McrouterStandaloneOptions& /* standaloneOpts */) {} void initStandaloneSSL() {} diff --git a/mcrouter/ThriftAcceptor-impl.h b/mcrouter/ThriftAcceptor-impl.h index 0ad1682bd..54844edc9 100644 --- a/mcrouter/ThriftAcceptor-impl.h +++ b/mcrouter/ThriftAcceptor-impl.h @@ -32,7 +32,7 @@ class ThriftAcceptorFactory final : public wangle::AcceptorFactory { explicit ThriftAcceptorFactory( apache::thrift::ThriftServer& server, ThriftAclCheckerFunc /* unused */, - int trafficClass /* unused */) + int /* trafficClass */) : server_(server) {} ~ThriftAcceptorFactory() override = default; diff --git a/mcrouter/ThriftAcceptor.cpp b/mcrouter/ThriftAcceptor.cpp index 7736ed0d3..bfc03e352 100644 --- a/mcrouter/ThriftAcceptor.cpp +++ b/mcrouter/ThriftAcceptor.cpp @@ -30,7 +30,6 @@ namespace memcache { std::shared_ptr ThriftAcceptorFactory::newAcceptor( folly::EventBase* evb) { class ThriftAcceptor : public apache::thrift::Cpp2Worker { - using ThriftAclCheckerFunc = ThriftAcceptorFactory::ThriftAclCheckerFunc; protected: struct Tag {}; diff --git a/mcrouter/lib/SelectionRouteFactory.h b/mcrouter/lib/SelectionRouteFactory.h index 08b08d8b4..c466b27a3 100644 --- a/mcrouter/lib/SelectionRouteFactory.h +++ b/mcrouter/lib/SelectionRouteFactory.h @@ -49,7 +49,7 @@ typename RouterInfo::RouteHandlePtr createSelectionRoute( mcrouter::createErrorRoute("Invalid destination index."); } if (children.empty() && shadowChildren.empty()) { - return std::move(outOfRangeDestination); + return outOfRangeDestination; } if (shadowChildren.empty()) { return makeRouteHandleWithInfo( diff --git a/mcrouter/lib/carbon/Artillery-inl.h b/mcrouter/lib/carbon/Artillery-inl.h index 3003c1ce9..58a63c31c 100644 --- a/mcrouter/lib/carbon/Artillery-inl.h +++ b/mcrouter/lib/carbon/Artillery-inl.h @@ -19,12 +19,12 @@ namespace tracing { #ifdef LIBMC_FBTRACE_DISABLE inline std::pair serializeTraceContext( - const std::string& traceContext) { + const std::string& /* traceContext */) { return {0, 0}; } inline std::string deserializeTraceContext( - std::pair serializedTraceId) { + std::pair /* serializedTraceId */) { return ""; } diff --git a/mcrouter/lib/network/FBTrace-inl.h b/mcrouter/lib/network/FBTrace-inl.h index 585f19e3b..f15725313 100644 --- a/mcrouter/lib/network/FBTrace-inl.h +++ b/mcrouter/lib/network/FBTrace-inl.h @@ -31,8 +31,8 @@ inline uint64_t traceGetCount() { } inline std::nullptr_t traceRequestReceived( - const std::string& traceContext, - folly::StringPiece requestType) { + const std::string& /* traceContext */, + folly::StringPiece /* requestType */) { // Do nothing by default. return nullptr; } diff --git a/mcrouter/mcrouter_config.cpp b/mcrouter/mcrouter_config.cpp index f2e31564d..694eb42f0 100644 --- a/mcrouter/mcrouter_config.cpp +++ b/mcrouter/mcrouter_config.cpp @@ -95,9 +95,9 @@ std::vector defaultTestCommandLineArgs() { return {"--disable-failure-logging", "--stats-logging-interval=0"}; } -void logTkoEvent(ProxyBase& proxy, const TkoLog& tkoLog) {} +void logTkoEvent(ProxyBase& /* proxy */, const TkoLog& /* tkoLog */) {} -void logFailover(ProxyBase& proxy, const FailoverContext& failoverContext) {} +void logFailover(ProxyBase& /* proxy */, const FailoverContext& /* failoverContext */) {} void initFailureLogger() {} @@ -111,7 +111,7 @@ std::unordered_map additionalConfigParams() { return std::unordered_map(); } -void insertCustomStartupOpts(folly::dynamic& options) {} +void insertCustomStartupOpts(folly::dynamic& /* options */) {} std::string getBinPath(folly::StringPiece name) { if (name == "mcrouter") { diff --git a/mcrouter/mcrouter_config.h b/mcrouter/mcrouter_config.h index 7cfa89533..66559d454 100644 --- a/mcrouter/mcrouter_config.h +++ b/mcrouter/mcrouter_config.h @@ -180,8 +180,8 @@ folly::dynamic readStaticJsonFile(folly::StringPiece file); inline folly::Optional> startObservingRuntimeVarsFileCustom( - folly::StringPiece file, - std::function onUpdate) { + folly::StringPiece /* file */, + std::function /* onUpdate */) { return folly::none; } @@ -190,7 +190,7 @@ inline bool isInLocalDatacenter(const std::string& /* host */) { } inline Transport::SvcIdentAuthCallbackFunc getAuthChecker( - const McrouterOptions& opts) { + const McrouterOptions& /* opts */) { return nullptr; } diff --git a/mcrouter/mcrouter_sr_deps-impl.h b/mcrouter/mcrouter_sr_deps-impl.h index 19b41e64e..d22e0f536 100644 --- a/mcrouter/mcrouter_sr_deps-impl.h +++ b/mcrouter/mcrouter_sr_deps-impl.h @@ -28,7 +28,7 @@ class HostInfoLocation { const uint16_t* getTWTaskID() const { return nullptr; } - const uint64_t hostUniqueKey() const noexcept { + uint64_t hostUniqueKey() const noexcept { return 0; } @@ -52,7 +52,7 @@ struct SRHost { public: SRHost(){}; const std::string& getIp() const { - return "127.0.0.1"; + return ip_; } uint16_t getPort() const { return 0; @@ -60,6 +60,8 @@ struct SRHost { const std::optional getTwTaskId() const { return std::nullopt; } + private: + const std::string ip_ = "127.0.0.1"; }; } // namespace memcache diff --git a/mcrouter/routes/LatestRoute.h b/mcrouter/routes/LatestRoute.h index 03758b2d5..4a317273f 100644 --- a/mcrouter/routes/LatestRoute.h +++ b/mcrouter/routes/LatestRoute.h @@ -32,7 +32,7 @@ std::vector> getTargets( std::vector weights, folly::StringPiece salt) { if (targets.size() <= 1) { - return std::move(targets); + return targets; } std::vector> failovers; diff --git a/mcrouter/routes/ProxyRoute-inl.h b/mcrouter/routes/ProxyRoute-inl.h index ea902ad64..673142502 100644 --- a/mcrouter/routes/ProxyRoute-inl.h +++ b/mcrouter/routes/ProxyRoute-inl.h @@ -26,7 +26,7 @@ typename RouterInfo::RouteHandlePtr wrapWithBigValueRoute( typename RouterInfo::RouteHandlePtr ch, const McrouterOptions& routerOpts) { if (routerOpts.big_value_split_threshold == 0) { - return std::move(ch); + return ch; } BigValueRouteOptions options( routerOpts.big_value_split_threshold, diff --git a/mcrouter/routes/test/RouteHandleTestUtil.h b/mcrouter/routes/test/RouteHandleTestUtil.h index 60d1faa6e..269b4d4bf 100644 --- a/mcrouter/routes/test/RouteHandleTestUtil.h +++ b/mcrouter/routes/test/RouteHandleTestUtil.h @@ -61,7 +61,6 @@ inline void mockFiberContext() { template void setRecordBucketDataContext( std::vector>& pairs) { - using KeyBucketPair = std::pair; auto cb = [&pairs]( std::string key, const uint64_t bucket,