diff options
author | Arne H Juul <arnej27959@users.noreply.github.com> | 2017-04-24 12:10:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-24 12:10:42 +0200 |
commit | 9ff4bdb407ed8d855a3f86a17c99906ff738177b (patch) | |
tree | fc2b050224d7dde92d57e1f9cac12c1e5aaf6b90 /staging_vespalib | |
parent | 32ae190acc9ac5081049e1c7008d1602c68cf821 (diff) |
Revert "Balder/enforce override 2"
Diffstat (limited to 'staging_vespalib')
23 files changed, 150 insertions, 81 deletions
diff --git a/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp b/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp index 75092255f9e..ce21c918219 100644 --- a/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp +++ b/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp @@ -1,4 +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/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/rusage.h> #include <vespa/vespalib/util/optimized.h> diff --git a/staging_vespalib/src/tests/array/allocinarray_test.cpp b/staging_vespalib/src/tests/array/allocinarray_test.cpp index c68cc3fa874..059fff91cec 100644 --- a/staging_vespalib/src/tests/array/allocinarray_test.cpp +++ b/staging_vespalib/src/tests/array/allocinarray_test.cpp @@ -1,10 +1,14 @@ // 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> #include <vespa/vespalib/util/array.h> #include <vespa/vespalib/util/allocinarray.h> #include <vespa/vespalib/stllike/string.h> #include <vespa/vespalib/testkit/testapp.h> #include <deque> +LOG_SETUP("array_test"); + using namespace vespalib; class Test : public TestApp diff --git a/staging_vespalib/src/tests/array/sort_benchmark.cpp b/staging_vespalib/src/tests/array/sort_benchmark.cpp index 29f1560e426..9e2b286e864 100644 --- a/staging_vespalib/src/tests/array/sort_benchmark.cpp +++ b/staging_vespalib/src/tests/array/sort_benchmark.cpp @@ -1,4 +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/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/rusage.h> #include <vespa/vespalib/util/array.hpp> diff --git a/staging_vespalib/src/tests/benchmark/testbase.h b/staging_vespalib/src/tests/benchmark/testbase.h index beb485e6dab..02f11e21cac 100644 --- a/staging_vespalib/src/tests/benchmark/testbase.h +++ b/staging_vespalib/src/tests/benchmark/testbase.h @@ -45,7 +45,7 @@ public: private: typedef std::vector<int> Vector; size_t callByReference(const Vector & values) const __attribute__((noinline)); - size_t onRun() override; + virtual size_t onRun() override; }; class ParamByValueVectorInt : public Benchmark @@ -55,7 +55,7 @@ public: private: typedef std::vector<int> Vector; size_t callByValue(Vector values) const __attribute__((noinline)); - size_t onRun() override; + virtual size_t onRun() override; }; class ParamByReferenceVectorString : public Benchmark @@ -65,7 +65,7 @@ public: private: typedef std::vector<std::string> Vector; size_t callByReference(const Vector & values) const __attribute__((noinline)); - size_t onRun() override; + virtual size_t onRun() override; }; class ParamByValueVectorString : public Benchmark @@ -75,7 +75,7 @@ public: private: typedef std::vector<std::string> Vector; size_t callByValue(Vector values) const __attribute__((noinline)); - size_t onRun() override; + virtual size_t onRun() override; }; class ReturnByReferenceVectorString : public Benchmark @@ -85,7 +85,7 @@ public: private: typedef std::vector<std::string> Vector; const Vector & returnByReference(Vector & values) const __attribute__((noinline)); - size_t onRun() override; + virtual size_t onRun() override; }; class ReturnByValueVectorString : public Benchmark @@ -95,7 +95,7 @@ public: private: typedef std::vector<std::string> Vector; Vector returnByValue() const __attribute__((noinline)); - size_t onRun() override; + virtual size_t onRun() override; }; class ReturnByValueMultiVectorString : public Benchmark @@ -105,7 +105,7 @@ public: private: typedef std::vector<std::string> Vector; Vector returnByValue() const __attribute__((noinline)); - size_t onRun() override; + virtual size_t onRun() override; }; class CreateVespalibString : public Benchmark @@ -113,7 +113,7 @@ class CreateVespalibString : public Benchmark public: DECLARE_BENCHMARK(CreateVespalibString); private: - size_t onRun() override; + virtual size_t onRun() override; }; class ClockSystem : public Benchmark @@ -121,7 +121,7 @@ class ClockSystem : public Benchmark public: DECLARE_BENCHMARK(ClockSystem); private: - size_t onRun() override; + virtual size_t onRun() override; }; class ClockREALTIME : public Benchmark @@ -129,7 +129,7 @@ class ClockREALTIME : public Benchmark public: DECLARE_BENCHMARK(ClockREALTIME); private: - size_t onRun() override; + virtual size_t onRun() override; }; class ClockMONOTONIC : public Benchmark @@ -137,7 +137,7 @@ class ClockMONOTONIC : public Benchmark public: DECLARE_BENCHMARK(ClockMONOTONIC); private: - size_t onRun() override; + virtual size_t onRun() override; }; class ClockMONOTONIC_RAW : public Benchmark @@ -146,7 +146,7 @@ public: DECLARE_BENCHMARK(ClockMONOTONIC_RAW); ClockMONOTONIC_RAW(); private: - size_t onRun() override; + virtual size_t onRun() override; }; class ClockPROCESS_CPUTIME_ID : public Benchmark @@ -154,7 +154,7 @@ class ClockPROCESS_CPUTIME_ID : public Benchmark public: DECLARE_BENCHMARK(ClockPROCESS_CPUTIME_ID); private: - size_t onRun() override; + virtual size_t onRun() override; }; class ClockTHREAD_CPUTIME_ID : public Benchmark @@ -162,7 +162,8 @@ class ClockTHREAD_CPUTIME_ID : public Benchmark public: DECLARE_BENCHMARK(ClockTHREAD_CPUTIME_ID); private: - size_t onRun() override; + virtual size_t onRun() override; }; } + diff --git a/staging_vespalib/src/tests/bits/bits_test.cpp b/staging_vespalib/src/tests/bits/bits_test.cpp index 783651db366..f7b3ef1bf84 100644 --- a/staging_vespalib/src/tests/bits/bits_test.cpp +++ b/staging_vespalib/src/tests/bits/bits_test.cpp @@ -1,5 +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 <vespa/log/log.h> +LOG_SETUP("bits_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/bits.h> #include <boost/crc.hpp> diff --git a/staging_vespalib/src/tests/clock/clock_test.cpp b/staging_vespalib/src/tests/clock/clock_test.cpp index 58a01a520b6..025d8766a29 100644 --- a/staging_vespalib/src/tests/clock/clock_test.cpp +++ b/staging_vespalib/src/tests/clock/clock_test.cpp @@ -1,7 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#include <vespa/vespalib/testkit/testapp.h> +#include <vespa/fastos/fastos.h> +#include <vespa/log/log.h> +LOG_SETUP("sharedptr_test"); #include <vespa/vespalib/util/clock.h> +#include <vespa/vespalib/testkit/testapp.h> using vespalib::Clock; using fastos::TimeStamp; diff --git a/staging_vespalib/src/tests/crc/crc_test.cpp b/staging_vespalib/src/tests/crc/crc_test.cpp index df8ac89db62..6a5a0779d8b 100644 --- a/staging_vespalib/src/tests/crc/crc_test.cpp +++ b/staging_vespalib/src/tests/crc/crc_test.cpp @@ -1,5 +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 <vespa/log/log.h> +LOG_SETUP("crc_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/crc.h> #include <boost/crc.hpp> diff --git a/staging_vespalib/src/tests/databuffer/databuffer_test.cpp b/staging_vespalib/src/tests/databuffer/databuffer_test.cpp index 1a242e8eec4..7ec83e58b5c 100644 --- a/staging_vespalib/src/tests/databuffer/databuffer_test.cpp +++ b/staging_vespalib/src/tests/databuffer/databuffer_test.cpp @@ -1,4 +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 <vespa/log/log.h> +LOG_SETUP("databuffer_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/data/databuffer.h> diff --git a/staging_vespalib/src/tests/fileheader/fileheader_test.cpp b/staging_vespalib/src/tests/fileheader/fileheader_test.cpp index 55ca571cdac..f2a6c8402ee 100644 --- a/staging_vespalib/src/tests/fileheader/fileheader_test.cpp +++ b/staging_vespalib/src/tests/fileheader/fileheader_test.cpp @@ -1,8 +1,10 @@ // 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("fileheader_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/data/fileheader.h> -#include <vespa/fastos/file.h> #include <iostream> using namespace vespalib; @@ -27,9 +29,15 @@ private: void testRewriteErrors(); void testLayout(); - void testReadSize(bool mapped); - void testReadSizeErrors(bool mapped); - bool testReadSizeError(DataBuffer &buf, const std::string &expected, bool mapped); + void + testReadSize(bool mapped); + + void + testReadSizeErrors(bool mapped); + + bool + testReadSizeError(DataBuffer &buf, const std::string &expected, + bool mapped); public: int Main() override { diff --git a/staging_vespalib/src/tests/floatingpointtype/floatingpointtypetest.cpp b/staging_vespalib/src/tests/floatingpointtype/floatingpointtypetest.cpp index 19e52dbe885..98b6804ac8e 100644 --- a/staging_vespalib/src/tests/floatingpointtype/floatingpointtypetest.cpp +++ b/staging_vespalib/src/tests/floatingpointtype/floatingpointtypetest.cpp @@ -1,7 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + // Include first to make sure it includes all it need. +#include <vespa/fastos/fastos.h> +#include <vespa/vespalib/objects/floatingpointtype.h> #include <vespa/vespalib/testkit/testapp.h> -#include <vespa/vespalib/objects/floatingpointtype.h> class Test : public vespalib::TestApp { diff --git a/staging_vespalib/src/tests/growablebytebuffer/growablebytebuffer_test.cpp b/staging_vespalib/src/tests/growablebytebuffer/growablebytebuffer_test.cpp index 1ba9c912344..aaf3f383c33 100644 --- a/staging_vespalib/src/tests/growablebytebuffer/growablebytebuffer_test.cpp +++ b/staging_vespalib/src/tests/growablebytebuffer/growablebytebuffer_test.cpp @@ -1,5 +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 <vespa/log/log.h> +LOG_SETUP("guard_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/growablebytebuffer.h> diff --git a/staging_vespalib/src/tests/librarypool/librarypool_test.cpp b/staging_vespalib/src/tests/librarypool/librarypool_test.cpp index 87e04d3ffbd..665dbca8a86 100644 --- a/staging_vespalib/src/tests/librarypool/librarypool_test.cpp +++ b/staging_vespalib/src/tests/librarypool/librarypool_test.cpp @@ -1,7 +1,10 @@ // 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/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/librarypool.h> #include <vespa/vespalib/util/exceptions.h> +#include <vespa/log/log.h> +LOG_SETUP("librarypool_test"); using namespace vespalib; diff --git a/staging_vespalib/src/tests/memorydatastore/memorydatastore.cpp b/staging_vespalib/src/tests/memorydatastore/memorydatastore.cpp index 5a1c0d7fb32..5430e8c1465 100644 --- a/staging_vespalib/src/tests/memorydatastore/memorydatastore.cpp +++ b/staging_vespalib/src/tests/memorydatastore/memorydatastore.cpp @@ -1,8 +1,11 @@ // 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("data_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/data/memorydatastore.h> #include <vespa/vespalib/stllike/asciistream.h> +#include <vector> using namespace vespalib; diff --git a/staging_vespalib/src/tests/objectdump/objectdump.cpp b/staging_vespalib/src/tests/objectdump/objectdump.cpp index 3bdbe2401e4..671e89b5011 100644 --- a/staging_vespalib/src/tests/objectdump/objectdump.cpp +++ b/staging_vespalib/src/tests/objectdump/objectdump.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/vespalib/testkit/testapp.h> #include <vespa/vespalib/objects/identifiable.h> #include <vespa/vespalib/objects/visit.hpp> @@ -22,7 +22,7 @@ IMPLEMENT_IDENTIFIABLE(Base, vespalib::Identifiable); struct Baz : public Base { DECLARE_IDENTIFIABLE(Baz); - Baz *clone() const override { return new Baz(*this); } + virtual Baz *clone() const override { return new Baz(*this); } }; IMPLEMENT_IDENTIFIABLE(Baz, Base); @@ -45,9 +45,9 @@ struct Bar : public Base _int32(-4), _uint32(4), _int64(-8), _uint64(8), _float(2.5), _double(2.75), _string("bla bla") {} - Bar *clone() const override { return new Bar(*this); } + virtual Bar *clone() const override { return new Bar(*this); } - void visitMembers(ObjectVisitor &v) const override { + virtual void visitMembers(ObjectVisitor &v) const override { visit(v, "_bool", _bool); visit(v, "_int8", _int8); visit(v, "_uint8", _uint8); diff --git a/staging_vespalib/src/tests/objects/identifiable_test.cpp b/staging_vespalib/src/tests/objects/identifiable_test.cpp index 5ef48b6e779..c60f33b9b55 100644 --- a/staging_vespalib/src/tests/objects/identifiable_test.cpp +++ b/staging_vespalib/src/tests/objects/identifiable_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 <vespa/fastos/fastos.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/objects/identifiable.hpp> #include <vespa/vespalib/objects/namedobject.h> @@ -40,7 +40,7 @@ class A : public Abstract public: DECLARE_IDENTIFIABLE(A); A() { } - void someAbstractVirtualMethod() override { }; + virtual void someAbstractVirtualMethod() override { } }; class B : public A diff --git a/staging_vespalib/src/tests/objectselection/objectselection.cpp b/staging_vespalib/src/tests/objectselection/objectselection.cpp index db696230082..27ecb068231 100644 --- a/staging_vespalib/src/tests/objectselection/objectselection.cpp +++ b/staging_vespalib/src/tests/objectselection/objectselection.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/vespalib/testkit/testapp.h> #include <vespa/vespalib/objects/identifiable.hpp> #include <vespa/vespalib/objects/objectpredicate.h> @@ -17,7 +17,7 @@ struct Foo : public Identifiable DECLARE_IDENTIFIABLE(Foo); virtual Foo *clone() const { return new Foo(*this); } - void selectMembers(const ObjectPredicate &p, ObjectOperation &o) override { + virtual void selectMembers(const ObjectPredicate &p, ObjectOperation &o) override { for (uint32_t i = 0; i < nodes.size(); ++i) { nodes[i]->select(p, o); } @@ -32,7 +32,7 @@ struct Bar : public Foo DECLARE_IDENTIFIABLE(Bar); Bar() : value(0) {} Bar(int v) { value = v; } - Bar *clone() const override { return new Bar(*this); } + virtual Bar *clone() const override { return new Bar(*this); } }; IMPLEMENT_IDENTIFIABLE(Bar, Identifiable); @@ -40,7 +40,7 @@ struct ObjectType : public ObjectPredicate { uint32_t cid; ObjectType(uint32_t id) : cid(id) {} - bool check(const Identifiable &obj) const override { + virtual bool check(const Identifiable &obj) const override { return (obj.getClass().id() == cid); } }; @@ -48,7 +48,7 @@ struct ObjectType : public ObjectPredicate struct ObjectCollect : public ObjectOperation { std::vector<Identifiable*> nodes; - void execute(Identifiable &obj) override { + virtual void execute(Identifiable &obj) override { nodes.push_back(&obj); } }; diff --git a/staging_vespalib/src/tests/polymorphicarray/polymorphicarray_test.cpp b/staging_vespalib/src/tests/polymorphicarray/polymorphicarray_test.cpp index a1c8a31729c..affb7287674 100644 --- a/staging_vespalib/src/tests/polymorphicarray/polymorphicarray_test.cpp +++ b/staging_vespalib/src/tests/polymorphicarray/polymorphicarray_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 <vespa/fastos/fastos.h> #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/vespalib/util/polymorphicarrays.h> @@ -112,7 +112,7 @@ class Factory : public ComplexArrayT<A>::Factory { public: A * create() override { return new Complex(); } - Factory * clone() const override { return new Factory(*this); } + virtual Factory * clone() const override { return new Factory(*this); } }; TEST("require that complex arrays conforms") { diff --git a/staging_vespalib/src/tests/programoptions/programoptions_test.cpp b/staging_vespalib/src/tests/programoptions/programoptions_test.cpp index 709f8a3b723..881954bfa3f 100644 --- a/staging_vespalib/src/tests/programoptions/programoptions_test.cpp +++ b/staging_vespalib/src/tests/programoptions/programoptions_test.cpp @@ -1,9 +1,14 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/vespalib/testkit/testapp.h> +#include <vespa/fastos/fastos.h> #include <vespa/vespalib/util/programoptions.h> #include <vespa/vespalib/util/programoptions_testutils.h> + #include <iostream> +#include <vespa/log/log.h> +#include <vespa/vespalib/testkit/testapp.h> + +LOG_SETUP("programoptions_test"); namespace vespalib { diff --git a/staging_vespalib/src/tests/rusage/rusage_test.cpp b/staging_vespalib/src/tests/rusage/rusage_test.cpp index 5094bd8b5c9..0367ab8c374 100644 --- a/staging_vespalib/src/tests/rusage/rusage_test.cpp +++ b/staging_vespalib/src/tests/rusage/rusage_test.cpp @@ -1,5 +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 <stddef.h> +#include <vespa/log/log.h> +LOG_SETUP("alloc_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/rusage.h> diff --git a/staging_vespalib/src/tests/state_server/state_server_test.cpp b/staging_vespalib/src/tests/state_server/state_server_test.cpp index e15a3826669..f572dbcd8e1 100644 --- a/staging_vespalib/src/tests/state_server/state_server_test.cpp +++ b/staging_vespalib/src/tests/state_server/state_server_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 <vespa/fastos/fastos.h> #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/vespalib/net/state_server.h> #include <vespa/vespalib/net/simple_health_producer.h> @@ -52,8 +52,10 @@ vespalib::string getFull(int port, const vespalib::string &path) { return getPag struct DummyHandler : JsonGetHandler { vespalib::string result; DummyHandler(const vespalib::string &result_in) : result(result_in) {} - vespalib::string get(const vespalib::string &, const vespalib::string &, - const std::map<vespalib::string,vespalib::string> &) const override + virtual vespalib::string get(const vespalib::string &, + const vespalib::string &, + const std::map<vespalib::string,vespalib::string> &) + const override { return result; } @@ -111,8 +113,10 @@ TEST_FFFF("require that handler is selected based on longest matching url prefix } struct EchoHost : JsonGetHandler { - vespalib::string get(const vespalib::string &host, const vespalib::string &, - const std::map<vespalib::string,vespalib::string> &) const override + virtual vespalib::string get(const vespalib::string &host, + const vespalib::string &, + const std::map<vespalib::string,vespalib::string> &) + const override { return "[\"" + host + "\"]"; } @@ -312,11 +316,11 @@ TEST_FFFFF("require that custom handlers can be added to the state server", } struct EchoConsumer : MetricsProducer { - vespalib::string getMetrics(const vespalib::string &consumer) override { + virtual vespalib::string getMetrics(const vespalib::string &consumer) override { return "[\"" + consumer + "\"]"; } - vespalib::string getTotalMetrics(const vespalib::string &consumer) override { - return "[\"" + consumer + "\"]"; + virtual vespalib::string getTotalMetrics(const vespalib::string &consumer) override { + return "[\"" + consumer + "\"]"; } }; diff --git a/staging_vespalib/src/tests/timer/timer_test.cpp b/staging_vespalib/src/tests/timer/timer_test.cpp index 21b60b828cc..ad782f4089f 100644 --- a/staging_vespalib/src/tests/timer/timer_test.cpp +++ b/staging_vespalib/src/tests/timer/timer_test.cpp @@ -1,5 +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 <vespa/log/log.h> +LOG_SETUP("timer_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/timer.h> #include <vespa/vespalib/util/executor.h> diff --git a/staging_vespalib/src/tests/xmlserializable/xmlserializabletest.cpp b/staging_vespalib/src/tests/xmlserializable/xmlserializabletest.cpp index 90fcdb8f94f..1035c021f68 100644 --- a/staging_vespalib/src/tests/xmlserializable/xmlserializabletest.cpp +++ b/staging_vespalib/src/tests/xmlserializable/xmlserializabletest.cpp @@ -1,8 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/vespalib/testkit/testapp.h> +#include <vespa/fastos/fastos.h> #include <vespa/vespalib/util/xmlserializable.h> +#include <vespa/vespalib/testkit/testapp.h> + namespace vespalib { class Test : public vespalib::TestApp diff --git a/staging_vespalib/src/vespa/vespalib/util/programoptions.h b/staging_vespalib/src/vespa/vespalib/util/programoptions.h index 9e25f960af7..58d1d133d04 100644 --- a/staging_vespalib/src/vespa/vespalib/util/programoptions.h +++ b/staging_vespalib/src/vespa/vespalib/util/programoptions.h @@ -23,10 +23,12 @@ #pragma once -#include <vespa/vespalib/util/exception.h> #include <map> #include <set> +#include <string> #include <vector> +#include <stdint.h> +#include <vespa/vespalib/util/exception.h> namespace vespalib { @@ -235,9 +237,9 @@ struct ProgramOptions::OptionParser { struct ProgramOptions::OptionHeader : public OptionParser { OptionHeader(const std::string& desc) : OptionParser("", 0, desc) {} - void set(const std::vector<std::string>&) override {} - void setDefault() override {} - bool isHeader() const override { return true; } + virtual void set(const std::vector<std::string>&) override {} + virtual void setDefault() override {} + virtual bool isHeader() const override { return true; } }; template<typename Number> @@ -260,45 +262,61 @@ struct ProgramOptions::NumberOptionParser : public OptionParser { : OptionParser(nameList, 1, getStringValue(defValue), desc), _number(number), _defaultValue(defValue) - {} - - void set(const std::vector<std::string>& arguments) override; - void setDefault() override { _number = _defaultValue; } - std::string getArgType(uint32_t /* index */) const override { - return getTypeName<Number>(); + { } + + virtual void set(const std::vector<std::string>& arguments) override; + + virtual void setDefault() override { _number = _defaultValue; } + + virtual std::string getArgType(uint32_t /* index */) const override + { return getTypeName<Number>(); } + }; struct ProgramOptions::BoolOptionParser : public OptionParser { bool& _value; bool _defaultValue; - BoolOptionParser(const std::string& nameList, bool& value, const std::string& description); - void set(const std::vector<std::string>&) override { _value = true; } - void setDefault() override { _value = false; } + BoolOptionParser(const std::string& nameList, bool& value, + const std::string& description); + + virtual void set(const std::vector<std::string>&) override { _value = true; } + + virtual void setDefault() override { _value = false; } }; struct ProgramOptions::FlagOptionParser : public OptionParser { bool& _value; bool _unsetValue; - FlagOptionParser(const std::string& nameList, bool& value, const std::string& description); - FlagOptionParser(const std::string& nameList, bool& value, const bool& unsetValue, const std::string& description); - void set(const std::vector<std::string>&) override { _value = !_unsetValue; } - void setDefault() override { _value = _unsetValue; } + FlagOptionParser(const std::string& nameList, bool& value, + const std::string& description); + FlagOptionParser(const std::string& nameList, bool& value, + const bool& unsetValue, const std::string& description); + + virtual void set(const std::vector<std::string>&) override { _value = !_unsetValue; } + + virtual void setDefault() override { _value = _unsetValue; } }; struct ProgramOptions::StringOptionParser : public OptionParser { std::string& _value; std::string _defaultValue; - StringOptionParser(const std::string& nameList, std::string& value, const std::string& description); + StringOptionParser(const std::string& nameList, std::string& value, + const std::string& description); + StringOptionParser(const std::string& nameList, std::string& value, const std::string& defVal, const std::string& desc); - void set(const std::vector<std::string>& arguments) override { _value = arguments[0]; } - void setDefault() override { _value = _defaultValue; } - std::string getArgType(uint32_t /* index */) const override { return "string"; } + virtual void set(const std::vector<std::string>& arguments) override + { _value = arguments[0]; } + + virtual void setDefault() override { _value = _defaultValue; } + + virtual std::string getArgType(uint32_t /* index */) const override + { return "string"; } }; struct ProgramOptions::MapOptionParser : public OptionParser { @@ -309,14 +327,14 @@ struct ProgramOptions::MapOptionParser : public OptionParser { std::map<std::string, std::string>& value, const std::string& description); - void set(const std::vector<std::string>& arguments) override { - _value[arguments[0]] = arguments[1]; - } + virtual void set(const std::vector<std::string>& arguments) override + { _value[arguments[0]] = arguments[1]; } - std::string getArgType(uint32_t /* index */) const override { return "string"; } + virtual std::string getArgType(uint32_t /* index */) const override + { return "string"; } - // Default of map is just an empty map. - void setDefault() override { _value.clear(); } + // Default of map is just an empty map. + virtual void setDefault() override { _value.clear(); } }; template<typename T> @@ -338,8 +356,9 @@ struct ProgramOptions::ListOptionParser : public OptionParser { void setEntryParser(OptionParser::UP entryParser) { _entryParser = std::move(entryParser); } - bool isRequired() const override { return false; } - void set(const std::vector<std::string>& arguments) override { + + virtual bool isRequired() const override { return false; } + virtual void set(const std::vector<std::string>& arguments) override { for (uint32_t i=0; i<arguments.size(); ++i) { std::vector<std::string> v; v.push_back(arguments[i]); @@ -347,10 +366,10 @@ struct ProgramOptions::ListOptionParser : public OptionParser { _value.push_back(_singleValue); } } - void setDefault() override { + virtual void setDefault() override { _value.clear(); } - std::string getArgType(uint32_t index) const override { + virtual std::string getArgType(uint32_t index) const override { return _entryParser->getArgType(index) + "[]"; } }; |