THRIFT-4762: Applied some C++11 refactorings to the runtime library and compiler (#1719)
* make use of C++11 override keyword
* added const specifier to TTransport::getOrigin()
* added more const correctness to the compiler
* make use of auto keyword
* replaced usage of NULL with nullptr
* make use of explicitly-defaulted function definition
* extended changelog
diff --git a/lib/cpp/test/TNonblockingServerTest.cpp b/lib/cpp/test/TNonblockingServerTest.cpp
index f2f5922..434217e 100644
--- a/lib/cpp/test/TNonblockingServerTest.cpp
+++ b/lib/cpp/test/TNonblockingServerTest.cpp
@@ -44,17 +44,17 @@
using namespace apache::thrift;
struct Handler : public test::ParentServiceIf {
- void addString(const std::string& s) { strings_.push_back(s); }
- void getStrings(std::vector<std::string>& _return) { _return = strings_; }
+ void addString(const std::string& s) override { strings_.push_back(s); }
+ void getStrings(std::vector<std::string>& _return) override { _return = strings_; }
std::vector<std::string> strings_;
// dummy overrides not used in this test
- int32_t incrementGeneration() { return 0; }
- int32_t getGeneration() { return 0; }
- void getDataWait(std::string&, const int32_t) {}
- void onewayWait() {}
- void exceptionWait(const std::string&) {}
- void unexpectedExceptionWait(const std::string&) {}
+ int32_t incrementGeneration() override { return 0; }
+ int32_t getGeneration() override { return 0; }
+ void getDataWait(std::string&, const int32_t) override {}
+ void onewayWait() override {}
+ void exceptionWait(const std::string&) override {}
+ void unexpectedExceptionWait(const std::string&) override {}
};
class Fixture {
@@ -63,7 +63,7 @@
public:
ListenEventHandler(Mutex* mutex) : listenMonitor_(mutex), ready_(false) {}
- void preServe() /* override */ {
+ void preServe() override /* override */ {
Guard g(listenMonitor_.mutex());
ready_ = true;
listenMonitor_.notify();
@@ -86,7 +86,7 @@
listenHandler.reset(new ListenEventHandler(&mutex_));
}
- virtual void run() {
+ void run() override {
// When binding to explicit port, allow retrying to workaround bind failures on ports in use
int retryCount = port ? 10 : 0;
startServer(retryCount);