Commit ccb229d5 authored by Jim Meyering's avatar Jim Meyering Committed by Alecs King

folly: avoid new warnings from -Winconsistent-missing-override

Summary:
Upgrading to clang:dev (clang >3.6) brought in some new warnings.
This change address all of the issues exposed by the new
-Winconsistent-missing-override, usually by simply adding the
missing "override" keyword.  However, in
folly/wangle/channel/test/MockChannelHandler.h, I chose
to ignore those warnings for the mocked functions.
* folly/futures/test/ViaTest.cpp: Add missing "override"(s).
* folly/io/async/AsyncSSLSocket.h: Likewise.
* folly/io/async/AsyncSocket.h: Likewise.
* folly/io/async/EventBase.h: Likewise.
* folly/test/ExceptionWrapperTest.cpp: Likewise.
* folly/wangle/channel/AsyncSocketHandler.h: Likewise.
* folly/wangle/channel/test/MockChannelHandler.h: Ignore
the new warning for these functions.

Test Plan:
Run these commands and note there are fewer errors than before:
fbconfig --clang --with-project-version=clang:dev -r folly && fbmake dbgo

Reviewed By: hans@fb.com

Subscribers: trunkagent, fugalh, folly-diffs@, jsedgwick, yfeldblum

FB internal diff: D1848330

Tasks: 6244745

Signature: t1:1848330:1423858909:b167ca220d6c9fe036d3adca08cf3053a7a9de16
parent 09430395
......@@ -27,7 +27,7 @@ using namespace folly;
struct ManualWaiter : public DrivableExecutor {
explicit ManualWaiter(std::shared_ptr<ManualExecutor> ex) : ex(ex) {}
void add(Func f) {
void add(Func f) override {
ex->add(f);
}
......
......@@ -263,16 +263,16 @@ class AsyncSSLSocket : public virtual AsyncSocket {
// See the documentation in TAsyncTransport.h
// TODO: implement graceful shutdown in close()
// TODO: implement detachSSL() that returns the SSL connection
virtual void closeNow();
virtual void shutdownWrite();
virtual void shutdownWriteNow();
virtual bool good() const;
virtual bool connecting() const;
virtual void closeNow() override;
virtual void shutdownWrite() override;
virtual void shutdownWriteNow() override;
virtual bool good() const override;
virtual bool connecting() const override;
bool isEorTrackingEnabled() const override;
virtual void setEorTracking(bool track);
virtual size_t getRawBytesWritten() const;
virtual size_t getRawBytesReceived() const;
virtual void setEorTracking(bool track) override;
virtual size_t getRawBytesWritten() const override;
virtual size_t getRawBytesReceived() const override;
void enableClientHelloParsing();
/**
......@@ -309,7 +309,7 @@ class AsyncSSLSocket : public virtual AsyncSocket {
int timeout = 0,
const OptionMap &options = emptyOptionMap,
const folly::SocketAddress& bindAddr = anyAddress)
noexcept;
noexcept override;
using AsyncSocket::connect;
......@@ -469,12 +469,12 @@ class AsyncSSLSocket : public virtual AsyncSocket {
return 0;
}
virtual void attachEventBase(EventBase* eventBase) {
virtual void attachEventBase(EventBase* eventBase) override {
AsyncSocket::attachEventBase(eventBase);
handshakeTimeout_.attachEventBase(eventBase);
}
virtual void detachEventBase() {
virtual void detachEventBase() override {
AsyncSocket::detachEventBase();
handshakeTimeout_.detachEventBase();
}
......@@ -654,21 +654,22 @@ class AsyncSSLSocket : public virtual AsyncSocket {
// Inherit event notification methods from AsyncSocket except
// the following.
void handleRead() noexcept;
void handleWrite() noexcept;
void handleRead() noexcept override;
void handleWrite() noexcept override;
void handleAccept() noexcept;
void handleConnect() noexcept;
void handleConnect() noexcept override;
void invalidState(HandshakeCB* callback);
bool willBlock(int ret, int *errorOut) noexcept;
virtual void checkForImmediateRead() noexcept;
virtual void checkForImmediateRead() noexcept override;
// AsyncSocket calls this at the wrong time for SSL
void handleInitialReadWrite() noexcept {}
void handleInitialReadWrite() noexcept override {}
ssize_t performRead(void* buf, size_t buflen);
ssize_t performRead(void* buf, size_t buflen) override;
ssize_t performWrite(const iovec* vec, uint32_t count, WriteFlags flags,
uint32_t* countWritten, uint32_t* partialWritten);
uint32_t* countWritten, uint32_t* partialWritten)
override;
// This virtual wrapper around SSL_write exists solely for testing/mockability
virtual int sslWriteImpl(SSL *ssl, const void *buf, int n) {
......
......@@ -186,7 +186,7 @@ class AsyncSocket : virtual public AsyncTransportWrapper {
* This prevents callers from deleting a AsyncSocket while it is invoking a
* callback.
*/
virtual void destroy();
virtual void destroy() override;
/**
* Get the EventBase used by this socket.
......
......@@ -454,7 +454,7 @@ class EventBase : private boost::noncopyable,
* first handler fired within that cycle.
*
*/
bool bumpHandlingTime();
bool bumpHandlingTime() override;
class SmoothLoopTime {
public:
......@@ -519,15 +519,16 @@ class EventBase : private boost::noncopyable,
// TimeoutManager
void attachTimeoutManager(AsyncTimeout* obj,
TimeoutManager::InternalEnum internal);
TimeoutManager::InternalEnum internal) override;
void detachTimeoutManager(AsyncTimeout* obj);
void detachTimeoutManager(AsyncTimeout* obj) override;
bool scheduleTimeout(AsyncTimeout* obj, std::chrono::milliseconds timeout);
bool scheduleTimeout(AsyncTimeout* obj, std::chrono::milliseconds timeout)
override;
void cancelTimeout(AsyncTimeout* obj);
void cancelTimeout(AsyncTimeout* obj) override;
bool isInTimeoutManagerThread() {
bool isInTimeoutManagerThread() override {
return isInEventBaseThread();
}
......
......@@ -139,7 +139,7 @@ public:
explicit IntException(int i)
: i_(i) {}
virtual int getInt() const { return i_; }
virtual int getInt() const override { return i_; }
virtual const char* what() const noexcept override {
what_ = folly::to<std::string>("int == ", i_);
return what_.c_str();
......
......@@ -89,7 +89,7 @@ class AsyncSocketHandler
return future;
};
folly::Future<void> close(Context* ctx) {
folly::Future<void> close(Context* ctx) override {
if (socket_) {
detachReadCallback();
socket_->closeNow();
......
......@@ -29,6 +29,11 @@ class MockChannelHandler : public ChannelHandler<Rin, Rout, Win, Wout> {
MockChannelHandler() = default;
MockChannelHandler(MockChannelHandler&&) = default;
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winconsistent-missing-override"
#endif
MOCK_METHOD2_T(read_, void(Context*, Rin&));
MOCK_METHOD1_T(readEOF, void(Context*));
MOCK_METHOD2_T(readException, void(Context*, exception_wrapper));
......@@ -41,7 +46,11 @@ class MockChannelHandler : public ChannelHandler<Rin, Rout, Win, Wout> {
MOCK_METHOD1_T(detachPipeline, void(Context*));
MOCK_METHOD1_T(detachTransport, void(Context*));
void read(Context* ctx, Rin msg) {
#ifdef __clang__
#pragma clang diagnostic pop
#endif
void read(Context* ctx, Rin msg) override {
read_(ctx, msg);
}
......
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