Skip to content

Commit 443a465

Browse files
committed
Fix OSS compiler warnings
As observed in #449, the OSS build currently produces various compiler warnings, mostly from OSS-specific stubs. Fix the following warnings: * Fix -Wunused-parameter in stub functions by commenting out the relevant parameters. * Fix -Wunused-local-typedef by removing unused typedefs. * Fix -Wreturn-local-addr in SRHost by returning a reference to a member variable instead. * Fix -Wredundant-move by removing a redundant std::move() call when returning a function parameter.
1 parent 9b6c365 commit 443a465

13 files changed

+20
-21
lines changed

mcrouter/Server-inl.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,6 @@ bool runServerDual(
292292
const McrouterOptions& mcrouterOpts,
293293
const McrouterStandaloneOptions& standaloneOpts,
294294
StandalonePreRunCb preRunCb) {
295-
using RequestHandlerType = RequestHandler<ServerOnRequest<RouterInfo>>;
296295
std::shared_ptr<folly::IOThreadPoolExecutorBase> ioThreadPool;
297296
CarbonRouterInstance<RouterInfo>* router;
298297
std::shared_ptr<AsyncMcServer> asyncMcServer;

mcrouter/StandaloneConfig.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ namespace memcache {
1515
namespace mcrouter {
1616

1717
void standalonePreInitFromCommandLineOpts(
18-
const std::unordered_map<std::string, std::string>& standaloneOptionsDict) {
18+
const std::unordered_map<std::string, std::string>& /* standaloneOptionsDict */) {
1919
}
2020

2121
void standaloneInit(
22-
const McrouterOptions& opts,
23-
const McrouterStandaloneOptions& standaloneOpts) {}
22+
const McrouterOptions& /* opts */,
23+
const McrouterStandaloneOptions& /* standaloneOpts */) {}
2424

2525
void initStandaloneSSL() {}
2626

mcrouter/ThriftAcceptor-impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ThriftAcceptorFactory final : public wangle::AcceptorFactory {
3232
explicit ThriftAcceptorFactory(
3333
apache::thrift::ThriftServer& server,
3434
ThriftAclCheckerFunc /* unused */,
35-
int trafficClass /* unused */)
35+
int /* trafficClass */)
3636
: server_(server) {}
3737
~ThriftAcceptorFactory() override = default;
3838

mcrouter/ThriftAcceptor.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ namespace memcache {
3030
std::shared_ptr<wangle::Acceptor> ThriftAcceptorFactory::newAcceptor(
3131
folly::EventBase* evb) {
3232
class ThriftAcceptor : public apache::thrift::Cpp2Worker {
33-
using ThriftAclCheckerFunc = ThriftAcceptorFactory::ThriftAclCheckerFunc;
3433

3534
protected:
3635
struct Tag {};

mcrouter/lib/SelectionRouteFactory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ typename RouterInfo::RouteHandlePtr createSelectionRoute(
4949
mcrouter::createErrorRoute<RouterInfo>("Invalid destination index.");
5050
}
5151
if (children.empty() && shadowChildren.empty()) {
52-
return std::move(outOfRangeDestination);
52+
return outOfRangeDestination;
5353
}
5454
if (shadowChildren.empty()) {
5555
return makeRouteHandleWithInfo<RouterInfo, SelectionRoute, Selector>(

mcrouter/lib/carbon/Artillery-inl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ namespace tracing {
1919
#ifdef LIBMC_FBTRACE_DISABLE
2020

2121
inline std::pair<uint64_t, uint64_t> serializeTraceContext(
22-
const std::string& traceContext) {
22+
const std::string& /* traceContext */) {
2323
return {0, 0};
2424
}
2525

2626
inline std::string deserializeTraceContext(
27-
std::pair<uint64_t, uint64_t> serializedTraceId) {
27+
std::pair<uint64_t, uint64_t> /* serializedTraceId */) {
2828
return "";
2929
}
3030

mcrouter/lib/network/FBTrace-inl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ inline uint64_t traceGetCount() {
3131
}
3232

3333
inline std::nullptr_t traceRequestReceived(
34-
const std::string& traceContext,
35-
folly::StringPiece requestType) {
34+
const std::string& /* traceContext */,
35+
folly::StringPiece /* requestType */) {
3636
// Do nothing by default.
3737
return nullptr;
3838
}

mcrouter/mcrouter_config.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ std::vector<std::string> defaultTestCommandLineArgs() {
9595
return {"--disable-failure-logging", "--stats-logging-interval=0"};
9696
}
9797

98-
void logTkoEvent(ProxyBase& proxy, const TkoLog& tkoLog) {}
98+
void logTkoEvent(ProxyBase& /* proxy */, const TkoLog& /* tkoLog */) {}
9999

100-
void logFailover(ProxyBase& proxy, const FailoverContext& failoverContext) {}
100+
void logFailover(ProxyBase& /* proxy */, const FailoverContext& /* failoverContext */) {}
101101

102102
void initFailureLogger() {}
103103

@@ -111,7 +111,7 @@ std::unordered_map<std::string, folly::dynamic> additionalConfigParams() {
111111
return std::unordered_map<std::string, folly::dynamic>();
112112
}
113113

114-
void insertCustomStartupOpts(folly::dynamic& options) {}
114+
void insertCustomStartupOpts(folly::dynamic& /* options */) {}
115115

116116
std::string getBinPath(folly::StringPiece name) {
117117
if (name == "mcrouter") {

mcrouter/mcrouter_config.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ folly::dynamic readStaticJsonFile(folly::StringPiece file);
184184

185185
inline folly::Optional<folly::observer::Observer<std::string>>
186186
startObservingRuntimeVarsFileCustom(
187-
folly::StringPiece file,
188-
std::function<void(std::string)> onUpdate) {
187+
folly::StringPiece /* file */,
188+
std::function<void(std::string)> /* onUpdate */) {
189189
return folly::none;
190190
}
191191

@@ -194,7 +194,7 @@ inline bool isInLocalDatacenter(const std::string& /* host */) {
194194
}
195195

196196
inline Transport::SvcIdentAuthCallbackFunc getAuthChecker(
197-
const McrouterOptions& opts) {
197+
const McrouterOptions& /* opts */) {
198198
return nullptr;
199199
}
200200

mcrouter/mcrouter_sr_deps-impl.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,16 @@ struct SRHost {
4949
public:
5050
SRHost(){};
5151
const std::string& getIp() const {
52-
return "127.0.0.1";
52+
return ip_;
5353
}
5454
uint16_t getPort() const {
5555
return 0;
5656
}
5757
const std::optional<uint16_t> getTwTaskId() const {
5858
return std::nullopt;
5959
}
60+
private:
61+
const std::string ip_ = "127.0.0.1";
6062
};
6163

6264
} // namespace memcache

0 commit comments

Comments
 (0)