From 5a48a81c4134bae524aa66e1e49624f678c8b6ce Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Mon, 3 Apr 2017 20:22:16 +0200 Subject: Add override in vespalib module --- vespalib/src/tests/atomic/atomic_test.cpp | 10 +++++----- vespalib/src/tests/closure/autoclosurecaller_test.cpp | 7 +------ vespalib/src/tests/closure/closure_test.cpp | 7 +------ vespalib/src/tests/compress/compress_test.cpp | 6 ++---- vespalib/src/tests/delegatelist/delegatelist.cpp | 9 +++++---- vespalib/src/tests/dotproduct/dotproductbenchmark.cpp | 6 +++--- .../dual_merge_director/dual_merge_director_test.cpp | 2 +- vespalib/src/tests/eventbarrier/eventbarrier.cpp | 6 ++---- vespalib/src/tests/executor/executor_test.cpp | 7 +------ vespalib/src/tests/executor/stress_test.cpp | 11 ++++------- .../src/tests/executor/threadstackexecutor_test.cpp | 6 +++--- vespalib/src/tests/guard/guard_test.cpp | 6 ++---- vespalib/src/tests/hashmap/hashmap_test.cpp | 9 ++------- .../tests/left_right_heap/left_right_heap_bench.cpp | 15 +++++---------- vespalib/src/tests/linkedptr/linkedptr_test.cpp | 6 ++---- vespalib/src/tests/memory/memory_test.cpp | 8 +++----- vespalib/src/tests/optimized/optimized_test.cpp | 2 +- vespalib/src/tests/printable/printabletest.cpp | 18 +++++++++--------- vespalib/src/tests/random/random_test.cpp | 6 ++---- vespalib/src/tests/rendezvous/rendezvous_test.cpp | 4 ++-- .../src/tests/runnable_pair/runnable_pair_test.cpp | 6 +++--- vespalib/src/tests/rwlock/rwlock_test.cpp | 6 ++---- vespalib/src/tests/sharedptr/ptrholder.cpp | 6 ++---- .../simple_thread_bundle_test.cpp | 5 ++--- .../simple_thread_bundle/threading_speed_test.cpp | 2 +- vespalib/src/tests/stllike/asciistream_test.cpp | 7 ++----- vespalib/src/tests/stringfmt/fmt.cpp | 19 ++----------------- vespalib/src/tests/sync/sync_test.cpp | 6 ++---- vespalib/src/tests/thread/thread_test.cpp | 4 ++-- vespalib/src/tests/trace/trace.cpp | 8 ++++---- .../util/generationhandler/generationhandler_test.cpp | 6 ++---- vespalib/src/tests/valgrind/valgrind_test.cpp | 6 ++---- vespalib/src/tests/weakref/weakref_test.cpp | 7 ++----- 33 files changed, 84 insertions(+), 155 deletions(-) diff --git a/vespalib/src/tests/atomic/atomic_test.cpp b/vespalib/src/tests/atomic/atomic_test.cpp index 6a84e7a32fc..c08325d8f30 100644 --- a/vespalib/src/tests/atomic/atomic_test.cpp +++ b/vespalib/src/tests/atomic/atomic_test.cpp @@ -22,7 +22,7 @@ public: void testDec(); template void testSemantics(); - int Main(); + int Main() override; }; static const int numadders = 7; @@ -108,7 +108,7 @@ public: _idata(i), _udata(u) {} - void Run(FastOS_ThreadInterface *, void *) { + void Run(FastOS_ThreadInterface *, void *) override { using vespalib::Atomic; for (int i = 0; i < _times; ++i) { Atomic::add(_idata, _toadd); @@ -137,7 +137,7 @@ public: _idata(i), _udata(u) {} - void Run(FastOS_ThreadInterface *, void *) { + void Run(FastOS_ThreadInterface *, void *) override { using vespalib::Atomic; for (int i = 0; i < _times; ++i) { Atomic::sub(_idata, _tosub); @@ -167,7 +167,7 @@ class Incrementer : public Changer { public: Incrementer(int times, T *data) : Changer(times, data) {} - void Run(FastOS_ThreadInterface *, void *) { + void Run(FastOS_ThreadInterface *, void *) override { using vespalib::Atomic; for (int i = 0; i < this->_times; ++i) { this->_counts.push_back(Atomic::postInc(this->_idata)); @@ -181,7 +181,7 @@ class Decrementer : public Changer { public: Decrementer(int times, T *data) : Changer(times, data) {} - void Run(FastOS_ThreadInterface *, void *) { + void Run(FastOS_ThreadInterface *, void *) override { using vespalib::Atomic; for (int i = 0; i < this->_times; ++i) { this->_counts.push_back(Atomic::postDec(this->_idata)); diff --git a/vespalib/src/tests/closure/autoclosurecaller_test.cpp b/vespalib/src/tests/closure/autoclosurecaller_test.cpp index c6363b4bd49..b1165afc630 100644 --- a/vespalib/src/tests/closure/autoclosurecaller_test.cpp +++ b/vespalib/src/tests/closure/autoclosurecaller_test.cpp @@ -1,9 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -// Unit tests for autoclosurecaller. - -#include -#include -LOG_SETUP("autoclosurecaller_test"); #include #include @@ -16,7 +11,7 @@ class Test : public vespalib::TestApp { void requireThatClosureIsCalledInDtor(); public: - int Main(); + int Main() override; }; int diff --git a/vespalib/src/tests/closure/closure_test.cpp b/vespalib/src/tests/closure/closure_test.cpp index 5de4d424c60..f8f4106f83a 100644 --- a/vespalib/src/tests/closure/closure_test.cpp +++ b/vespalib/src/tests/closure/closure_test.cpp @@ -1,9 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -// Unit tests for closure. - -#include -#include -LOG_SETUP("closure_test"); #include #include @@ -31,7 +26,7 @@ class Test : public vespalib::TestApp { void testMemberClosure1_2(); public: - int Main(); + int Main() override; }; int diff --git a/vespalib/src/tests/compress/compress_test.cpp b/vespalib/src/tests/compress/compress_test.cpp index 7cc458e2290..b73dd7e14bb 100644 --- a/vespalib/src/tests/compress/compress_test.cpp +++ b/vespalib/src/tests/compress/compress_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 -#include -LOG_SETUP("compress_test"); + #include #include #include @@ -17,7 +15,7 @@ private: void requireThatPositiveNumberCompressCorrectly(); void requireThatNumberCompressCorrectly(); public: - int Main(); + int Main() override; }; void diff --git a/vespalib/src/tests/delegatelist/delegatelist.cpp b/vespalib/src/tests/delegatelist/delegatelist.cpp index 475d4e24551..11dd4d7d9e2 100644 --- a/vespalib/src/tests/delegatelist/delegatelist.cpp +++ b/vespalib/src/tests/delegatelist/delegatelist.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 -#include -LOG_SETUP("delegatelist_test"); + #include #include #include @@ -11,6 +9,9 @@ LOG_SETUP("delegatelist_test"); #include #include +#include +LOG_SETUP("delegatelist_test"); + using namespace vespalib; //----------------------------------------------------------------------------- @@ -26,7 +27,7 @@ public: void testActors(); void testWaitSnapshots(); void stressTest(); - int Main(); + int Main() override; }; //----------------------------------------------------------------------------- diff --git a/vespalib/src/tests/dotproduct/dotproductbenchmark.cpp b/vespalib/src/tests/dotproduct/dotproductbenchmark.cpp index b04aa802098..07c3db8e75c 100644 --- a/vespalib/src/tests/dotproduct/dotproductbenchmark.cpp +++ b/vespalib/src/tests/dotproduct/dotproductbenchmark.cpp @@ -30,7 +30,7 @@ class FullBenchmark : public Benchmark public: FullBenchmark(size_t numDocs, size_t numValue); ~FullBenchmark(); - virtual void compute(size_t docId) const { + void compute(size_t docId) const override { _dp->dotProduct(&_query[0], &_values[docId * _query.size()], _query.size()); } private: @@ -97,7 +97,7 @@ public: UnorderedSparseBenchmark(size_t numDocs, size_t numValues, size_t numQueryValues); ~UnorderedSparseBenchmark(); private: - virtual void compute(size_t docId) const { + void compute(size_t docId) const override { int64_t sum(0); size_t offset(docId*_numValues); const auto e(_query.end()); @@ -127,7 +127,7 @@ public: OrderedSparseBenchmark(size_t numDocs, size_t numValues, size_t numQueryValues); ~OrderedSparseBenchmark(); private: - virtual void compute(size_t docId) const { + void compute(size_t docId) const override { int64_t sum(0); size_t offset(docId*_numValues); diff --git a/vespalib/src/tests/dual_merge_director/dual_merge_director_test.cpp b/vespalib/src/tests/dual_merge_director/dual_merge_director_test.cpp index b6621a75b84..ff1d5a1ef15 100644 --- a/vespalib/src/tests/dual_merge_director/dual_merge_director_test.cpp +++ b/vespalib/src/tests/dual_merge_director/dual_merge_director_test.cpp @@ -12,7 +12,7 @@ struct MySource : public DualMergeDirector::Source { MySource(bool a, size_t num_sources, size_t source_id); ~MySource(); - virtual void merge(Source &mt) { + void merge(Source &mt) override { MySource &rhs = static_cast(mt); ASSERT_EQUAL(typeA, rhs.typeA); ASSERT_EQUAL(data.size(), rhs.data.size()); diff --git a/vespalib/src/tests/eventbarrier/eventbarrier.cpp b/vespalib/src/tests/eventbarrier/eventbarrier.cpp index 6f2c5df13df..bf4c85fcfd5 100644 --- a/vespalib/src/tests/eventbarrier/eventbarrier.cpp +++ b/vespalib/src/tests/eventbarrier/eventbarrier.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 -#include -LOG_SETUP("eventbarrier_test"); + #include #include @@ -23,7 +21,7 @@ public: void testBarrierChain(); void testEventAfter(); void testReorder(); - int Main(); + int Main() override; }; void diff --git a/vespalib/src/tests/executor/executor_test.cpp b/vespalib/src/tests/executor/executor_test.cpp index edb352c797c..8aafdc7c666 100644 --- a/vespalib/src/tests/executor/executor_test.cpp +++ b/vespalib/src/tests/executor/executor_test.cpp @@ -1,9 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -// Unit tests for executor. - -#include -#include -LOG_SETUP("executor_test"); #include #include @@ -16,7 +11,7 @@ class Test : public vespalib::TestApp { void requireThatClosuresCanBeWrappedInATask(); public: - int Main(); + int Main() override; }; int diff --git a/vespalib/src/tests/executor/stress_test.cpp b/vespalib/src/tests/executor/stress_test.cpp index d9d2352f7c3..24f991726fc 100644 --- a/vespalib/src/tests/executor/stress_test.cpp +++ b/vespalib/src/tests/executor/stress_test.cpp @@ -1,9 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -LOG_SETUP("executor_test"); -#include +#include #include #include #include @@ -27,7 +24,7 @@ struct CPUTask : public Executor::Task { uint32_t taskSize; uint32_t &result; CPUTask(uint32_t size, uint32_t &res) : taskSize(size), result(res) {} - virtual void run() { + void run() override { uint32_t res = 0; for (uint32_t i = 0; i < taskSize; ++i) { res += doStuff(i); @@ -40,7 +37,7 @@ struct SyncTask : public Executor::Task { Gate &gate; CountDownLatch &latch; SyncTask(Gate &g, CountDownLatch &l) : gate(g), latch(l) {} - virtual void run() { + void run() override { latch.countDown(); gate.await(); } @@ -55,7 +52,7 @@ public: Test() : _result(0) {} uint32_t calibrate(double ms); void stress(Executor &executor, uint32_t taskSize, uint32_t numTasks); - int Main(); + int Main() override; }; uint32_t diff --git a/vespalib/src/tests/executor/threadstackexecutor_test.cpp b/vespalib/src/tests/executor/threadstackexecutor_test.cpp index 5deab82b6fc..cb998a4323c 100644 --- a/vespalib/src/tests/executor/threadstackexecutor_test.cpp +++ b/vespalib/src/tests/executor/threadstackexecutor_test.cpp @@ -15,12 +15,12 @@ struct MyTask : public Executor::Task { static uint32_t runCnt; static uint32_t deleteCnt; MyTask(Gate &g, CountDownLatch &l) : gate(g), latch(l) {} - virtual void run() { + void run() override { Atomic::postInc(&runCnt); latch.countDown(); gate.await(); } - virtual ~MyTask() { + ~MyTask() { Atomic::postInc(&deleteCnt); } static void resetStats() { @@ -120,7 +120,7 @@ TEST_F("requireThatNewTasksAreDroppedAfterShutdown", MyState()) { struct WaitTask : public Executor::Task { Gate &gate; WaitTask(Gate &g) : gate(g) {} - virtual void run() { gate.await(); } + void run() override { gate.await(); } }; struct WaitState { diff --git a/vespalib/src/tests/guard/guard_test.cpp b/vespalib/src/tests/guard/guard_test.cpp index 1e7ec21008f..c713b9643c6 100644 --- a/vespalib/src/tests/guard/guard_test.cpp +++ b/vespalib/src/tests/guard/guard_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 -#include -LOG_SETUP("guard_test"); + #include #include #include @@ -17,7 +15,7 @@ public: void testValueGuard(); void testMaxValueGuard(); void testCounterGuard(); - int Main(); + int Main() override; }; void diff --git a/vespalib/src/tests/hashmap/hashmap_test.cpp b/vespalib/src/tests/hashmap/hashmap_test.cpp index 34ad2caee3c..919291c8604 100644 --- a/vespalib/src/tests/hashmap/hashmap_test.cpp +++ b/vespalib/src/tests/hashmap/hashmap_test.cpp @@ -1,12 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -LOG_SETUP("hashmap_test"); + #include #include -#include -#include -#include class Test : public vespalib::TestApp { @@ -14,7 +9,7 @@ public: void testInt(); void testString(); void testHashValue(); - int Main(); + int Main() override; }; diff --git a/vespalib/src/tests/left_right_heap/left_right_heap_bench.cpp b/vespalib/src/tests/left_right_heap/left_right_heap_bench.cpp index 5699adfb760..cc9f586f806 100644 --- a/vespalib/src/tests/left_right_heap/left_right_heap_bench.cpp +++ b/vespalib/src/tests/left_right_heap/left_right_heap_bench.cpp @@ -1,13 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include #include #include #include #include -#include -#include -#include -#include using namespace vespalib; @@ -210,10 +205,10 @@ struct Benchmark { template struct BenchmarkHD : Benchmark { - virtual std::string legend() const { + std::string legend() const override { return make_string("[%s, %s]", Name::value(), D::name()); } - virtual double fiddle(size_t heapSize, size_t cnt, size_t loop, bool adjust) { + double fiddle(size_t heapSize, size_t cnt, size_t loop, bool adjust) override { Timer t; for (size_t i = 0; i < loop; ++i) { D d(cnt * 2); @@ -224,7 +219,7 @@ struct BenchmarkHD : Benchmark { } return t.minTime; } - virtual std::pair sort(size_t maxHeapSize, size_t loop) { + std::pair sort(size_t maxHeapSize, size_t loop) override { Timer t1; Timer t2; for (size_t i = 0; i < loop; ++i) { @@ -236,12 +231,12 @@ struct BenchmarkHD : Benchmark { } return std::make_pair(t1.minTime, t2.minTime); } - virtual void runSortBench(size_t maxHeapSize, size_t loop) { + void runSortBench(size_t maxHeapSize, size_t loop) override { std::pair t = sort(maxHeapSize, loop); fprintf(stderr, " sort bench (size=%zu): %g ms [%g ms (push) %g ms (pop)]\n", maxHeapSize, (t.first + t.second), t.first, t.second); } - virtual void runFiddleBench(size_t heapSize, size_t cnt, size_t loop, bool adjust) { + void runFiddleBench(size_t heapSize, size_t cnt, size_t loop, bool adjust) override { double t = fiddle(heapSize, cnt, loop, adjust); fprintf(stderr, " fiddle bench (size=%zu, cnt=%zu, use adjust='%s'): %g ms\n", heapSize, cnt, adjust? "yes":"no", t); diff --git a/vespalib/src/tests/linkedptr/linkedptr_test.cpp b/vespalib/src/tests/linkedptr/linkedptr_test.cpp index df3cf4aa0e6..09fe2eed3e2 100644 --- a/vespalib/src/tests/linkedptr/linkedptr_test.cpp +++ b/vespalib/src/tests/linkedptr/linkedptr_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 -#include -LOG_SETUP("linkedptr_test"); + #include #include @@ -18,7 +16,7 @@ public: void testAccess(); void testRelease(); void testEqual(); - int Main(); + int Main() override; }; diff --git a/vespalib/src/tests/memory/memory_test.cpp b/vespalib/src/tests/memory/memory_test.cpp index c9b0634f3bc..09a3e11b591 100644 --- a/vespalib/src/tests/memory/memory_test.cpp +++ b/vespalib/src/tests/memory/memory_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 -#include -LOG_SETUP("memory_test"); + #include #include @@ -18,13 +16,13 @@ class A : public B { public: virtual ~A() { } - virtual A * clone() const { return new A(*this); } + virtual A * clone() const override { return new A(*this); } }; class Test : public TestApp { public: - int Main(); + int Main() override; }; B* fn(auto_arr param) { return param.get(); } diff --git a/vespalib/src/tests/optimized/optimized_test.cpp b/vespalib/src/tests/optimized/optimized_test.cpp index 694ce248181..698d763d35b 100644 --- a/vespalib/src/tests/optimized/optimized_test.cpp +++ b/vespalib/src/tests/optimized/optimized_test.cpp @@ -13,7 +13,7 @@ private: template void testLsbIdx(); public: - int Main(); + int Main() override; }; template diff --git a/vespalib/src/tests/printable/printabletest.cpp b/vespalib/src/tests/printable/printabletest.cpp index 54b245ffff0..4138a875d60 100644 --- a/vespalib/src/tests/printable/printabletest.cpp +++ b/vespalib/src/tests/printable/printabletest.cpp @@ -10,8 +10,8 @@ struct Foo : public vespalib::Printable { Foo(int v, std::string o) : val(v), other(o) {} - virtual void print(std::ostream& out, bool verbose = false, - const std::string& indent = "") const + void print(std::ostream& out, bool verbose = false, + const std::string& indent = "") const override { out << "Foo(val = " << val; if (verbose) { @@ -28,8 +28,8 @@ struct Bar : public Foo { Bar(int j, int v, std::string o) : Foo(v, o), i(j) {} - virtual void print(std::ostream& out, bool verbose = false, - const std::string& indent = "") const + void print(std::ostream& out, bool verbose = false, + const std::string& indent = "") const override { out << "Bar(" << i << ")"; if (verbose) { @@ -44,8 +44,8 @@ struct AsciiFoo : public vespalib::AsciiPrintable { AsciiFoo(int v) : val(v) {} - virtual void print(vespalib::asciistream& out, - const PrintProperties& p) const + void print(vespalib::asciistream& out, + const PrintProperties& p) const override { if (p.verbose()) { out << "AsciiFoo(" << val << ")"; @@ -60,8 +60,8 @@ struct AsciiBar : public vespalib::AsciiPrintable { AsciiBar(int v) : _foo(v) {} - virtual void print(vespalib::asciistream& out, - const PrintProperties& p) const + void print(vespalib::asciistream& out, + const PrintProperties& p) const override { if (p.verbose()) { out << "AsciiBar() {" @@ -79,7 +79,7 @@ class Test : public vespalib::TestApp public: void testSimple(); void testAsciiVariant(); - int Main(); + int Main() override; }; void diff --git a/vespalib/src/tests/random/random_test.cpp b/vespalib/src/tests/random/random_test.cpp index 0c8d24abc11..02840c5763b 100644 --- a/vespalib/src/tests/random/random_test.cpp +++ b/vespalib/src/tests/random/random_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 -#include -LOG_SETUP("random_test"); + #include #include @@ -15,7 +13,7 @@ public: void testJavaCompatibility(); void testFloatingPoint(); void testNormalDistribution(); - int Main(); + int Main() override; }; bool eqD(double a, double b) { diff --git a/vespalib/src/tests/rendezvous/rendezvous_test.cpp b/vespalib/src/tests/rendezvous/rendezvous_test.cpp index 4e8ff50397e..a3beb4f47c7 100644 --- a/vespalib/src/tests/rendezvous/rendezvous_test.cpp +++ b/vespalib/src/tests/rendezvous/rendezvous_test.cpp @@ -13,13 +13,13 @@ struct Value { template struct Empty : Rendezvous { Empty(size_t n) : Rendezvous(n) {} - virtual void mingle() {} + void mingle() override {} T meet() { return this->rendezvous(0); } }; struct Add : Rendezvous > { Add(size_t n) : Rendezvous >(n) {} - virtual void mingle() { + void mingle() override { int sum = 0; for (size_t i = 0; i < size(); ++i) { sum += in(i); diff --git a/vespalib/src/tests/runnable_pair/runnable_pair_test.cpp b/vespalib/src/tests/runnable_pair/runnable_pair_test.cpp index c2ba5b3dc91..6d989070e03 100644 --- a/vespalib/src/tests/runnable_pair/runnable_pair_test.cpp +++ b/vespalib/src/tests/runnable_pair/runnable_pair_test.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 + #include #include @@ -8,13 +8,13 @@ using namespace vespalib; struct Add : public Runnable { int &val; Add(int &v) : val(v) {} - virtual void run() { val += 10; } + void run() override { val += 10; } }; struct Mul : public Runnable { int &val; Mul(int &v) : val(v) {} - virtual void run() { val *= 10; } + void run() override { val *= 10; } }; TEST("require that runnable pair runs runnables in order") { diff --git a/vespalib/src/tests/rwlock/rwlock_test.cpp b/vespalib/src/tests/rwlock/rwlock_test.cpp index b4e5bd1f98f..a716e4d0652 100644 --- a/vespalib/src/tests/rwlock/rwlock_test.cpp +++ b/vespalib/src/tests/rwlock/rwlock_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 -#include -LOG_SETUP("rwlock_test"); + #include #include @@ -10,7 +8,7 @@ using namespace vespalib; class RWLockTest : public TestApp { public: - int Main(); + int Main() override; static RWLockReader rbvReader(RWLock & lock) { RWLockReader r(lock); return r; } static RWLockWriter rbvWriter(RWLock & lock) { RWLockWriter r(lock); return r; } }; diff --git a/vespalib/src/tests/sharedptr/ptrholder.cpp b/vespalib/src/tests/sharedptr/ptrholder.cpp index 1f73efb141d..ecb959355ff 100644 --- a/vespalib/src/tests/sharedptr/ptrholder.cpp +++ b/vespalib/src/tests/sharedptr/ptrholder.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 -#include -LOG_SETUP("ptrholder_test"); + #include #include @@ -13,7 +11,7 @@ class Test : public vespalib::TestApp public: void testEmpty(); void testSimple(); - int Main(); + int Main() override; }; diff --git a/vespalib/src/tests/simple_thread_bundle/simple_thread_bundle_test.cpp b/vespalib/src/tests/simple_thread_bundle/simple_thread_bundle_test.cpp index 937f2c2bbd5..b5152fdf56a 100644 --- a/vespalib/src/tests/simple_thread_bundle/simple_thread_bundle_test.cpp +++ b/vespalib/src/tests/simple_thread_bundle/simple_thread_bundle_test.cpp @@ -1,5 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include #include #include #include @@ -12,7 +11,7 @@ using namespace vespalib::fixed_thread_bundle; struct Cnt : Runnable { size_t x; Cnt() : x(0) {} - virtual void run() { ++x; } + void run() override { ++x; } }; struct State { @@ -38,7 +37,7 @@ struct State { struct Blocker : Runnable { Gate start; - virtual void run() { + void run() override { start.await(); } Gate done; // set externally diff --git a/vespalib/src/tests/simple_thread_bundle/threading_speed_test.cpp b/vespalib/src/tests/simple_thread_bundle/threading_speed_test.cpp index 417d8b20b56..e9a3b4e4514 100644 --- a/vespalib/src/tests/simple_thread_bundle/threading_speed_test.cpp +++ b/vespalib/src/tests/simple_thread_bundle/threading_speed_test.cpp @@ -22,7 +22,7 @@ struct Worker : Runnable { iter = n; input = i; } - virtual void run() { + void run() override { uint64_t value = input; for (size_t i = 0; i < iter; ++i) { value = doWork(value); diff --git a/vespalib/src/tests/stllike/asciistream_test.cpp b/vespalib/src/tests/stllike/asciistream_test.cpp index 78c81f9d578..63066a1bf14 100644 --- a/vespalib/src/tests/stllike/asciistream_test.cpp +++ b/vespalib/src/tests/stllike/asciistream_test.cpp @@ -1,8 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -#include -LOG_SETUP("identifiable_test"); + #include #include #include @@ -14,7 +11,7 @@ using namespace vespalib; class AsciistreamTest : public TestApp { public: - int Main(); + int Main() override; template void verify(T first, T second, const char * firstResult, const char * secondResult, char delim); template diff --git a/vespalib/src/tests/stringfmt/fmt.cpp b/vespalib/src/tests/stringfmt/fmt.cpp index d5d6cef3854..af8f5437beb 100644 --- a/vespalib/src/tests/stringfmt/fmt.cpp +++ b/vespalib/src/tests/stringfmt/fmt.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 -#include -LOG_SETUP("stringfmt_test"); + #include #include #include @@ -13,27 +11,14 @@ class Test : public vespalib::TestApp { public: void testSimple(); - int Main(); + int Main() override; }; -/* -static bool eq(const std::string& a, const std::string& b) -{ - if (a == b) { - return true; - } else { - LOG(warning, "a(%s) != b(%s)", a.c_str(), b.c_str()); - return false; - } -} -*/ - static bool eq(const vespalib::string& a, const vespalib::string& b) { if (a == b) { return true; } else { - LOG(warning, "a(%s) != b(%s)", a.c_str(), b.c_str()); return false; } } diff --git a/vespalib/src/tests/sync/sync_test.cpp b/vespalib/src/tests/sync/sync_test.cpp index 5f71c845326..16c044a9902 100644 --- a/vespalib/src/tests/sync/sync_test.cpp +++ b/vespalib/src/tests/sync/sync_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 -#include -LOG_SETUP("sync_test"); + #include #include @@ -21,7 +19,7 @@ private: MonitorGuard obtainMonitor() { return MonitorGuard(_monitor); } public: void testCountDownLatch(); - int Main(); + int Main() override; }; void diff --git a/vespalib/src/tests/thread/thread_test.cpp b/vespalib/src/tests/thread/thread_test.cpp index 76c6ccdee1d..17aa13959ea 100644 --- a/vespalib/src/tests/thread/thread_test.cpp +++ b/vespalib/src/tests/thread/thread_test.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 + #include #include @@ -9,7 +9,7 @@ struct Agent : public Runnable { bool started; int loopCnt; Agent() : started(false), loopCnt(0) {} - virtual void run() { + void run() override { started = true; Thread &thread = Thread::currentThread(); while (thread.slumber(60.0)) { diff --git a/vespalib/src/tests/trace/trace.cpp b/vespalib/src/tests/trace/trace.cpp index 92b5917891c..7e3ead52206 100644 --- a/vespalib/src/tests/trace/trace.cpp +++ b/vespalib/src/tests/trace/trace.cpp @@ -24,7 +24,7 @@ private: void testTimestamp(); public: - int Main(); + int Main() override; }; TEST_APPHOOK(Test); @@ -347,18 +347,18 @@ Test::testTraceDump() struct EncoderVisitor : public TraceVisitor { vespalib::string str; - void entering(const TraceNode & traceNode) { + void entering(const TraceNode & traceNode) override { (void) traceNode; str += "("; } - void visit(const TraceNode & traceNode) { + void visit(const TraceNode & traceNode) override { if (traceNode.hasNote()) { str += "["; str += traceNode.getNote(); str += "]"; } } - void leaving(const TraceNode & traceNode) { + void leaving(const TraceNode & traceNode) override { (void) traceNode; str += ")"; } diff --git a/vespalib/src/tests/util/generationhandler/generationhandler_test.cpp b/vespalib/src/tests/util/generationhandler/generationhandler_test.cpp index c3d7b874c36..4964a49f8ed 100644 --- a/vespalib/src/tests/util/generationhandler/generationhandler_test.cpp +++ b/vespalib/src/tests/util/generationhandler/generationhandler_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 -#include -LOG_SETUP("generationhandler_test"); + #include #include #include @@ -18,7 +16,7 @@ private: void requireThatTheFirstUsedGenerationIsCorrect(); void requireThatGenerationCanGrowLarge(); public: - int Main(); + int Main() override; }; void diff --git a/vespalib/src/tests/valgrind/valgrind_test.cpp b/vespalib/src/tests/valgrind/valgrind_test.cpp index 443f6814c5c..f5a4105378f 100644 --- a/vespalib/src/tests/valgrind/valgrind_test.cpp +++ b/vespalib/src/tests/valgrind/valgrind_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 -#include -LOG_SETUP("valgrind_test"); + #include #include @@ -9,7 +7,7 @@ using namespace vespalib; class Test : public TestApp { - int Main(); + int Main() override; void testUninitializedUser(); void testUninitializedSystemCall(); void testInitializedUser(); diff --git a/vespalib/src/tests/weakref/weakref_test.cpp b/vespalib/src/tests/weakref/weakref_test.cpp index 9da22c308c3..d5cca8b6ed2 100644 --- a/vespalib/src/tests/weakref/weakref_test.cpp +++ b/vespalib/src/tests/weakref/weakref_test.cpp @@ -1,19 +1,16 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -LOG_SETUP("weakref_test"); + #include #include using vespalib::WeakRef; - class Test : public vespalib::TestApp { public: int getFive() { return 5; } void testSimple(); - int Main(); + int Main() override; }; -- cgit v1.2.3