diff options
62 files changed, 312 insertions, 349 deletions
diff --git a/fastos/src/tests/backtracetest.cpp b/fastos/src/tests/backtracetest.cpp index 31aa602070a..6c5d12d1366 100644 --- a/fastos/src/tests/backtracetest.cpp +++ b/fastos/src/tests/backtracetest.cpp @@ -1,5 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> + #include <vespa/fastos/backtrace.h> #include <assert.h> #include <string.h> @@ -63,16 +63,16 @@ public: class Tracker2: public Tracker { protected: - virtual void deepFill20(); - virtual void deepFill18(); - virtual void deepFill16(); - virtual void deepFill14(); - virtual void deepFill12(); - virtual void deepFill10(); - virtual void deepFill8(); - virtual void deepFill6(); - virtual void deepFill4(); - virtual void deepFill2(); + void deepFill20() override; + void deepFill18() override; + void deepFill16() override; + void deepFill14() override; + void deepFill12() override; + void deepFill10() override; + void deepFill8() override; + void deepFill6() override; + void deepFill4() override; + void deepFill2() override; }; @@ -104,7 +104,7 @@ public: PrintSeparator(); } - int Main () + int Main () override { TestBackTrace(); return allWasOk() ? 0 : 1; diff --git a/fastos/src/tests/filetest.cpp b/fastos/src/tests/filetest.cpp index dcd1b224464..4e2e9c44cd2 100644 --- a/fastos/src/tests/filetest.cpp +++ b/fastos/src/tests/filetest.cpp @@ -1,7 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <memory> -#include <vespa/fastos/fastos.h> + #include "tests.h" +#include <vespa/fastos/file.h> +#include <memory> namespace { @@ -39,7 +40,7 @@ bool createFile(const char* fileName, class FileTest : public BaseTest { private: - virtual bool useProcessStarter() const { return true; } + virtual bool useProcessStarter() const override { return true; } public: const std::string srcDir = getenv("SOURCE_DIRECTORY") ? getenv("SOURCE_DIRECTORY") : "."; const std::string roFilename = srcDir + "/hello.txt"; @@ -792,7 +793,7 @@ public: PrintSeparator(); } - int Main () + int Main () override { printf("This test should be run in the 'tests' directory.\n\n"); printf("grep for the string '%s' to detect failures.\n\n", failString); diff --git a/fastos/src/tests/prefetchtest.cpp b/fastos/src/tests/prefetchtest.cpp index bd86f091f09..5749ef2ae54 100644 --- a/fastos/src/tests/prefetchtest.cpp +++ b/fastos/src/tests/prefetchtest.cpp @@ -142,7 +142,7 @@ public: return rc; } - int Main () + int Main () override { int rc = 1; printf("grep for the string '%s' to detect failures.\n\n", failString); diff --git a/fastos/src/tests/processtest.cpp b/fastos/src/tests/processtest.cpp index 0e1573dbe2e..a4b1e38b03b 100644 --- a/fastos/src/tests/processtest.cpp +++ b/fastos/src/tests/processtest.cpp @@ -42,7 +42,7 @@ public: _counterLock->Unlock(); } - void OnReceiveData (const void *data, size_t length) + void OnReceiveData (const void *data, size_t length) override { _receivedBytes += length; if(data != NULL) @@ -78,7 +78,7 @@ public: { } - void Run (FastOS_ThreadInterface *thisThread, void *arg) + void Run (FastOS_ThreadInterface *thisThread, void *arg) override { (void)thisThread; (void)arg; @@ -110,15 +110,11 @@ public: class ProcessTest : public BaseTest { private: - virtual bool useProcessStarter() const { return true; } - virtual bool useIPCHelper() const { return true; } - ProcessTest(const ProcessTest&); - ProcessTest& operator=(const ProcessTest&); - - int GetLastError () - { - return errno; - } + bool useProcessStarter() const override { return true; } + bool useIPCHelper() const override { return true; } + ProcessTest(const ProcessTest&); + ProcessTest& operator=(const ProcessTest&); + int GetLastError () const { return errno; } // Flag which indicates whether an IPC message is received // or not. @@ -135,7 +131,7 @@ public: { } - void OnReceivedIPCMessage (const void *data, size_t length) + void OnReceivedIPCMessage (const void *data, size_t length) override { // printf("Data: [%s]\n", static_cast<const char *>(data)); @@ -441,7 +437,7 @@ public: PrintSeparator(); } - int Main () + int Main () override { // This process is started as either a parent or a child. // When the parent role is desired, a child program is supplied diff --git a/fastos/src/tests/sockettest.cpp b/fastos/src/tests/sockettest.cpp index ad82be32312..9a655548d97 100644 --- a/fastos/src/tests/sockettest.cpp +++ b/fastos/src/tests/sockettest.cpp @@ -1,11 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <assert.h> -#include <string.h> -#include <sstream> #include "tests.h" - +#include <vespa/fastos/file.h> +#include <vespa/fastos/serversocket.h> #define MAZE_FILE_OFFSET 1078 @@ -877,7 +874,7 @@ public: PrintSeparator(); } - int Main () + int Main () override { printf("This test should be run in the 'test/workarea' directory.\n\n"); printf("grep for the string '%s' to detect failures.\n\n", failString); diff --git a/fastos/src/tests/tests.h b/fastos/src/tests/tests.h index c443a9fb137..cc54e66292f 100644 --- a/fastos/src/tests/tests.h +++ b/fastos/src/tests/tests.h @@ -1,8 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <stdio.h> -#include <string.h> #include <vespa/fastos/app.h> +#include <vespa/fastos/socket.h> class BaseTest : public FastOS_Application { diff --git a/fastos/src/tests/thread_bounce_test.cpp b/fastos/src/tests/thread_bounce_test.cpp index c3a2673407a..4360fe5b068 100644 --- a/fastos/src/tests/thread_bounce_test.cpp +++ b/fastos/src/tests/thread_bounce_test.cpp @@ -1,14 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <stdlib.h> -#include <vespa/fastos/fastos.h> #include "tests.h" #include "job.h" #include "thread_test_base.hpp" +#include <vespa/fastos/time.h> class Thread_Bounce_Test : public ThreadTestBase { - int Main (); + int Main () override; void BounceTest(void) { diff --git a/fastos/src/tests/thread_joinwait_test.cpp b/fastos/src/tests/thread_joinwait_test.cpp index e1037bec84b..3532b0c4f0c 100644 --- a/fastos/src/tests/thread_joinwait_test.cpp +++ b/fastos/src/tests/thread_joinwait_test.cpp @@ -1,14 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <stdlib.h> -#include <vespa/fastos/fastos.h> #include "tests.h" #include "job.h" #include "thread_test_base.hpp" class Thread_JoinWait_Test : public ThreadTestBase { - int Main (); + int Main () override; void SingleThreadJoinWaitMultipleTest(int variant) { diff --git a/fastos/src/tests/thread_mutex_test.cpp b/fastos/src/tests/thread_mutex_test.cpp index aee06728406..15323c7029b 100644 --- a/fastos/src/tests/thread_mutex_test.cpp +++ b/fastos/src/tests/thread_mutex_test.cpp @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <stdlib.h> -#include <vespa/fastos/fastos.h> #include "tests.h" #include "job.h" #include "thread_test_base.hpp" @@ -11,7 +9,7 @@ class Thread_Mutex_Test : public ThreadTestBase { - int Main (); + int Main () override; void MutexTest (bool usingMutex) { diff --git a/fastos/src/tests/thread_sleep_test.cpp b/fastos/src/tests/thread_sleep_test.cpp index f08eaa404be..dd13e777958 100644 --- a/fastos/src/tests/thread_sleep_test.cpp +++ b/fastos/src/tests/thread_sleep_test.cpp @@ -1,14 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <stdlib.h> -#include <vespa/fastos/fastos.h> #include "tests.h" #include "job.h" #include "thread_test_base.hpp" class Thread_Sleep_Test : public ThreadTestBase { - int Main (); + int Main () override; void CreateSingleThread () { diff --git a/fastos/src/tests/thread_stats_test.cpp b/fastos/src/tests/thread_stats_test.cpp index f6993244d51..7628fb28169 100644 --- a/fastos/src/tests/thread_stats_test.cpp +++ b/fastos/src/tests/thread_stats_test.cpp @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <stdlib.h> -#include <vespa/fastos/fastos.h> #include "tests.h" #include "job.h" #include "thread_test_base.hpp" @@ -115,7 +113,7 @@ class Thread_Stats_Test : public ThreadTestBase PrintSeparator(); } - int Main (); + int Main () override; }; int Thread_Stats_Test::Main () diff --git a/fastos/src/tests/thread_test_base.hpp b/fastos/src/tests/thread_test_base.hpp index 7c8d02cb9ab..b95f3021119 100644 --- a/fastos/src/tests/thread_test_base.hpp +++ b/fastos/src/tests/thread_test_base.hpp @@ -17,14 +17,14 @@ public: } virtual ~ThreadTestBase() {}; - void PrintProgress (char *string) + void PrintProgress (char *string) override { printMutex.Lock(); BaseTest::PrintProgress(string); printMutex.Unlock(); } - void Run (FastOS_ThreadInterface *thread, void *arg); + void Run (FastOS_ThreadInterface *thread, void *arg) override; void WaitForThreadsToFinish (Job *jobs, int count) { diff --git a/fastos/src/tests/threadtest.cpp b/fastos/src/tests/threadtest.cpp index 116cea4cfd4..034af304e6e 100644 --- a/fastos/src/tests/threadtest.cpp +++ b/fastos/src/tests/threadtest.cpp @@ -1,11 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <stdlib.h> -#include <vespa/fastos/fastos.h> #include "tests.h" #include "job.h" #include "thread_test_base.hpp" - +#include <vespa/fastos/time.h> +#include <cstdlib> #define MUTEX_TEST_THREADS 6 #define MAX_THREADS 7 @@ -13,7 +12,7 @@ class ThreadTest : public ThreadTestBase { - int Main (); + int Main () override; void WaitForXThreadsToHaveWait (Job *jobs, int jobCount, diff --git a/fastos/src/tests/timetest.cpp b/fastos/src/tests/timetest.cpp index b63ebf7fa02..9989da1e2fc 100644 --- a/fastos/src/tests/timetest.cpp +++ b/fastos/src/tests/timetest.cpp @@ -1,9 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <stdlib.h> -#include <cmath> -#include <vespa/fastos/fastos.h> #include "tests.h" +#include <vespa/fastos/time.h> +#include <cmath> using namespace fastos; @@ -268,7 +267,7 @@ public: } - int Main (); + int Main () override; }; int TimeTest::Main () diff --git a/fastos/src/tests/typetest.cpp b/fastos/src/tests/typetest.cpp index 6db029a41f1..60a05f67151 100644 --- a/fastos/src/tests/typetest.cpp +++ b/fastos/src/tests/typetest.cpp @@ -68,7 +68,7 @@ private: public: virtual ~TypeTest() {}; - int Main () + int Main () override { printf("grep for the string '%s' to detect failures.\n\n", failString); diff --git a/fastos/src/tests/usecputest.cpp b/fastos/src/tests/usecputest.cpp index 3ddc46aaa7e..d6215af2d62 100644 --- a/fastos/src/tests/usecputest.cpp +++ b/fastos/src/tests/usecputest.cpp @@ -1,6 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> + #include "tests.h" +#include <vespa/fastos/time.h> class ThreadRunJob; void UseSomeCpu(int i, ThreadRunJob *threadRunJob); @@ -14,7 +15,7 @@ public: someNumber * someNumber * someNumber; } - void Run (FastOS_ThreadInterface *thisThread, void *arg) + void Run (FastOS_ThreadInterface *thisThread, void *arg) override { (void)thisThread; (void)arg; @@ -40,7 +41,7 @@ public: class UseCpuTest : public BaseTest { public: - int Main () + int Main () override { FastOS_ThreadPool pool(128*1024); pool.NewThread(new ThreadRunJob()); diff --git a/fastos/src/vespa/fastos/file.h b/fastos/src/vespa/fastos/file.h index 2dfbcb3eb5a..9d879db4b3e 100644 --- a/fastos/src/vespa/fastos/file.h +++ b/fastos/src/vespa/fastos/file.h @@ -66,7 +66,7 @@ class DirectIOException : public std::exception { public: DirectIOException(const char * fileName, const void * buffer, size_t length, int64_t offset); - virtual const char* what() const noexcept { return _what.c_str(); } + const char* what() const noexcept override { return _what.c_str(); } const void * getBuffer() const { return _buffer; } size_t getLength() const { return _length; } int64_t getOffset() const { return _offset; } diff --git a/fastos/src/vespa/fastos/unix_app.h b/fastos/src/vespa/fastos/unix_app.h index 6b0caac41e4..a6521c22302 100644 --- a/fastos/src/vespa/fastos/unix_app.h +++ b/fastos/src/vespa/fastos/unix_app.h @@ -29,7 +29,7 @@ private: FastOS_UNIX_IPCHelper *_ipcHelper; protected: - virtual bool PreThreadInit (); + bool PreThreadInit () override; public: FastOS_UNIX_Application (); virtual ~FastOS_UNIX_Application(); @@ -66,11 +66,10 @@ public: static unsigned int GetCurrentProcessId (); FastOS_UNIX_ProcessStarter *GetProcessStarter (); - virtual bool Init (); - virtual void Cleanup (); - bool SendParentIPCMessage (const void *data, size_t length); - bool SendIPCMessage (FastOS_UNIX_Process *xproc, const void *buffer, - int length); + bool Init () override; + void Cleanup () override; + bool SendParentIPCMessage (const void *data, size_t length) override; + bool SendIPCMessage (FastOS_UNIX_Process *xproc, const void *buffer, int length); void AddToIPCComm (FastOS_UNIX_Process *process); void RemoveFromIPCComm (FastOS_UNIX_Process *process); }; diff --git a/fastos/src/vespa/fastos/unix_cond.h b/fastos/src/vespa/fastos/unix_cond.h index 1f4ef336d93..c6325efed31 100644 --- a/fastos/src/vespa/fastos/unix_cond.h +++ b/fastos/src/vespa/fastos/unix_cond.h @@ -20,20 +20,20 @@ private: pthread_cond_t _cond; public: - FastOS_UNIX_Cond (void); + FastOS_UNIX_Cond (); - ~FastOS_UNIX_Cond(void); + ~FastOS_UNIX_Cond(); - void Wait(void); + void Wait() override; - bool TimedWait(int milliseconds); + bool TimedWait(int milliseconds) override; - void Signal(void) + void Signal() override { pthread_cond_signal(&_cond); } - void Broadcast(void) + void Broadcast() override { pthread_cond_broadcast(&_cond); } diff --git a/fastos/src/vespa/fastos/unix_dynamiclibrary.h b/fastos/src/vespa/fastos/unix_dynamiclibrary.h index 7972a6c98fb..cf0b39e6abf 100644 --- a/fastos/src/vespa/fastos/unix_dynamiclibrary.h +++ b/fastos/src/vespa/fastos/unix_dynamiclibrary.h @@ -29,12 +29,12 @@ public: void SetLibName(const char *libname); bool NormalizeLibName(void); - bool Close(); - bool Open(const char *libname = NULL); - void * GetSymbol(const char *symbol) const; + bool Close() override; + bool Open(const char *libname = NULL) override; + void * GetSymbol(const char *symbol) const override; std::string GetLastErrorString() const; const char * GetLibName() const { return _libname.c_str(); } - bool IsOpen() const { return (_handle != NULL); } + bool IsOpen() const override { return (_handle != NULL); } }; diff --git a/fastos/src/vespa/fastos/unix_file.h b/fastos/src/vespa/fastos/unix_file.h index 56c4ed87840..d15530cfcde 100644 --- a/fastos/src/vespa/fastos/unix_file.h +++ b/fastos/src/vespa/fastos/unix_file.h @@ -33,7 +33,7 @@ protected: public: static bool Rename (const char *currentFileName, const char *newFileName); - bool Rename (const char *newFileName) { + bool Rename (const char *newFileName) override { return FastOS_FileInterface::Rename(newFileName); } diff --git a/fastos/src/vespa/fastos/unix_mutex.h b/fastos/src/vespa/fastos/unix_mutex.h index ccf8af9d4ea..7daf01575bb 100644 --- a/fastos/src/vespa/fastos/unix_mutex.h +++ b/fastos/src/vespa/fastos/unix_mutex.h @@ -24,19 +24,19 @@ protected: pthread_mutex_t _mutex; public: - FastOS_UNIX_Mutex(void); + FastOS_UNIX_Mutex(); - ~FastOS_UNIX_Mutex(void); + ~FastOS_UNIX_Mutex(); - bool TryLock (void) { + bool TryLock () override { return pthread_mutex_trylock(&_mutex) == 0; } - void Lock(void) { + void Lock() override { pthread_mutex_lock(&_mutex); } - void Unlock(void) { + void Unlock() override { pthread_mutex_unlock(&_mutex); } }; diff --git a/fastos/src/vespa/fastos/unix_process.h b/fastos/src/vespa/fastos/unix_process.h index 0629ff60af3..e06df03dd3d 100644 --- a/fastos/src/vespa/fastos/unix_process.h +++ b/fastos/src/vespa/fastos/unix_process.h @@ -147,18 +147,18 @@ public: int bufferSize = 65535); ~FastOS_UNIX_Process (); bool CreateInternal (bool useShell); - bool Create () { return CreateInternal(false); } - bool CreateWithShell () { return CreateInternal(true); } - bool WriteStdin (const void *data, size_t length); + bool Create () override { return CreateInternal(false); } + bool CreateWithShell () override { return CreateInternal(true); } + bool WriteStdin (const void *data, size_t length) override; bool Signal(int sig); - bool Kill (); - bool WrapperKill (); - bool Wait (int *returnCode, int timeOutSeconds = -1); - bool PollWait (int *returnCode, bool *stillRunning); - bool Detach(void); + bool Kill () override; + bool WrapperKill () override; + bool Wait (int *returnCode, int timeOutSeconds = -1) override; + bool PollWait (int *returnCode, bool *stillRunning) override; + bool Detach() override; void SetProcessId (unsigned int pid) { _pid = pid; } - unsigned int GetProcessId() { return _pid; } - bool SendIPCMessage (const void *data, size_t length); + unsigned int GetProcessId() override { return _pid; } + bool SendIPCMessage (const void *data, size_t length) override; void DeathNotification (int returnCode) { _returnCode = returnCode; @@ -205,24 +205,16 @@ public: return _stderrListener; } bool GetKillFlag () {return _killed; } - virtual bool GetDirectChild(void) const - { - return _directChild; - } + bool GetDirectChild() const override { return _directChild; } - virtual bool SetDirectChild(void) - { + bool SetDirectChild() override { _directChild = true; return true; } - virtual bool GetKeepOpenFilesIfDirectChild(void) const - { - return _keepOpenFilesIfDirectChild; - } + bool GetKeepOpenFilesIfDirectChild() const override { return _keepOpenFilesIfDirectChild; } - virtual bool SetKeepOpenFilesIfDirectChild(void) - { + bool SetKeepOpenFilesIfDirectChild() override { _keepOpenFilesIfDirectChild = true; return true; } diff --git a/fastos/src/vespa/fastos/unix_socket.h b/fastos/src/vespa/fastos/unix_socket.h index e269d926ed6..9905e00f9cf 100644 --- a/fastos/src/vespa/fastos/unix_socket.h +++ b/fastos/src/vespa/fastos/unix_socket.h @@ -9,9 +9,9 @@ class FastOS_UNIX_Socket : public FastOS_SocketInterface public: ~FastOS_UNIX_Socket(); - bool Close (); - bool Shutdown(); - bool SetSoBlocking (bool blockingEnabled); + bool Close () override; + bool Shutdown() override; + bool SetSoBlocking (bool blockingEnabled) override; ssize_t Read (void *readBuffer, size_t bufferSize) override; ssize_t Write (const void *writeBuffer, size_t bufferSize) override; diff --git a/fastos/src/vespa/fastos/unix_thread.h b/fastos/src/vespa/fastos/unix_thread.h index 594865d4e39..439ad3482bf 100644 --- a/fastos/src/vespa/fastos/unix_thread.h +++ b/fastos/src/vespa/fastos/unix_thread.h @@ -21,8 +21,8 @@ protected: pthread_t _handle; bool _handleValid; - bool Initialize (int stackSize, int stackGuardSize); - void PreEntry (); + bool Initialize (int stackSize, int stackGuardSize) override; + void PreEntry () override; public: static bool InitializeClass (); @@ -34,7 +34,7 @@ public: _handleValid(false) {} - virtual ~FastOS_UNIX_Thread(void); + ~FastOS_UNIX_Thread(); static bool Sleep (int ms) { @@ -48,7 +48,7 @@ public: return rc; } - FastOS_ThreadId GetThreadId (); + FastOS_ThreadId GetThreadId () override; static bool CompareThreadIds (FastOS_ThreadId a, FastOS_ThreadId b); static FastOS_ThreadId GetCurrentThreadId (); diff --git a/fastos/src/vespa/fastos/unix_time.h b/fastos/src/vespa/fastos/unix_time.h index a0b7054e121..dd6122bc463 100644 --- a/fastos/src/vespa/fastos/unix_time.h +++ b/fastos/src/vespa/fastos/unix_time.h @@ -43,7 +43,7 @@ private: timeval _time; public: - void SetZero() { _time.tv_sec = 0; _time.tv_usec = 0; } + void SetZero() override { _time.tv_sec = 0; _time.tv_usec = 0; } FastOS_UNIX_Time () : _time() @@ -81,17 +81,17 @@ public: return FASTOS_UNIX_TIMER_CMP(&_time, &rhs._time, ==); } - double MicroSecs() const; - double MilliSecs() const; - double Secs() const; + double MicroSecs() const override; + double MilliSecs() const override; + double Secs() const override; - void SetMicroSecs(double microsecs); - void SetMilliSecs(double millisecs); - void SetSecs(double secs); + void SetMicroSecs(double microsecs) override; + void SetMilliSecs(double millisecs) override; + void SetSecs(double secs) override; - void SetNow() { gettimeofday(&_time, NULL); } + void SetNow() override { gettimeofday(&_time, NULL); } - long int GetSeconds() const { return _time.tv_sec; } - long int GetMicroSeconds() const { return _time.tv_usec; } + long int GetSeconds() const override { return _time.tv_sec; } + long int GetMicroSeconds() const override { return _time.tv_usec; } }; diff --git a/fbench/src/httpclient/httpclient.h b/fbench/src/httpclient/httpclient.h index e69a10346cd..831ff83651d 100644 --- a/fbench/src/httpclient/httpclient.h +++ b/fbench/src/httpclient/httpclient.h @@ -53,9 +53,8 @@ protected: static ConnCloseReader _instance; public: ConnCloseReader() {} - virtual ~ConnCloseReader() {} static ReaderInterface *GetInstance() { return &_instance; } - ssize_t Read(HTTPClient &client, void *buf, size_t len); + ssize_t Read(HTTPClient &client, void *buf, size_t len) override; }; friend class HTTPClient::ConnCloseReader; @@ -69,9 +68,8 @@ protected: static ContentLengthReader _instance; public: ContentLengthReader() {} - virtual ~ContentLengthReader() {} static ReaderInterface *GetInstance() { return &_instance; } - ssize_t Read(HTTPClient &client, void *buf, size_t len); + ssize_t Read(HTTPClient &client, void *buf, size_t len) override; }; friend class HTTPClient::ContentLengthReader; @@ -85,9 +83,8 @@ protected: static ChunkedReader _instance; public: ChunkedReader() {} - virtual ~ChunkedReader() {} static ReaderInterface *GetInstance() { return &_instance; } - ssize_t Read(HTTPClient &client, void *buf, size_t len); + ssize_t Read(HTTPClient &client, void *buf, size_t len) override; }; friend class HTTPClient::ChunkedReader; diff --git a/fsa/src/alltest/detector_test.cpp b/fsa/src/alltest/detector_test.cpp index 1942c4ba7a6..35307b9054e 100644 --- a/fsa/src/alltest/detector_test.cpp +++ b/fsa/src/alltest/detector_test.cpp @@ -10,11 +10,9 @@ #include <iostream> #include <iomanip> -#include <string> #include <vespa/fsa/fsa.h> #include <vespa/fsa/detector.h> -#include <vespa/fsa/ngram.h> using namespace fsa; @@ -25,7 +23,7 @@ public: void add(const NGram &text, unsigned int from, int length, - const FSA::State &) + const FSA::State &) override { std::cout << "detected: [" << from << "," << from+length-1 << "], '" << text.join(" ",from,length) << "'\n"; diff --git a/fsa/src/vespa/fsa/fsa.h b/fsa/src/vespa/fsa/fsa.h index a508b1eb0f4..8bed0b5f8ba 100644 --- a/fsa/src/vespa/fsa/fsa.h +++ b/fsa/src/vespa/fsa/fsa.h @@ -811,7 +811,7 @@ public: * * @return True if the resulting state is valid. */ - virtual bool start() + bool start() override { _hash = 0; return State::start(); @@ -825,7 +825,7 @@ public: * @param in Input symbol. * @return True if the resulting state is valid. */ - virtual bool delta(symbol_t in) + bool delta(symbol_t in) override { _hash += _fsa->hashDelta(_state,in); return State::delta(in); @@ -842,7 +842,7 @@ public: * * @return Hash value. */ - virtual hash_t hash() const + hash_t hash() const override { return _hash; } @@ -958,7 +958,7 @@ public: * * @return True if the resulting state is valid. */ - virtual bool start() + bool start() override { _counter = 0; return State::start(); @@ -972,7 +972,7 @@ public: * @param in Input symbol. * @return True if the resulting state is valid. */ - virtual bool delta(symbol_t in) + bool delta(symbol_t in) override { bool ok = State::delta(in); if(ok) @@ -1075,7 +1075,7 @@ public: * * @return True if the resulting state is valid. */ - virtual bool start() + bool start() override { _counter = 0; return State::start(); @@ -1090,7 +1090,7 @@ public: * @param in Input word. * @return True if the resulting state is valid. */ - virtual bool startWord(const std::string &in) + bool startWord(const std::string &in) override { start(); return deltaWord(in); @@ -1106,7 +1106,7 @@ public: * @param in Input word. * @return True if the resulting state is valid. */ - virtual bool deltaWord(const std::string &in) + bool deltaWord(const std::string &in) override { if(in.length()==0){ return _state!=0; @@ -1275,7 +1275,7 @@ public: * * @return True if the resulting state is valid. */ - virtual bool start() + bool start() override { #if ((__GNUG__ == 3 && __GNUC_MINOR__ >= 1) || __GNUG__ > 3) _memory.clear(); @@ -1293,7 +1293,7 @@ public: * @param in Input symbol. * @return True if the resulting state is valid. */ - virtual bool delta(symbol_t in) + bool delta(symbol_t in) override { bool ok = State::delta(in); if(ok) @@ -1460,7 +1460,7 @@ public: * * @return True if the resulting state is valid. */ - virtual bool start() + bool start() override { _hash = 0; #if ((__GNUG__ == 3 && __GNUC_MINOR__ >= 1) || __GNUG__ > 3) @@ -1479,7 +1479,7 @@ public: * @param in Input symbol. * @return True if the resulting state is valid. */ - virtual bool delta(symbol_t in) + bool delta(symbol_t in) override { _hash += _fsa->hashDelta(_state,in); bool ok = State::delta(in); @@ -1499,7 +1499,7 @@ public: * * @return Hash value. */ - virtual hash_t hash() const + hash_t hash() const override { return _hash; } @@ -1641,7 +1641,7 @@ public: * * @return True if the resulting state is valid. */ - virtual bool start() + bool start() override { _hash = 0; _counter = 0; @@ -1657,7 +1657,7 @@ public: * @param in Input symbol. * @return True if the resulting state is valid. */ - virtual bool delta(symbol_t in) + bool delta(symbol_t in) override { _hash += _fsa->hashDelta(_state,in); bool ok = State::delta(in); @@ -1677,7 +1677,7 @@ public: * * @return Hash value. */ - virtual hash_t hash() const + hash_t hash() const override { return _hash; } @@ -1780,7 +1780,7 @@ public: * @param in Input symbol. * @return True if the resulting state is valid. */ - virtual bool delta(symbol_t in) + bool delta(symbol_t in) override { _hash += _fsa->hashDelta(_state,in); bool ok = State::delta(in); @@ -1830,7 +1830,7 @@ public: * * @return True if the resulting state is valid. */ - virtual bool start() + bool start() override { _hash = 0; _counter = 0; @@ -1846,7 +1846,7 @@ public: * @param in Input word. * @return True if the resulting state is valid. */ - virtual bool startWord(const std::string &in) + bool startWord(const std::string &in) override { start(); return deltaWord(in); @@ -1862,7 +1862,7 @@ public: * @param in Input word. * @return True if the resulting state is valid. */ - virtual bool deltaWord(const std::string &in) + bool deltaWord(const std::string &in) override { if(in.length()==0){ return _state!=0; @@ -1886,7 +1886,7 @@ public: * * @return Hash value. */ - virtual hash_t hash() const + hash_t hash() const override { return _hash; } diff --git a/fsa/src/vespa/fsa/segmenter.h b/fsa/src/vespa/fsa/segmenter.h index 243629bbaa8..f40f27f522b 100644 --- a/fsa/src/vespa/fsa/segmenter.h +++ b/fsa/src/vespa/fsa/segmenter.h @@ -437,7 +437,7 @@ public: */ void add(const NGram &text, unsigned int from, int length, - const FSA::State &state) + const FSA::State &state) override { (void)text; unsigned int to=from+length; diff --git a/fsa/src/vespa/fsa/vectorizer.h b/fsa/src/vespa/fsa/vectorizer.h index 9e8856191da..21b855e186f 100644 --- a/fsa/src/vespa/fsa/vectorizer.h +++ b/fsa/src/vespa/fsa/vectorizer.h @@ -496,7 +496,7 @@ private: */ void add(const NGram &text, unsigned int from, int length, - const FSA::State &state) + const FSA::State &state) override { ItemMap::iterator pos; std::string str = text.join(" ",from,length); diff --git a/fsa/src/vespa/fsa/wordchartokenizer.h b/fsa/src/vespa/fsa/wordchartokenizer.h index c66c727207f..a23dfb9e7f5 100644 --- a/fsa/src/vespa/fsa/wordchartokenizer.h +++ b/fsa/src/vespa/fsa/wordchartokenizer.h @@ -84,7 +84,7 @@ public: * @param text Input text. * @return True on success. */ - virtual bool init(const std::string &text); + bool init(const std::string &text) override; /** @@ -92,14 +92,14 @@ public: * * @return True if there are more tokens. */ - virtual bool hasMore(); + bool hasMore() override; /** * @brief Get next token. * * @return Next token, or empty string if there are no more tokens left. */ - virtual std::string getNext(); + std::string getNext() override; }; diff --git a/vespalib/src/tests/atomic/atomic_bench.cpp b/vespalib/src/tests/atomic/atomic_bench.cpp index 499af1daa65..003ef25ba45 100644 --- a/vespalib/src/tests/atomic/atomic_bench.cpp +++ b/vespalib/src/tests/atomic/atomic_bench.cpp @@ -1,20 +1,20 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("atomic_bench"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/atomic.h> #include <vector> #include <algorithm> #include <sstream> +#include <vespa/log/log.h> +LOG_SETUP("atomic_bench"); class Test : public vespalib::TestApp { public: template<typename C, typename T> void testInc(size_t threads, size_t loops); - int Main(); + int Main() override; }; template <typename T> @@ -33,7 +33,7 @@ class Incrementer : public Changer<T> { public: Incrementer(int times, T *data) : Changer<T>(times, data) {} - void Run(FastOS_ThreadInterface *, void *) { + void Run(FastOS_ThreadInterface *, void *) override { using vespalib::Atomic; for (int i = 0; i < this->_times; ++i) { Atomic::postInc(this->_idata); @@ -46,7 +46,7 @@ class IncrementerByCmpSwap : public Changer<T> { public: IncrementerByCmpSwap(int times, T *data) : Changer<T>(times, data) {} - void Run(FastOS_ThreadInterface *, void *) { + void Run(FastOS_ThreadInterface *, void *) override { using vespalib::Atomic; T oldVal(0); for (int i = 0; i < this->_times; ++i) { diff --git a/vespalib/src/tests/zcurve/zcurve_test.cpp b/vespalib/src/tests/zcurve/zcurve_test.cpp index e4a5d02d68e..41bccf23ccf 100644 --- a/vespalib/src/tests/zcurve/zcurve_test.cpp +++ b/vespalib/src/tests/zcurve/zcurve_test.cpp @@ -48,9 +48,9 @@ public: bm3(void); int64_t - bmcheck(void); + bmcheck(); - int Main(void); + int Main() override; }; diff --git a/vespalib/src/vespa/vespalib/data/slime/array_value.h b/vespalib/src/vespa/vespalib/data/slime/array_value.h index 6d5178c39c3..bd78522b207 100644 --- a/vespalib/src/vespa/vespalib/data/slime/array_value.h +++ b/vespalib/src/vespa/vespalib/data/slime/array_value.h @@ -24,7 +24,7 @@ private: std::vector<Value*> _values; protected: - virtual Cursor &addLeaf(const ValueFactory &input) { + Cursor &addLeaf(const ValueFactory &input) override { Value *value = input.create(_stash); _values.push_back(value); return *value; @@ -35,23 +35,23 @@ public: ArrayValue(const ArrayValue &) = delete; ArrayValue &operator=(const ArrayValue &) = delete; - virtual Type type() const { return ARRAY::instance; } - virtual size_t children() const { return _values.size(); } - virtual size_t entries() const { return _values.size(); } - virtual void traverse(ArrayTraverser &at) const; + Type type() const override { return ARRAY::instance; } + size_t children() const override { return _values.size(); } + size_t entries() const override { return _values.size(); } + void traverse(ArrayTraverser &at) const override; - virtual Cursor &operator[](size_t idx) const { + Cursor &operator[](size_t idx) const override { if (idx < _values.size()) { return *_values[idx]; } return *NixValue::invalid(); } - virtual Cursor &addArray(); - virtual Cursor &addObject(); - virtual Symbol resolve(Memory symbol_name); + Cursor &addArray() override; + Cursor &addObject() override; + Symbol resolve(Memory symbol_name) override; - virtual ~ArrayValue() { } + ~ArrayValue() { } }; } // namespace vespalib::slime diff --git a/vespalib/src/vespa/vespalib/data/slime/basic_value.h b/vespalib/src/vespa/vespalib/data/slime/basic_value.h index 67d5655a6a9..8944acd986c 100644 --- a/vespalib/src/vespa/vespalib/data/slime/basic_value.h +++ b/vespalib/src/vespa/vespalib/data/slime/basic_value.h @@ -17,26 +17,26 @@ class BasicBoolValue : public Value { bool _value; public: BasicBoolValue(bool bit) : _value(bit) {} - virtual bool asBool() const { return _value; } - virtual Type type() const { return BOOL::instance; } + bool asBool() const override { return _value; } + Type type() const override { return BOOL::instance; } }; class BasicLongValue : public Value { int64_t _value; public: BasicLongValue(int64_t l) : _value(l) {} - virtual int64_t asLong() const { return _value; } - virtual double asDouble() const { return _value; } - virtual Type type() const { return LONG::instance; } + int64_t asLong() const override { return _value; } + double asDouble() const override { return _value; } + Type type() const override { return LONG::instance; } }; class BasicDoubleValue : public Value { double _value; public: BasicDoubleValue(double d) : _value(d) {} - virtual double asDouble() const { return _value; } - virtual int64_t asLong() const { return _value; } - virtual Type type() const { return DOUBLE::instance; } + double asDouble() const override { return _value; } + int64_t asLong() const override { return _value; } + Type type() const override { return DOUBLE::instance; } }; class BasicStringValue : public Value { @@ -45,8 +45,8 @@ public: BasicStringValue(Memory str, Stash & stash); BasicStringValue(const BasicStringValue &) = delete; BasicStringValue & operator = (const BasicStringValue &) = delete; - virtual Memory asString() const { return _value; } - virtual Type type() const { return STRING::instance; } + Memory asString() const override { return _value; } + Type type() const override { return STRING::instance; } }; class BasicDataValue : public Value { @@ -55,8 +55,8 @@ public: BasicDataValue(Memory data, Stash & stash); BasicDataValue(const BasicDataValue &) = delete; BasicDataValue & operator = (const BasicDataValue &) = delete; - virtual Memory asData() const { return _value; } - virtual Type type() const { return DATA::instance; } + Memory asData() const override { return _value; } + Type type() const override { return DATA::instance; } }; } // namespace vespalib::slime diff --git a/vespalib/src/vespa/vespalib/data/slime/binary_format.cpp b/vespalib/src/vespa/vespalib/data/slime/binary_format.cpp index 33694006a3b..2b7460933cf 100644 --- a/vespalib/src/vespa/vespalib/data/slime/binary_format.cpp +++ b/vespalib/src/vespa/vespalib/data/slime/binary_format.cpp @@ -68,8 +68,8 @@ struct BinaryEncoder : public ArrayTraverser, out.write(image.data, image.size); } } - virtual void entry(size_t, const Inspector &inspector); - virtual void field(const Symbol &symbol, const Inspector &inspector); + void entry(size_t, const Inspector &inspector) override; + void field(const Symbol &symbol, const Inspector &inspector) override; }; void diff --git a/vespalib/src/vespa/vespalib/data/slime/cursor.h b/vespalib/src/vespa/vespalib/data/slime/cursor.h index cebb05a44ee..504307359cf 100644 --- a/vespalib/src/vespa/vespalib/data/slime/cursor.h +++ b/vespalib/src/vespa/vespalib/data/slime/cursor.h @@ -8,9 +8,9 @@ namespace vespalib { namespace slime { struct Cursor : public Inspector { - virtual Cursor &operator[](size_t idx) const = 0; - virtual Cursor &operator[](Symbol sym) const = 0; - virtual Cursor &operator[](Memory name) const = 0; + virtual Cursor &operator[](size_t idx) const override = 0; + virtual Cursor &operator[](Symbol sym) const override = 0; + virtual Cursor &operator[](Memory name) const override = 0; virtual Cursor &addNix() = 0; virtual Cursor &addBool(bool bit) = 0; diff --git a/vespalib/src/vespa/vespalib/data/slime/inject.cpp b/vespalib/src/vespa/vespalib/data/slime/inject.cpp index 76cc2fe0cc0..548a3f24248 100644 --- a/vespalib/src/vespa/vespalib/data/slime/inject.cpp +++ b/vespalib/src/vespa/vespalib/data/slime/inject.cpp @@ -4,7 +4,7 @@ #include "cursor.h" #include "array_traverser.h" #include "object_traverser.h" -#include <stdlib.h> +#include <cstdlib> namespace vespalib { namespace slime { @@ -15,8 +15,8 @@ struct NestedInjector : ArrayTraverser, ObjectTraverser { Cursor &cursor; const Inspector *guard; NestedInjector(Cursor &c, const Inspector *g) : cursor(c), guard(g) {} - virtual void entry(size_t, const Inspector &inspector); - virtual void field(const Memory &symbol_name, const Inspector &inspector); + void entry(size_t, const Inspector &inspector) override; + void field(const Memory &symbol_name, const Inspector &inspector) override; }; void injectNix(const Inserter &inserter) { inserter.insertNix(); } diff --git a/vespalib/src/vespa/vespalib/data/slime/inserter.h b/vespalib/src/vespa/vespalib/data/slime/inserter.h index 18b2e900e39..321580289a8 100644 --- a/vespalib/src/vespa/vespalib/data/slime/inserter.h +++ b/vespalib/src/vespa/vespalib/data/slime/inserter.h @@ -38,28 +38,28 @@ struct SlimeInserter : Inserter { Slime &slime; explicit SlimeInserter(Slime &s) : slime(s) {} - virtual Cursor &insertNix() const; - virtual Cursor &insertBool(bool value) const; - virtual Cursor &insertLong(int64_t value) const; - virtual Cursor &insertDouble(double value) const; - virtual Cursor &insertString(Memory value) const; - virtual Cursor &insertData(Memory value) const; - virtual Cursor &insertArray() const; - virtual Cursor &insertObject() const; + Cursor &insertNix() const override; + Cursor &insertBool(bool value) const override; + Cursor &insertLong(int64_t value) const override; + Cursor &insertDouble(double value) const override; + Cursor &insertString(Memory value) const override; + Cursor &insertData(Memory value) const override; + Cursor &insertArray() const override; + Cursor &insertObject() const override; }; struct ArrayInserter : Inserter { Cursor &cursor; explicit ArrayInserter(Cursor &c) : cursor(c) {} - virtual Cursor &insertNix() const; - virtual Cursor &insertBool(bool value) const; - virtual Cursor &insertLong(int64_t value) const; - virtual Cursor &insertDouble(double value) const; - virtual Cursor &insertString(Memory value) const; - virtual Cursor &insertData(Memory value) const; - virtual Cursor &insertArray() const; - virtual Cursor &insertObject() const; + Cursor &insertNix() const override; + Cursor &insertBool(bool value) const override; + Cursor &insertLong(int64_t value) const override; + Cursor &insertDouble(double value) const override; + Cursor &insertString(Memory value) const override; + Cursor &insertData(Memory value) const override; + Cursor &insertArray() const override; + Cursor &insertObject() const override; }; struct ObjectSymbolInserter : Inserter { @@ -67,14 +67,14 @@ struct ObjectSymbolInserter : Inserter { Symbol symbol; ObjectSymbolInserter(Cursor &c, const Symbol &s) : cursor(c), symbol(s) {} - virtual Cursor &insertNix() const; - virtual Cursor &insertBool(bool value) const; - virtual Cursor &insertLong(int64_t value) const; - virtual Cursor &insertDouble(double value) const; - virtual Cursor &insertString(Memory value) const; - virtual Cursor &insertData(Memory value) const; - virtual Cursor &insertArray() const; - virtual Cursor &insertObject() const; + Cursor &insertNix() const override; + Cursor &insertBool(bool value) const override; + Cursor &insertLong(int64_t value) const override; + Cursor &insertDouble(double value) const override; + Cursor &insertString(Memory value) const override; + Cursor &insertData(Memory value) const override; + Cursor &insertArray() const override; + Cursor &insertObject() const override; }; struct ObjectInserter : Inserter { @@ -82,14 +82,14 @@ struct ObjectInserter : Inserter { Memory name; ObjectInserter(Cursor &c, const Memory &n) : cursor(c), name(n) {} - virtual Cursor &insertNix() const; - virtual Cursor &insertBool(bool value) const; - virtual Cursor &insertLong(int64_t value) const; - virtual Cursor &insertDouble(double value) const; - virtual Cursor &insertString(Memory value) const; - virtual Cursor &insertData(Memory value) const; - virtual Cursor &insertArray() const; - virtual Cursor &insertObject() const; + Cursor &insertNix() const override; + Cursor &insertBool(bool value) const override; + Cursor &insertLong(int64_t value) const override; + Cursor &insertDouble(double value) const override; + Cursor &insertString(Memory value) const override; + Cursor &insertData(Memory value) const override; + Cursor &insertArray() const override; + Cursor &insertObject() const override; }; } // namespace slime diff --git a/vespalib/src/vespa/vespalib/data/slime/inspector.cpp b/vespalib/src/vespa/vespalib/data/slime/inspector.cpp index a387ab5b86a..cfcbdc99ce9 100644 --- a/vespalib/src/vespa/vespalib/data/slime/inspector.cpp +++ b/vespalib/src/vespa/vespalib/data/slime/inspector.cpp @@ -21,7 +21,7 @@ class EqualObject : public ObjectTraverser, public Equal { public: EqualObject(const Inspector & rhs) : Equal(rhs) { } private: - virtual void field(const Memory &symbol, const Inspector &inspector) { + void field(const Memory &symbol, const Inspector &inspector) override { if ( _equal ) { _equal = (inspector == _rhs[symbol]); } @@ -32,7 +32,7 @@ class EqualArray : public ArrayTraverser, public Equal { public: EqualArray(const Inspector & rhs) : Equal(rhs) { } private: - virtual void entry(size_t idx, const Inspector &inspector) { + void entry(size_t idx, const Inspector &inspector) override { if ( _equal ) { _equal = (inspector == _rhs[idx]); } diff --git a/vespalib/src/vespa/vespalib/data/slime/json_format.cpp b/vespalib/src/vespa/vespalib/data/slime/json_format.cpp index 30ac5d98042..b7b6c88667b 100644 --- a/vespalib/src/vespa/vespalib/data/slime/json_format.cpp +++ b/vespalib/src/vespa/vespalib/data/slime/json_format.cpp @@ -136,8 +136,8 @@ struct JsonEncoder : public ArrayTraverser, } abort(); // should not be reached } - virtual void entry(size_t idx, const Inspector &inspector); - virtual void field(const Memory &symbol_name, const Inspector &inspector); + void entry(size_t idx, const Inspector &inspector) override; + void field(const Memory &symbol_name, const Inspector &inspector) override; static void encode(const Inspector &inspector, OutputWriter &out) { JsonEncoder<COMPACT> encoder(out); diff --git a/vespalib/src/vespa/vespalib/data/slime/named_symbol_inserter.h b/vespalib/src/vespa/vespalib/data/slime/named_symbol_inserter.h index 507804f20ee..13a55de765c 100644 --- a/vespalib/src/vespa/vespalib/data/slime/named_symbol_inserter.h +++ b/vespalib/src/vespa/vespalib/data/slime/named_symbol_inserter.h @@ -20,7 +20,7 @@ private: public: NamedSymbolInserter(SymbolTable &table, const Memory &name) : _table(table), _name(name) {} - virtual Symbol insert() { + Symbol insert() override { return _table.insert(_name); } }; diff --git a/vespalib/src/vespa/vespalib/data/slime/named_symbol_lookup.h b/vespalib/src/vespa/vespalib/data/slime/named_symbol_lookup.h index 792728f870b..5674fbb1e13 100644 --- a/vespalib/src/vespa/vespalib/data/slime/named_symbol_lookup.h +++ b/vespalib/src/vespa/vespalib/data/slime/named_symbol_lookup.h @@ -20,7 +20,7 @@ private: public: NamedSymbolLookup(const SymbolTable &table, const Memory &name) : _table(table), _name(name) {} - virtual Symbol lookup() const { + Symbol lookup() const override { return _table.lookup(_name); } }; diff --git a/vespalib/src/vespa/vespalib/data/slime/object_value.h b/vespalib/src/vespa/vespalib/data/slime/object_value.h index fc647caca1b..b927fab1705 100644 --- a/vespalib/src/vespa/vespalib/data/slime/object_value.h +++ b/vespalib/src/vespa/vespalib/data/slime/object_value.h @@ -65,23 +65,23 @@ public: ObjectValue &operator=(const ObjectValue &) = delete; - virtual Type type() const { return OBJECT::instance; } - virtual size_t children() const { return _fields.size(); } - virtual size_t fields() const { return _fields.size(); } - virtual void traverse(ObjectSymbolTraverser &ot) const; - virtual void traverse(ObjectTraverser &ot) const; + Type type() const override { return OBJECT::instance; } + size_t children() const override { return _fields.size(); } + size_t fields() const override { return _fields.size(); } + void traverse(ObjectSymbolTraverser &ot) const override; + void traverse(ObjectTraverser &ot) const override; - virtual Cursor &operator[](Symbol sym) const; - virtual Cursor &operator[](Memory name) const; + Cursor &operator[](Symbol sym) const override; + Cursor &operator[](Memory name) const override; - virtual Cursor &setArray(Symbol sym); - virtual Cursor &setObject(Symbol sym); + Cursor &setArray(Symbol sym) override; + Cursor &setObject(Symbol sym) override; - virtual Cursor &setArray(Memory name); - virtual Cursor &setObject(Memory name); - virtual Symbol resolve(Memory symbol_name); + Cursor &setArray(Memory name) override; + Cursor &setObject(Memory name) override; + Symbol resolve(Memory symbol_name) override; - virtual ~ObjectValue() { } + ~ObjectValue() { } }; } // namespace vespalib::slime diff --git a/vespalib/src/vespa/vespalib/data/slime/resolved_symbol.h b/vespalib/src/vespa/vespalib/data/slime/resolved_symbol.h index f258ea6d7a1..481023d9616 100644 --- a/vespalib/src/vespa/vespalib/data/slime/resolved_symbol.h +++ b/vespalib/src/vespa/vespalib/data/slime/resolved_symbol.h @@ -22,10 +22,10 @@ private: public: ResolvedSymbol(const Symbol &symbol) : _symbol(symbol) {} - virtual Symbol lookup() const { + Symbol lookup() const override { return _symbol; } - virtual Symbol insert() { + Symbol insert() override { return _symbol; } }; diff --git a/vespalib/src/vespa/vespalib/data/slime/value.h b/vespalib/src/vespa/vespalib/data/slime/value.h index 0324ae8d49a..8d11531f619 100644 --- a/vespalib/src/vespa/vespalib/data/slime/value.h +++ b/vespalib/src/vespa/vespalib/data/slime/value.h @@ -29,56 +29,56 @@ protected: virtual Cursor &setLeaf(Memory name, const ValueFactory &input); public: - virtual bool valid() const; - virtual Type type() const; - virtual size_t children() const; - virtual size_t entries() const; - virtual size_t fields() const; - - virtual bool asBool() const; - virtual int64_t asLong() const; - virtual double asDouble() const; - virtual Memory asString() const; - virtual Memory asData() const; - - virtual void traverse(ArrayTraverser &at) const; - virtual void traverse(ObjectSymbolTraverser &ot) const; - virtual void traverse(ObjectTraverser &ot) const; - - virtual vespalib::string toString() const override; - - virtual Cursor &operator[](size_t idx) const; - virtual Cursor &operator[](Symbol sym) const; - virtual Cursor &operator[](Memory name) const; - - virtual Cursor &addNix(); - virtual Cursor &addBool(bool bit); - virtual Cursor &addLong(int64_t l); - virtual Cursor &addDouble(double d); - virtual Cursor &addString(Memory str); - virtual Cursor &addData(Memory data); - virtual Cursor &addArray(); - virtual Cursor &addObject(); - - virtual Cursor &setNix(Symbol sym); - virtual Cursor &setBool(Symbol sym, bool bit); - virtual Cursor &setLong(Symbol sym, int64_t l); - virtual Cursor &setDouble(Symbol sym, double d); - virtual Cursor &setString(Symbol sym, Memory str); - virtual Cursor &setData(Symbol sym, Memory data); - virtual Cursor &setArray(Symbol sym); - virtual Cursor &setObject(Symbol sym); - - virtual Cursor &setNix(Memory name); - virtual Cursor &setBool(Memory name, bool bit); - virtual Cursor &setLong(Memory name, int64_t l); - virtual Cursor &setDouble(Memory name, double d); - virtual Cursor &setString(Memory name, Memory str); - virtual Cursor &setData(Memory name, Memory str); - virtual Cursor &setArray(Memory name); - virtual Cursor &setObject(Memory name); - - virtual Symbol resolve(Memory symbol_name); + bool valid() const override; + Type type() const override; + size_t children() const override; + size_t entries() const override; + size_t fields() const override; + + bool asBool() const override; + int64_t asLong() const override; + double asDouble() const override; + Memory asString() const override; + Memory asData() const override; + + void traverse(ArrayTraverser &at) const override; + void traverse(ObjectSymbolTraverser &ot) const override; + void traverse(ObjectTraverser &ot) const override; + + vespalib::string toString() const override; + + Cursor &operator[](size_t idx) const override; + Cursor &operator[](Symbol sym) const override; + Cursor &operator[](Memory name) const override; + + Cursor &addNix() override; + Cursor &addBool(bool bit) override; + Cursor &addLong(int64_t l) override; + Cursor &addDouble(double d) override; + Cursor &addString(Memory str) override; + Cursor &addData(Memory data) override; + Cursor &addArray() override; + Cursor &addObject() override; + + Cursor &setNix(Symbol sym) override; + Cursor &setBool(Symbol sym, bool bit) override; + Cursor &setLong(Symbol sym, int64_t l) override; + Cursor &setDouble(Symbol sym, double d) override; + Cursor &setString(Symbol sym, Memory str) override; + Cursor &setData(Symbol sym, Memory data) override; + Cursor &setArray(Symbol sym) override; + Cursor &setObject(Symbol sym) override; + + Cursor &setNix(Memory name) override; + Cursor &setBool(Memory name, bool bit) override; + Cursor &setLong(Memory name, int64_t l) override; + Cursor &setDouble(Memory name, double d) override; + Cursor &setString(Memory name, Memory str) override; + Cursor &setData(Memory name, Memory str) override; + Cursor &setArray(Memory name) override; + Cursor &setObject(Memory name) override; + + Symbol resolve(Memory symbol_name) override; }; } // namespace vespalib::slime diff --git a/vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.cpp b/vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.cpp index 7741b60ac01..8ead9508c52 100644 --- a/vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.cpp +++ b/vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.cpp @@ -21,27 +21,27 @@ public: class GenericFactory :public Factory{ public: - virtual IAccelrated::UP create() const { return IAccelrated::UP(new GenericAccelrator()); } + IAccelrated::UP create() const override { return IAccelrated::UP(new GenericAccelrator()); } }; class Sse2Factory :public Factory{ public: - virtual IAccelrated::UP create() const { return IAccelrated::UP(new Sse2Accelrator()); } + IAccelrated::UP create() const override { return IAccelrated::UP(new Sse2Accelrator()); } }; class AvxFactory :public Factory{ public: - virtual IAccelrated::UP create() const { return IAccelrated::UP(new AvxAccelrator()); } + IAccelrated::UP create() const override { return IAccelrated::UP(new AvxAccelrator()); } }; class Avx2Factory :public Factory{ public: - virtual IAccelrated::UP create() const { return IAccelrated::UP(new Avx2Accelrator()); } + IAccelrated::UP create() const override { return IAccelrated::UP(new Avx2Accelrator()); } }; class Avx512Factory :public Factory{ public: - virtual IAccelrated::UP create() const { return IAccelrated::UP(new Avx512Accelrator()); } + IAccelrated::UP create() const override { return IAccelrated::UP(new Avx512Accelrator()); } }; template<typename T> diff --git a/vespalib/src/vespa/vespalib/io/fileutil.h b/vespalib/src/vespa/vespalib/io/fileutil.h index 52d0e9b3cd6..8ad05c96152 100644 --- a/vespalib/src/vespa/vespalib/io/fileutil.h +++ b/vespalib/src/vespa/vespalib/io/fileutil.h @@ -233,24 +233,24 @@ public: { _autoCreateDirectories = autoCreate; } bool autoCreateDirectories() const { return _autoCreateDirectories; } - int getFileDescriptor() const { + int getFileDescriptor() const override { if (!isOpen()) { const_cast<LazyFile&>(*this).open(_flags, _autoCreateDirectories); } return File::getFileDescriptor(); } - void resize(off_t size) { + void resize(off_t size) override { if (!isOpen()) { open(_flags, _autoCreateDirectories); } File::resize(size); } - off_t write(const void *buf, size_t bufsize, off_t offset) { + off_t write(const void *buf, size_t bufsize, off_t offset) override { if (!isOpen()) { open(_flags, _autoCreateDirectories); } return File::write(buf, bufsize, offset); } - size_t read(void *buf, size_t bufsize, off_t offset) const { + size_t read(void *buf, size_t bufsize, off_t offset) const override { if (!isOpen()) { const_cast<LazyFile&>(*this).open(_flags, _autoCreateDirectories); } diff --git a/vespalib/src/vespa/vespalib/testkit/test_hook.cpp b/vespalib/src/vespa/vespalib/testkit/test_hook.cpp index ac051e03217..2c00bbda744 100644 --- a/vespalib/src/vespa/vespalib/testkit/test_hook.cpp +++ b/vespalib/src/vespa/vespalib/testkit/test_hook.cpp @@ -12,14 +12,14 @@ namespace { struct FastOSTestThreadRunner : FastOS_Runnable { TestThreadEntry &entry; FastOSTestThreadRunner(TestThreadEntry &entry_in) : entry(entry_in) {} - virtual bool DeleteOnCompletion() const { return true; } - virtual void Run(FastOS_ThreadInterface *, void *) { entry.threadEntry(); } + bool DeleteOnCompletion() const override { return true; } + void Run(FastOS_ThreadInterface *, void *) override { entry.threadEntry(); } }; struct FastOSTestThreadFactory : TestThreadFactory { FastOS_ThreadPool threadPool; FastOSTestThreadFactory() : threadPool(256 * 1024) {} - virtual void createThread(TestThreadEntry &entry) { + void createThread(TestThreadEntry &entry) override { threadPool.NewThread(new FastOSTestThreadRunner(entry), 0); } }; diff --git a/vespalib/src/vespa/vespalib/testkit/test_hook.h b/vespalib/src/vespa/vespalib/testkit/test_hook.h index 2dc67595736..746a05733bd 100644 --- a/vespalib/src/vespa/vespalib/testkit/test_hook.h +++ b/vespalib/src/vespa/vespalib/testkit/test_hook.h @@ -47,7 +47,7 @@ public: _latch(l), _barrier(b), _traceStack(traceStack), _fixture(fixture) {} - virtual void threadEntry(); + void threadEntry() override; bool getResult() const { return _result; } diff --git a/vespalib/src/vespa/vespalib/util/active.h b/vespalib/src/vespa/vespalib/util/active.h index e1a77040862..deede405bd1 100644 --- a/vespalib/src/vespa/vespalib/util/active.h +++ b/vespalib/src/vespa/vespalib/util/active.h @@ -24,9 +24,6 @@ struct Active : Joinable { **/ virtual Joinable &stop() = 0; - // inherits documentation from Joinable - virtual void join() = 0; - /** * Empty virtual destructor to enable subclassing. **/ diff --git a/vespalib/src/vespa/vespalib/util/dual_merge_director.h b/vespalib/src/vespa/vespalib/util/dual_merge_director.h index 0ef42f367b5..6676d40042e 100644 --- a/vespalib/src/vespa/vespalib/util/dual_merge_director.h +++ b/vespalib/src/vespa/vespalib/util/dual_merge_director.h @@ -50,14 +50,14 @@ private: bool last; MixedMergeStateExchanger(bool v) : Rendezvous<MergeState, MergeState>(2), last(v) {} - virtual void mingle(); + void mingle() override; }; struct MergeStateExchanger : Rendezvous<MergeState, MergeState> { size_t remaining; MergeStateExchanger(size_t r) : Rendezvous<MergeState, MergeState>(2), remaining(r) {} - virtual void mingle(); + void mingle() override; }; size_t _num_threads; diff --git a/vespalib/src/vespa/vespalib/util/runnable_pair.h b/vespalib/src/vespa/vespalib/util/runnable_pair.h index 620a4d92f34..58dc45f4566 100644 --- a/vespalib/src/vespa/vespalib/util/runnable_pair.h +++ b/vespalib/src/vespa/vespalib/util/runnable_pair.h @@ -17,7 +17,7 @@ private: public: RunnablePair(Runnable &first, Runnable &second); - virtual void run(); + void run() override; }; } // namespace vesaplib diff --git a/vespalib/src/vespa/vespalib/util/simple_thread_bundle.cpp b/vespalib/src/vespa/vespalib/util/simple_thread_bundle.cpp index ad287c54d6a..b90f07cf691 100644 --- a/vespalib/src/vespa/vespalib/util/simple_thread_bundle.cpp +++ b/vespalib/src/vespa/vespalib/util/simple_thread_bundle.cpp @@ -12,26 +12,26 @@ namespace { struct SignalHook : Runnable { Signal &signal; SignalHook(Signal &s) : signal(s) {} - virtual void run() { signal.send(); } + void run() override { signal.send(); } }; struct BroadcastHook : Runnable { Signal &signal; BroadcastHook(Signal &s) : signal(s) {} - virtual void run() { signal.broadcast(); } + void run() override { signal.broadcast(); } }; struct PartHook : Runnable { Part part; PartHook(const Part &p) : part(p) {} - virtual void run() { part.perform(); } + void run() override { part.perform(); } }; struct HookPair : Runnable { Runnable::UP first; Runnable::UP second; HookPair(Runnable::UP f, Runnable::UP s) : first(std::move(f)), second(std::move(s)) {} - virtual void run() { + void run() override { first->run(); second->run(); } diff --git a/vespalib/src/vespa/vespalib/util/simple_thread_bundle.h b/vespalib/src/vespa/vespalib/util/simple_thread_bundle.h index f4b5d174ae1..4c656baf6c3 100644 --- a/vespalib/src/vespa/vespalib/util/simple_thread_bundle.h +++ b/vespalib/src/vespa/vespalib/util/simple_thread_bundle.h @@ -113,7 +113,7 @@ private: Worker(Signal &s, Runnable::UP h) : thread(*this), signal(s), hook(std::move(h)) { thread.start(); } - virtual void run() { + void run() override { for (size_t gen = 0; signal.wait(gen) > 0; ) { hook->run(); } @@ -127,9 +127,9 @@ private: public: SimpleThreadBundle(size_t size, Strategy strategy = USE_SIGNAL_LIST); - virtual ~SimpleThreadBundle(); - virtual size_t size() const; - virtual void run(const std::vector<Runnable*> &targets); + ~SimpleThreadBundle(); + size_t size() const override; + void run(const std::vector<Runnable*> &targets) override; }; } // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/util/slaveproc.h b/vespalib/src/vespa/vespalib/util/slaveproc.h index 69055feec27..4b0ce5db156 100644 --- a/vespalib/src/vespa/vespalib/util/slaveproc.h +++ b/vespalib/src/vespa/vespalib/util/slaveproc.h @@ -37,7 +37,7 @@ private: int _waitCnt; bool _readEOF; - virtual void OnReceiveData(const void *data, size_t length); + void OnReceiveData(const void *data, size_t length) override; bool hasData(); bool waitForData(slaveproc::Timer &timer, MonitorGuard &lock); void updateEOF(); diff --git a/vespalib/src/vespa/vespalib/util/thread.h b/vespalib/src/vespa/vespalib/util/thread.h index 1a87b3bc576..72ac1570e79 100644 --- a/vespalib/src/vespa/vespalib/util/thread.h +++ b/vespalib/src/vespa/vespalib/util/thread.h @@ -42,9 +42,9 @@ private: public: Thread(Runnable &runnable); ~Thread(); - virtual void start(); - virtual Thread &stop(); - virtual void join(); + void start() override; + Thread &stop() override; + void join() override; bool stopped() const { return _stopped; } bool slumber(double s); static Thread ¤tThread(); diff --git a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h index 10bf8113e05..c2f5742009f 100644 --- a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h +++ b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h @@ -115,7 +115,7 @@ private: bool obtainTask(Worker &worker); // from FastOS_Runnable (all workers live here) - virtual void Run(FastOS_ThreadInterface *, void *); + void Run(FastOS_ThreadInterface *, void *) override; protected: /** @@ -182,7 +182,7 @@ public: Stats getStats(); // inherited from Executor - virtual Task::UP execute(Task::UP task); + Task::UP execute(Task::UP task) override; /** * Synchronize with this executor. This function will block until @@ -191,7 +191,7 @@ public: * * @return this object; for chaining **/ - virtual ThreadStackExecutorBase &sync(); + ThreadStackExecutorBase &sync() override; /** * Block the calling thread until the current task count is equal diff --git a/vespalog/src/vespa/log/log-target-fd.h b/vespalog/src/vespa/log/log-target-fd.h index f75ff9b44e1..a3531cef3b3 100644 --- a/vespalog/src/vespa/log/log-target-fd.h +++ b/vespalog/src/vespa/log/log-target-fd.h @@ -15,9 +15,9 @@ private: public: explicit LogTargetFd(const char *target); - virtual int write(const char *buf, int len); - virtual ~LogTargetFd(); - virtual bool makeHumanReadable() const { return _istty; } + int write(const char *buf, int len) override; + ~LogTargetFd(); + bool makeHumanReadable() const override { return _istty; } }; diff --git a/vespalog/src/vespa/log/log-target-file.h b/vespalog/src/vespa/log/log-target-file.h index 7851b231e7d..6758b9664d2 100644 --- a/vespalog/src/vespa/log/log-target-file.h +++ b/vespalog/src/vespa/log/log-target-file.h @@ -1,12 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "log-target.h" #include <sys/types.h> #include <sys/stat.h> - -#include "log-target.h" - namespace ns_log { class LogTargetFile : public LogTarget { @@ -22,8 +20,8 @@ private: public: explicit LogTargetFile(const char *target); - virtual ~LogTargetFile(); - virtual int write(const char *buf, int len); + ~LogTargetFile(); + int write(const char *buf, int len) override; }; diff --git a/vespalog/src/vespa/log/log.h b/vespalog/src/vespa/log/log.h index 827d615c4e8..a14ff87e1be 100644 --- a/vespalog/src/vespa/log/log.h +++ b/vespalog/src/vespa/log/log.h @@ -171,8 +171,7 @@ struct Timer { struct TestTimer : public Timer { uint64_t & _time; TestTimer(uint64_t & timeVar) : _time(timeVar) { } - virtual ~TestTimer() {} - virtual uint64_t getTimestamp() const { return _time; } + uint64_t getTimestamp() const override { return _time; } }; class Logger { |