diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-04-03 17:22:27 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-04-04 16:36:17 +0200 |
commit | d57ddaefd37e6a19d3a6937fbf9a655dbafcdba5 (patch) | |
tree | 56f50116805e8ae7d2287c934e6ccc073142d0ce /fastos | |
parent | 3dab091fd0ec3ffd71af3e19e55ed3a4437b8d8b (diff) |
Use override
Diffstat (limited to 'fastos')
26 files changed, 103 insertions, 129 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; } }; |