From 7a4461355f7ee8e5ec71888516cbfd640dd7e110 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 18 Aug 2017 03:02:49 +0200 Subject: Include only what you need. --- config/src/apps/vespa-get-config/getconfig.cpp | 2 +- config/src/tests/configgen/value_converter.cpp | 1 + .../tests/frtconnectionpool/frtconnectionpool.cpp | 1 + config/src/tests/functiontest/functiontest.cpp | 4 +- config/src/tests/misc/configsystem.cpp | 1 + config/src/tests/print/print.cpp | 1 + config/src/vespa/config/common/configvalue.h | 11 ++-- config/src/vespa/config/frt/frtconfigagent.cpp | 8 +-- .../config/subscription/configsubscriptionset.cpp | 4 +- configd/src/apps/sentinel/config-handler.cpp | 2 + document/src/tests/documenttestcase.cpp | 1 + document/src/tests/documentupdatetestcase.cpp | 2 + document/src/tests/fieldpathupdatetestcase.cpp | 2 +- document/src/tests/predicate/predicate_test.cpp | 7 ++- .../src/vespa/document/predicate/predicate.cpp | 1 + documentapi/src/tests/messages/messages50test.h | 2 +- documentapi/src/tests/messages/messages51test.h | 2 +- documentapi/src/tests/messages/testbase.cpp | 3 + .../documentapi/messagebus/messages/visitor.cpp | 1 + fastlib/src/vespa/fastlib/io/bufferedfile.cpp | 2 + .../vespa/fastlib/io/tests/bufferedstreamtest.cpp | 1 + fastlib/src/vespa/fastlib/net/httpserver.cpp | 1 + fastlib/src/vespa/fastlib/text/normwordfolder.cpp | 1 + .../src/vespa/fastlib/util/tests/base64test.cpp | 1 + fastos/src/tests/filetest.cpp | 2 + fastos/src/tests/sockettest.cpp | 2 +- fastos/src/tests/tests.h | 1 + fastos/src/tests/typetest.cpp | 35 ----------- fastos/src/vespa/fastos/CMakeLists.txt | 1 + fastos/src/vespa/fastos/app.cpp | 14 +++-- fastos/src/vespa/fastos/cond.h | 4 +- fastos/src/vespa/fastos/file.cpp | 20 +++++- fastos/src/vespa/fastos/file.h | 17 +---- fastos/src/vespa/fastos/linux_file.cpp | 5 +- fastos/src/vespa/fastos/mutex.h | 13 ++-- fastos/src/vespa/fastos/process.h | 20 +----- fastos/src/vespa/fastos/serversocket.cpp | 13 +++- fastos/src/vespa/fastos/serversocket.h | 12 +--- fastos/src/vespa/fastos/socket.cpp | 5 +- fastos/src/vespa/fastos/socketevent.cpp | 7 ++- fastos/src/vespa/fastos/socketevent.h | 4 +- fastos/src/vespa/fastos/thread.cpp | 4 +- fastos/src/vespa/fastos/thread.h | 6 +- fastos/src/vespa/fastos/types.h | 28 +-------- fastos/src/vespa/fastos/unix_app.cpp | 40 ++++++++++-- fastos/src/vespa/fastos/unix_app.h | 34 ++-------- fastos/src/vespa/fastos/unix_dynamiclibrary.cpp | 2 +- fastos/src/vespa/fastos/unix_file.cpp | 12 +++- fastos/src/vespa/fastos/unix_file.h | 3 +- fastos/src/vespa/fastos/unix_ipc.cpp | 12 ++-- fastos/src/vespa/fastos/unix_mutex.cpp | 3 +- fastos/src/vespa/fastos/unix_mutex.h | 4 +- fastos/src/vespa/fastos/unix_process.cpp | 73 ++++++++++++++++++++-- fastos/src/vespa/fastos/unix_process.h | 73 +++------------------- fastos/src/vespa/fastos/unix_socket.cpp | 6 +- fastos/src/vespa/fastos/unix_thread.cpp | 20 ++++-- fastos/src/vespa/fastos/unix_thread.h | 18 +----- fbench/src/fbench/client.cpp | 6 +- fbench/src/fbench/client.h | 12 ++-- fbench/src/fbench/fbench.cpp | 6 +- fbench/src/httpclient/httpclient.cpp | 2 + fbench/src/test/clientstatus.cpp | 3 +- fbench/src/test/httpclient.cpp | 2 +- fbench/src/test/httpclient_splitstring.cpp | 1 + fnet/src/vespa/fnet/iocomponent.cpp | 3 +- fnet/src/vespa/fnet/packetqueue.cpp | 1 + logd/src/logd/watch.cpp | 8 ++- logd/src/tests/forward/forward.cpp | 2 + .../memfilepersistence/common/environment.cpp | 6 +- .../memfilepersistence/device/mountpointlist.cpp | 1 + .../mapper/bufferedfilewriter.cpp | 1 + .../memfilepersistence/mapper/bufferedfilewriter.h | 10 +-- metrics/src/vespa/metrics/jsonwriter.cpp | 11 ++-- metrics/src/vespa/metrics/loadmetric.hpp | 1 + metrics/src/vespa/metrics/metric.cpp | 1 + metrics/src/vespa/metrics/metric.h | 1 - metrics/src/vespa/metrics/metricset.cpp | 10 +++ metrics/src/vespa/metrics/metricset.h | 10 +-- metrics/src/vespa/metrics/metricsnapshot.cpp | 4 +- metrics/src/vespa/metrics/summetric.hpp | 1 + .../vespa/persistence/dummyimpl/dummypersistence.h | 1 + .../persistence/spi/metricpersistenceprovider.cpp | 2 +- searchcore/src/apps/fdispatch/fdispatch.cpp | 1 + .../apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp | 3 +- .../document_db_reference_registry_test.cpp | 8 +-- .../searchcore/fdispatch/common/appcontext.cpp | 1 + .../proton/attribute/attributedisklayout.cpp | 1 + .../proton/matching/docid_range_scheduler.cpp | 7 +-- .../proton/server/disk_mem_usage_sampler.cpp | 2 +- .../vespa/searchcore/proton/server/feedhandler.cpp | 1 + .../vespa/searchcorespi/index/indexflushtarget.cpp | 7 +-- searchlib/src/apps/docstore/benchmarkdatastore.cpp | 1 + searchlib/src/apps/uniform/uniform.cpp | 1 + .../vespa-index-inspect/vespa-index-inspect.cpp | 3 +- .../foregroundtaskexecutor_test.cpp | 14 ++--- .../sequencedtaskexecutor_test.cpp | 14 ++--- .../memoryindex/dictionary/dictionary_test.cpp | 36 +++++------ .../src/tests/postinglistbm/postinglistbm.cpp | 2 + searchlib/src/tests/sort/uca.cpp | 9 +-- .../util/ioerrorhandler/ioerrorhandler_test.cpp | 1 + .../util/sigbushandler/sigbushandler_test.cpp | 11 ++-- .../src/tests/util/statefile/statefile_test.cpp | 14 +++-- .../vespa/searchlib/common/allocatedbitvector.cpp | 1 + .../vespa/searchlib/common/allocatedbitvector.h | 2 +- .../vespa/searchlib/common/partialbitvector.cpp | 1 + .../src/vespa/searchlib/common/partialbitvector.h | 2 +- searchlib/src/vespa/searchlib/common/resultset.cpp | 1 + .../vespa/searchlib/diskindex/wordnummapper.cpp | 1 + .../src/vespa/searchlib/predicate/simple_index.hpp | 8 +-- .../test/fakedata/fakeegcompr64filterocc.cpp | 4 +- searchlib/src/vespa/searchlib/util/comprbuffer.cpp | 1 + searchlib/src/vespa/searchlib/util/dirtraverse.cpp | 1 + searchlib/src/vespa/searchlib/util/filealign.cpp | 1 + searchlib/src/vespa/searchlib/util/fileutil.cpp | 3 + .../src/vespa/searchlib/util/ioerrorhandler.cpp | 1 + searchlib/src/vespa/searchlib/util/rawbuf.cpp | 1 + searchlib/src/vespa/searchlib/util/stringenum.cpp | 1 + .../src/tests/shutdownguard/shutdownguard_test.cpp | 2 + .../process_memory_stats_test.cpp | 3 + staging_vespalib/src/vespa/vespalib/util/clock.cpp | 2 + .../src/vespa/vespalib/util/shutdownguard.cpp | 1 + .../storageserver/documentapiconvertertest.cpp | 1 + .../storage/bucketdb/bucketmanagermetrics.cpp | 1 + .../distributor/operations/external/visitororder.h | 6 +- .../operations/idealstate/joinoperation.cpp | 2 +- .../operations/idealstate/splitoperation.cpp | 2 +- .../storage/distributor/pendingclusterstate.cpp | 1 + .../vespa/storage/persistence/bucketprocessor.cpp | 1 + .../vespa/storage/persistence/splitbitdetector.cpp | 1 + .../vespa/storage/storageserver/distributornode.h | 6 +- .../vespa/storage/storageserver/servicelayernode.h | 4 +- .../vespa/storage/storageserver/storagenode.cpp | 27 ++------ .../src/vespa/storage/storageserver/storagenode.h | 53 ++++++++-------- .../src/vespa/storage/storageutil/resumeguard.h | 4 +- storage/src/vespa/storage/tools/throttlingsim.cpp | 1 + .../visiting/visitormessagesessionfactory.h | 2 +- .../src/vespa/storageapi/message/visitor.cpp | 7 +-- .../component/componentregisterimpl.h | 11 +--- .../defaultimplementation/memory/memorystate.cpp | 10 +-- .../memory/prioritymemorylogic.cpp | 10 +-- .../defaultimplementation/thread/threadimpl.cpp | 6 +- .../generic/metric/metricregistrator.h | 18 +++--- .../vespa/storageserver/app/distributorprocess.cpp | 17 +++-- .../src/vespa/storageserver/app/process.cpp | 11 ++-- vdslib/src/tests/container/documentlisttest.cpp | 2 + .../vespa/vespaclient/spoolmaster/application.cpp | 2 + vespalib/src/tests/guard/guard_test.cpp | 3 +- vespalib/src/tests/net/selector/selector_test.cpp | 1 + vespalib/src/tests/net/socket/socket_test.cpp | 2 + .../src/tests/signalhandler/signalhandler_test.cpp | 7 ++- vespalib/src/tests/text/utf8/utf8_test.cpp | 8 ++- .../src/vespa/vespalib/hwaccelrated/avxprivate.hpp | 9 +-- vespalib/src/vespa/vespalib/io/fileutil.cpp | 3 + .../src/vespa/vespalib/stllike/asciistream.cpp | 1 + .../vespa/vespalib/test/socket_options_verifier.h | 3 + vespalib/src/vespa/vespalib/testkit/test_kit.h | 1 + .../src/vespa/vespalib/testkit/test_master.cpp | 1 + vespalib/src/vespa/vespalib/util/alloc.cpp | 1 + vespalib/src/vespa/vespalib/util/slaveproc.cpp | 1 + vespalib/src/vespa/vespalib/util/stringfmt.h | 1 + vespalib/src/vespa/vespalib/util/sync.h | 2 + vespalog/src/test/threads/testthreads.cpp | 3 + vespalog/src/vespa/log/log.cpp | 3 + vespalog/src/vespa/log/log.h | 6 ++ .../src/tests/doubledelete/expectsignal.cpp | 1 + vespamalloc/src/tests/overwrite/expectsignal.cpp | 1 + vespamalloc/src/tests/test.cpp | 2 + vespamalloc/src/tests/thread/racemanythreads.cpp | 1 + vespamalloc/src/tests/thread/thread.cpp | 1 + 169 files changed, 584 insertions(+), 539 deletions(-) diff --git a/config/src/apps/vespa-get-config/getconfig.cpp b/config/src/apps/vespa-get-config/getconfig.cpp index 2a8a66f41d9..342b2b497bb 100644 --- a/config/src/apps/vespa-get-config/getconfig.cpp +++ b/config/src/apps/vespa-get-config/getconfig.cpp @@ -239,7 +239,7 @@ GetConfig::Main() printf("configID %s\n", rKey.getConfigId().c_str()); printf("configMD5 %s\n", rState.md5.c_str()); - printf("generation %" PRId64 "\n", rState.generation); + printf("generation %ld\n", rState.generation); printf("trace %s\n", response->getTrace().toString().c_str()); } else if (traceLevel > 0) { printf("trace %s\n", response->getTrace().toString().c_str()); diff --git a/config/src/tests/configgen/value_converter.cpp b/config/src/tests/configgen/value_converter.cpp index 1034d0821fd..8c969b77271 100644 --- a/config/src/tests/configgen/value_converter.cpp +++ b/config/src/tests/configgen/value_converter.cpp @@ -3,6 +3,7 @@ #include #include #include +#include using namespace config; using namespace config::internal; diff --git a/config/src/tests/frtconnectionpool/frtconnectionpool.cpp b/config/src/tests/frtconnectionpool/frtconnectionpool.cpp index c14cdbbbc23..79ec1ee42f4 100644 --- a/config/src/tests/frtconnectionpool/frtconnectionpool.cpp +++ b/config/src/tests/frtconnectionpool/frtconnectionpool.cpp @@ -5,6 +5,7 @@ #include #include #include +#include using namespace config; diff --git a/config/src/tests/functiontest/functiontest.cpp b/config/src/tests/functiontest/functiontest.cpp index 7fe87775f74..257e131534b 100644 --- a/config/src/tests/functiontest/functiontest.cpp +++ b/config/src/tests/functiontest/functiontest.cpp @@ -37,8 +37,8 @@ checkVariableAccess(const FunctionTestConfig & config) EXPECT_EQUAL(1u, config.boolarr.size()); EXPECT_EQUAL(0u, config.intarr.size()); EXPECT_EQUAL(2u, config.longarr.size()); - LOG(error, "0: %" PRId64, config.longarr[0]); - LOG(error, "1: %" PRId64, config.longarr[1]); + LOG(error, "0: %ld", config.longarr[0]); + LOG(error, "1: %ld", config.longarr[1]); EXPECT_EQUAL(std::numeric_limits::max(), config.longarr[0]); EXPECT_EQUAL(std::numeric_limits::min(), config.longarr[1]); EXPECT_EQUAL(2u, config.doublearr.size()); diff --git a/config/src/tests/misc/configsystem.cpp b/config/src/tests/misc/configsystem.cpp index f0f526265ca..9574d9d274a 100644 --- a/config/src/tests/misc/configsystem.cpp +++ b/config/src/tests/misc/configsystem.cpp @@ -3,6 +3,7 @@ #include #include #include +#include using namespace config; diff --git a/config/src/tests/print/print.cpp b/config/src/tests/print/print.cpp index e058b91822e..9df4bcf4914 100644 --- a/config/src/tests/print/print.cpp +++ b/config/src/tests/print/print.cpp @@ -8,6 +8,7 @@ #include #include "config-my.h" #include "config-motd.h" +#include using namespace config; diff --git a/config/src/vespa/config/common/configvalue.h b/config/src/vespa/config/common/configvalue.h index 53780dce533..7bbd48df258 100644 --- a/config/src/vespa/config/common/configvalue.h +++ b/config/src/vespa/config/common/configvalue.h @@ -1,17 +1,14 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include +#include #include #include #include -#include -#include +#include -namespace vespalib { - namespace slime { - class Cursor; - } -} +namespace vespalib::slime { class Cursor; } namespace config { diff --git a/config/src/vespa/config/frt/frtconfigagent.cpp b/config/src/vespa/config/frt/frtconfigagent.cpp index d5c662d1bda..ff16ef77a1b 100644 --- a/config/src/vespa/config/frt/frtconfigagent.cpp +++ b/config/src/vespa/config/frt/frtconfigagent.cpp @@ -26,7 +26,7 @@ FRTConfigAgent::handleResponse(const ConfigRequest & request, ConfigResponse::UP { if (LOG_WOULD_LOG(spam)) { const ConfigKey & key(request.getKey()); - LOG(spam, "current state for %s: generation %" PRId64 " md5 %s", key.toString().c_str(), _configState.generation, _configState.md5.c_str()); + LOG(spam, "current state for %s: generation %ld md5 %s", key.toString().c_str(), _configState.generation, _configState.md5.c_str()); } if (response->validateResponse() && !response->isError()) { handleOKResponse(std::move(response)); @@ -57,7 +57,7 @@ void FRTConfigAgent::handleUpdatedGeneration(const ConfigKey & key, const ConfigState & newState, const ConfigValue & configValue) { if (LOG_WOULD_LOG(spam)) { - LOG(spam, "new generation %" PRId64 " for key %s", newState.generation, key.toString().c_str()); + LOG(spam, "new generation %ld for key %s", newState.generation, key.toString().c_str()); } _configState.generation = newState.generation; bool hasDifferentPayload = newState.hasDifferentPayloadFrom(_configState); @@ -84,7 +84,7 @@ FRTConfigAgent::handleErrorResponse(const ConfigRequest & request, ConfigRespons setWaitTime(_numConfigured > 0 ? _timingValues.configuredErrorDelay : _timingValues.unconfiguredDelay, multiplier); _nextTimeout = _timingValues.errorTimeout; const ConfigKey & key(request.getKey()); - LOG(info, "Error response or no response from config server (key: %s) (errcode=%d, validresponse:%d), trying again in %" PRId64 " milliseconds", key.toString().c_str(), response->errorCode(), response->hasValidResponse() ? 1 : 0, _waitTime); + LOG(info, "Error response or no response from config server (key: %s) (errcode=%d, validresponse:%d), trying again in %ld milliseconds", key.toString().c_str(), response->errorCode(), response->hasValidResponse() ? 1 : 0, _waitTime); } void @@ -92,7 +92,7 @@ FRTConfigAgent::setWaitTime(uint64_t delay, int multiplier) { uint64_t prevWait = _waitTime; _waitTime = _timingValues.fixedDelay + (multiplier * delay); - LOG(spam, "Adjusting waittime from %" PRId64 " to %" PRId64, prevWait, _waitTime); + LOG(spam, "Adjusting waittime from %ld to %ld", prevWait, _waitTime); } uint64_t FRTConfigAgent::getTimeout() const { return _nextTimeout; } diff --git a/config/src/vespa/config/subscription/configsubscriptionset.cpp b/config/src/vespa/config/subscription/configsubscriptionset.cpp index 170bacf104d..51c29823664 100644 --- a/config/src/vespa/config/subscription/configsubscriptionset.cpp +++ b/config/src/vespa/config/subscription/configsubscriptionset.cpp @@ -67,7 +67,7 @@ ConfigSubscriptionSet::acquireSnapshot(uint64_t timeoutInMillis, bool ignoreChan } else { LOG(spam, "Config subscription did not change, id(%s), defname(%s)", key.getConfigId().c_str(), key.getDefName().c_str()); } - LOG(spam, "Previous generation is %" PRId64 ", updates is %" PRId64, generation, subscription->getGeneration()); + LOG(spam, "Previous generation is %ld, updates is %ld", generation, subscription->getGeneration()); if (isGenerationNewer(subscription->getGeneration(), _currentGeneration)) { numGenerationChanged++; } @@ -88,7 +88,7 @@ ConfigSubscriptionSet::acquireSnapshot(uint64_t timeoutInMillis, bool ignoreChan bool updated = inSync && isGenerationNewer(lastGeneration, _currentGeneration); if (updated) { - LOG(spam, "Config was updated from %" PRId64 " to %" PRId64, _currentGeneration, lastGeneration); + LOG(spam, "Config was updated from %ld to %ld", _currentGeneration, lastGeneration); _currentGeneration = lastGeneration; _state = CONFIGURED; for (SubscriptionList::iterator it(_subscriptionList.begin()), mt(_subscriptionList.end()); diff --git a/configd/src/apps/sentinel/config-handler.cpp b/configd/src/apps/sentinel/config-handler.cpp index de03f34c5ed..1075bc4d7ce 100644 --- a/configd/src/apps/sentinel/config-handler.cpp +++ b/configd/src/apps/sentinel/config-handler.cpp @@ -6,6 +6,8 @@ #include #include +#include +#include #include LOG_SETUP(".config-handler"); diff --git a/document/src/tests/documenttestcase.cpp b/document/src/tests/documenttestcase.cpp index 32503ac0bd0..44cff2c80de 100644 --- a/document/src/tests/documenttestcase.cpp +++ b/document/src/tests/documenttestcase.cpp @@ -13,6 +13,7 @@ #include #include #include +#include using vespalib::nbostream; diff --git a/document/src/tests/documentupdatetestcase.cpp b/document/src/tests/documentupdatetestcase.cpp index 2324d21cd24..b6aca1ec8be 100644 --- a/document/src/tests/documentupdatetestcase.cpp +++ b/document/src/tests/documentupdatetestcase.cpp @@ -25,6 +25,8 @@ #include #include #include +#include +#include using namespace document::config_builder; using vespalib::tensor::Tensor; diff --git a/document/src/tests/fieldpathupdatetestcase.cpp b/document/src/tests/fieldpathupdatetestcase.cpp index fc94c5e63eb..70f16eccfe1 100644 --- a/document/src/tests/fieldpathupdatetestcase.cpp +++ b/document/src/tests/fieldpathupdatetestcase.cpp @@ -13,7 +13,7 @@ #include #include #include - +#include using vespalib::Identifiable; using namespace document::config_builder; diff --git a/document/src/tests/predicate/predicate_test.cpp b/document/src/tests/predicate/predicate_test.cpp index e8db197fdad..6da866cb154 100644 --- a/document/src/tests/predicate/predicate_test.cpp +++ b/document/src/tests/predicate/predicate_test.cpp @@ -1,15 +1,16 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. // Unit tests for predicate. -#include -LOG_SETUP("predicate_test"); - #include #include #include #include #include +#include + +#include +LOG_SETUP("predicate_test"); using std::string; using std::vector; diff --git a/document/src/vespa/document/predicate/predicate.cpp b/document/src/vespa/document/predicate/predicate.cpp index 3e44cd649b7..df4128246a9 100644 --- a/document/src/vespa/document/predicate/predicate.cpp +++ b/document/src/vespa/document/predicate/predicate.cpp @@ -3,6 +3,7 @@ #include "predicate.h" #include #include +#include using std::mismatch; using std::pair; diff --git a/documentapi/src/tests/messages/messages50test.h b/documentapi/src/tests/messages/messages50test.h index 642dad8d734..8711264ee7a 100644 --- a/documentapi/src/tests/messages/messages50test.h +++ b/documentapi/src/tests/messages/messages50test.h @@ -6,7 +6,7 @@ class Messages50Test : public TestBase { protected: const vespalib::Version getVersion() const override { return vespalib::Version(5, 0); } - bool shouldTestCoverage() const override { return FALSE; } + bool shouldTestCoverage() const override { return false; } bool tryDocumentReply(const string &filename, uint32_t type); bool tryVisitorReply(const string &filename, uint32_t type); diff --git a/documentapi/src/tests/messages/messages51test.h b/documentapi/src/tests/messages/messages51test.h index 6ad1573f4f5..897491af892 100644 --- a/documentapi/src/tests/messages/messages51test.h +++ b/documentapi/src/tests/messages/messages51test.h @@ -6,7 +6,7 @@ class Messages51Test : public Messages50Test { protected: const vespalib::Version getVersion() const override { return vespalib::Version(5, 1); } - bool shouldTestCoverage() const override { return TRUE; } + bool shouldTestCoverage() const override { return true; } public: Messages51Test(); diff --git a/documentapi/src/tests/messages/testbase.cpp b/documentapi/src/tests/messages/testbase.cpp index c36faa251ab..995fde4aa69 100644 --- a/documentapi/src/tests/messages/testbase.cpp +++ b/documentapi/src/tests/messages/testbase.cpp @@ -4,6 +4,9 @@ #include #include #include +#include +#include + LOG_SETUP(".testbase"); using document::DocumentTypeRepo; diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/visitor.cpp b/documentapi/src/vespa/documentapi/messagebus/messages/visitor.cpp index ca698f4ae3a..b3e6ac422eb 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/visitor.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/messages/visitor.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "visitor.h" +#include namespace documentapi { diff --git a/fastlib/src/vespa/fastlib/io/bufferedfile.cpp b/fastlib/src/vespa/fastlib/io/bufferedfile.cpp index 26c75cc1fb1..6a50cfe2259 100644 --- a/fastlib/src/vespa/fastlib/io/bufferedfile.cpp +++ b/fastlib/src/vespa/fastlib/io/bufferedfile.cpp @@ -1,6 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "bufferedfile.h" +#include +#include namespace { diff --git a/fastlib/src/vespa/fastlib/io/tests/bufferedstreamtest.cpp b/fastlib/src/vespa/fastlib/io/tests/bufferedstreamtest.cpp index c67a513c67b..f9957d96288 100644 --- a/fastlib/src/vespa/fastlib/io/tests/bufferedstreamtest.cpp +++ b/fastlib/src/vespa/fastlib/io/tests/bufferedstreamtest.cpp @@ -2,6 +2,7 @@ #include #include #include +#include using namespace std; diff --git a/fastlib/src/vespa/fastlib/net/httpserver.cpp b/fastlib/src/vespa/fastlib/net/httpserver.cpp index cd3b7705cff..807b169323d 100644 --- a/fastlib/src/vespa/fastlib/net/httpserver.cpp +++ b/fastlib/src/vespa/fastlib/net/httpserver.cpp @@ -10,6 +10,7 @@ #include #include #include +#include /** * Helper class for hiding the details of HTTP entity encodings and diff --git a/fastlib/src/vespa/fastlib/text/normwordfolder.cpp b/fastlib/src/vespa/fastlib/text/normwordfolder.cpp index 208bf9c8cb1..767431e5531 100644 --- a/fastlib/src/vespa/fastlib/text/normwordfolder.cpp +++ b/fastlib/src/vespa/fastlib/text/normwordfolder.cpp @@ -3,6 +3,7 @@ #include #include #include +#include bool Fast_NormalizeWordFolder::_isInitialized = false; FastOS_Mutex _initMutex; diff --git a/fastlib/src/vespa/fastlib/util/tests/base64test.cpp b/fastlib/src/vespa/fastlib/util/tests/base64test.cpp index accf7fc87b3..16bb3ccd9ad 100644 --- a/fastlib/src/vespa/fastlib/util/tests/base64test.cpp +++ b/fastlib/src/vespa/fastlib/util/tests/base64test.cpp @@ -3,6 +3,7 @@ #include #include #include +#include class Base64Test : public FastOS_Application { public: diff --git a/fastos/src/tests/filetest.cpp b/fastos/src/tests/filetest.cpp index 92fd5558590..ad411364c0c 100644 --- a/fastos/src/tests/filetest.cpp +++ b/fastos/src/tests/filetest.cpp @@ -3,6 +3,8 @@ #include "tests.h" #include #include +#include +#include namespace { diff --git a/fastos/src/tests/sockettest.cpp b/fastos/src/tests/sockettest.cpp index 3a62fdbf6eb..0b6e8c9360d 100644 --- a/fastos/src/tests/sockettest.cpp +++ b/fastos/src/tests/sockettest.cpp @@ -3,7 +3,7 @@ #include "tests.h" #include #include - +#include #define MAZE_FILE_OFFSET 1078 diff --git a/fastos/src/tests/tests.h b/fastos/src/tests/tests.h index 94062c04e54..62a873f8a54 100644 --- a/fastos/src/tests/tests.h +++ b/fastos/src/tests/tests.h @@ -3,6 +3,7 @@ #include #include #include +#include class BaseTest : public FastOS_Application { diff --git a/fastos/src/tests/typetest.cpp b/fastos/src/tests/typetest.cpp index e0399b56ba5..87e3d76c461 100644 --- a/fastos/src/tests/typetest.cpp +++ b/fastos/src/tests/typetest.cpp @@ -9,40 +9,6 @@ class TypeTest : public BaseTest { private: - void PrintfSpecifiersTest () - { - char testBuf[200]; - const char *correct; - - TestHeader("64-bit printf-specifiers test"); - - sprintf(testBuf, "%" PRId64, int64_t(-1000)*1000*1000*1000*1000); - correct = "-1000000000000000"; - Progress(strcmp(testBuf, correct) == 0, - "Generated=[%s], Correct=[%s]", testBuf, correct); - - sprintf(testBuf, "%" PRIu64, uint64_t(1000)*1000*1000*1000*1000); - correct = "1000000000000000"; - Progress(strcmp(testBuf, correct) == 0, - "Generated=[%s], Correct=[%s]", testBuf, correct); - - sprintf(testBuf, "%" PRIo64, uint64_t(1000)*1000*1000*1000*1000); - correct = "34327724461500000"; - Progress(strcmp(testBuf, correct) == 0, - "Generated=[%s], Correct=[%s]", testBuf, correct); - - sprintf(testBuf, "%" PRIx64, uint64_t(1000)*1000*1000*1000*1000); - correct = "38d7ea4c68000"; - Progress(strcmp(testBuf, correct) == 0, - "Generated=[%s], Correct=[%s]", testBuf, correct); - - sprintf(testBuf, "%" PRIX64, uint64_t(1000)*1000*1000*1000*1000); - correct = "38D7EA4C68000"; - Progress(strcmp(testBuf, correct) == 0, - "Generated=[%s], Correct=[%s]", testBuf, correct); - - PrintSeparator(); - } void ObjectSizeTest () { @@ -73,7 +39,6 @@ public: { printf("grep for the string '%s' to detect failures.\n\n", failString); - PrintfSpecifiersTest(); ObjectSizeTest(); PrintSeparator(); diff --git a/fastos/src/vespa/fastos/CMakeLists.txt b/fastos/src/vespa/fastos/CMakeLists.txt index 661dd1c6547..2a0ff2d370a 100644 --- a/fastos/src/vespa/fastos/CMakeLists.txt +++ b/fastos/src/vespa/fastos/CMakeLists.txt @@ -5,6 +5,7 @@ vespa_add_library(fastos_objects OBJECT backtrace.c file.cpp linux_file.cpp + process.cpp serversocket.cpp socket.cpp socketevent.cpp diff --git a/fastos/src/vespa/fastos/app.cpp b/fastos/src/vespa/fastos/app.cpp index a76cd64d197..079dab55754 100644 --- a/fastos/src/vespa/fastos/app.cpp +++ b/fastos/src/vespa/fastos/app.cpp @@ -6,12 +6,14 @@ * @author Div, Oivind H. Danielsen */ -#include -#include -#include - -#include -#include +#include "app.h" +#include "socket.h" +#include "file.h" + +#include "process.h" +#include "thread.h" +#include +#include FastOS_ApplicationInterface *FastOS_ProcessInterface::_app; FastOS_ThreadPool *FastOS_ProcessInterface::GetThreadPool () diff --git a/fastos/src/vespa/fastos/cond.h b/fastos/src/vespa/fastos/cond.h index 457abe666d4..c9405728223 100644 --- a/fastos/src/vespa/fastos/cond.h +++ b/fastos/src/vespa/fastos/cond.h @@ -9,9 +9,7 @@ #pragma once - -#include -#include +#include "mutex.h" /** diff --git a/fastos/src/vespa/fastos/file.cpp b/fastos/src/vespa/fastos/file.cpp index cf17b672bd5..8f164c2a522 100644 --- a/fastos/src/vespa/fastos/file.cpp +++ b/fastos/src/vespa/fastos/file.cpp @@ -6,9 +6,10 @@ * @author Div, Oivind H. Danielsen */ -#include +#include "file.h" #include - +#include +#include DirectIOException::DirectIOException(const char * fileName, const void * buffer, size_t length, int64_t offset) : std::exception(), @@ -495,3 +496,18 @@ bool FastOS_FileInterface::Rename (const char *newFileName) void FastOS_FileInterface::dropFromCache() const { } + +FastOS_DirectoryScanInterface::FastOS_DirectoryScanInterface(const char *path) + : _searchPath(strdup(path)) +{ +} + +/** + * Destructor. + * + * Frees operating system resources related to the directory scan. + */ +FastOS_DirectoryScanInterface::~FastOS_DirectoryScanInterface() +{ + free(_searchPath); +} \ No newline at end of file diff --git a/fastos/src/vespa/fastos/file.h b/fastos/src/vespa/fastos/file.h index 8a9de224259..00ba61b793f 100644 --- a/fastos/src/vespa/fastos/file.h +++ b/fastos/src/vespa/fastos/file.h @@ -115,13 +115,6 @@ public: int getFAdviseOptions() const { return _fAdviseOptions; } void setFAdviseOptions(int options) { _fAdviseOptions = options; } - char *ToString () { - const char dummy[]="FastOS_File::ToString() deprecated"; - char *str = new char [strlen(dummy) + 1]; - strcpy(str, dummy); - return str; - } - /** * Initialize the file class. This is invoked by * @ref FastOS_Application::Init(). @@ -752,20 +745,14 @@ public: * @param path Path of the directory to be scanned. The path string * is copied internally. */ - FastOS_DirectoryScanInterface(const char *path) - : _searchPath(strdup(path)) - { - } + FastOS_DirectoryScanInterface(const char *path); /** * Destructor. * * Frees operating system resources related to the directory scan. */ - virtual ~FastOS_DirectoryScanInterface() - { - free(_searchPath); - } + virtual ~FastOS_DirectoryScanInterface(); /** * Get search path. diff --git a/fastos/src/vespa/fastos/linux_file.cpp b/fastos/src/vespa/fastos/linux_file.cpp index 1b9556569e2..3817e337490 100644 --- a/fastos/src/vespa/fastos/linux_file.cpp +++ b/fastos/src/vespa/fastos/linux_file.cpp @@ -7,9 +7,10 @@ * Implementation of FastOS_Linux_File methods. *****************************************************************************/ -#include +#include "file.h" #include -#include +#include +#include const size_t FastOS_Linux_File::_directIOFileAlign = 4096; const size_t FastOS_Linux_File::_directIOMemAlign = 4096; diff --git a/fastos/src/vespa/fastos/mutex.h b/fastos/src/vespa/fastos/mutex.h index 011340b46ca..530e8d007bc 100644 --- a/fastos/src/vespa/fastos/mutex.h +++ b/fastos/src/vespa/fastos/mutex.h @@ -9,8 +9,7 @@ #pragma once -#include - +#include "types.h" /** * This class defines a mutual-exclusion object. @@ -31,7 +30,7 @@ public: /** * Destructor */ - virtual ~FastOS_MutexInterface () {}; + virtual ~FastOS_MutexInterface () {} /** * Obtain an exclusive lock on the mutex. The result of a recursive lock @@ -42,7 +41,7 @@ public: * * Use @ref Unlock() to unlock the mutex when done. */ - virtual void Lock (void)=0; + virtual void Lock ()=0; /** * Try to obtain an exclusive lock on the mutex. If a lock cannot be @@ -51,15 +50,15 @@ public: * the mutex was locked in the attempt, true is returned. * @return Boolean success/failure */ - virtual bool TryLock (void)=0; + virtual bool TryLock ()=0; /** * Unlock a locked mutex. The result of unlocking a mutex not already * locked by the calling thread is undefined. */ - virtual void Unlock (void)=0; + virtual void Unlock ()=0; }; -#include +#include "unix_mutex.h" typedef FastOS_UNIX_Mutex FASTOS_PREFIX(Mutex); diff --git a/fastos/src/vespa/fastos/process.h b/fastos/src/vespa/fastos/process.h index 62578f97e44..e29b90d49cd 100644 --- a/fastos/src/vespa/fastos/process.h +++ b/fastos/src/vespa/fastos/process.h @@ -10,7 +10,7 @@ #pragma once -#include +#include "types.h" /** * This class serves as a sink for redirected (piped) output from @@ -112,27 +112,13 @@ public: bool pipeStdin = false, FastOS_ProcessRedirectListener *stdoutListener = NULL, FastOS_ProcessRedirectListener *stderrListener = NULL, - int bufferSize = 65535) : - _extradoublehackforalignment(0.0), - _cmdLine(NULL), - _pipeStdin(pipeStdin), - _stdoutListener(stdoutListener), - _stderrListener(stderrListener), - _bufferSize(bufferSize), - _next(NULL), - _prev(NULL) - { - _cmdLine = strdup(cmdLine); - } + int bufferSize = 65535); /** * Destructor. * If @ref Wait has not been called yet, it is called here. */ - virtual ~FastOS_ProcessInterface () - { - free (_cmdLine); - }; + virtual ~FastOS_ProcessInterface (); /** * Create and start the process. If your command line includes diff --git a/fastos/src/vespa/fastos/serversocket.cpp b/fastos/src/vespa/fastos/serversocket.cpp index 335c34a29b4..2ad8ed32bb3 100644 --- a/fastos/src/vespa/fastos/serversocket.cpp +++ b/fastos/src/vespa/fastos/serversocket.cpp @@ -6,7 +6,8 @@ * @author Div, Oivind H. Danielsen */ -#include +#include "serversocket.h" +#include /** @@ -93,6 +94,16 @@ FastOS_Socket *FastOS_ServerSocket::AcceptPlain() return handlerSocket; } +FastOS_ServerSocket::FastOS_ServerSocket(int socketHandle, FastOS_SocketFactory *socketFactory) + : _portNumber(-1), + _backLog(-1), + _socketFactory(socketFactory), + _validAddress(false) +{ + _socketHandle = socketHandle; + memset(&_address, 0, sizeof(_address)); + _validAddress = true; +} bool FastOS_ServerSocket::Listen () { diff --git a/fastos/src/vespa/fastos/serversocket.h b/fastos/src/vespa/fastos/serversocket.h index 77e7beee55a..8452649015c 100644 --- a/fastos/src/vespa/fastos/serversocket.h +++ b/fastos/src/vespa/fastos/serversocket.h @@ -118,17 +118,7 @@ public: * @param socketHandle OS handle of supplied socket. * @param socketFactory See @ref SetSocketFactory(). */ - FastOS_ServerSocket(int socketHandle, - FastOS_SocketFactory *socketFactory) - : _portNumber(-1), - _backLog(-1), - _socketFactory(socketFactory), - _validAddress(false) - { - _socketHandle = socketHandle; - memset(&_address, 0, sizeof(_address)); - _validAddress = true; - } + FastOS_ServerSocket(int socketHandle, FastOS_SocketFactory *socketFactory); /** * Create a listening socket. This involves creating an OS diff --git a/fastos/src/vespa/fastos/socket.cpp b/fastos/src/vespa/fastos/socket.cpp index 522d39c4b32..21f5d788b18 100644 --- a/fastos/src/vespa/fastos/socket.cpp +++ b/fastos/src/vespa/fastos/socket.cpp @@ -1,7 +1,10 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include +#include "socket.h" #include +#include +#include +#include FastOS_SocketInterface::FastOS_SocketInterface() : _readEventEnabled(false), diff --git a/fastos/src/vespa/fastos/socketevent.cpp b/fastos/src/vespa/fastos/socketevent.cpp index 7e5164d2247..e3bc7d28888 100644 --- a/fastos/src/vespa/fastos/socketevent.cpp +++ b/fastos/src/vespa/fastos/socketevent.cpp @@ -1,7 +1,10 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include +#include "socketevent.h" +#include "socket.h" +#include +#include + FastOS_SocketEventObjects *FastOS_SocketEventObjects::_objects = NULL; FastOS_Mutex FastOS_SocketEventObjects::_listMutex; diff --git a/fastos/src/vespa/fastos/socketevent.h b/fastos/src/vespa/fastos/socketevent.h index 5a1e09b1765..e7f67816586 100644 --- a/fastos/src/vespa/fastos/socketevent.h +++ b/fastos/src/vespa/fastos/socketevent.h @@ -2,8 +2,8 @@ #pragma once -#include -#include +#include "types.h" +#include "mutex.h" #include #include diff --git a/fastos/src/vespa/fastos/thread.cpp b/fastos/src/vespa/fastos/thread.cpp index ccf9b544e77..484746a9b0d 100644 --- a/fastos/src/vespa/fastos/thread.cpp +++ b/fastos/src/vespa/fastos/thread.cpp @@ -6,7 +6,9 @@ * @author Oivind H. Danielsen */ -#include +#include "thread.h" +#include +#include // ---------------------------------------------------------------------- // FastOS_ThreadPool diff --git a/fastos/src/vespa/fastos/thread.h b/fastos/src/vespa/fastos/thread.h index 24a4b1768fc..b84708eb050 100644 --- a/fastos/src/vespa/fastos/thread.h +++ b/fastos/src/vespa/fastos/thread.h @@ -11,9 +11,9 @@ #pragma once -#include -#include -#include +#include "types.h" +#include "mutex.h" +#include "cond.h" typedef pthread_t FastOS_ThreadId; diff --git a/fastos/src/vespa/fastos/types.h b/fastos/src/vespa/fastos/types.h index 08ad40ac8be..506d514f642 100644 --- a/fastos/src/vespa/fastos/types.h +++ b/fastos/src/vespa/fastos/types.h @@ -28,29 +28,16 @@ #define __STDC_FORMAT_MACROS #endif -#include - -#include -#include - #ifdef __TYPES_H_PTHREAD_U98 #undef __USE_UNIX98 #endif -#include -#include -#include -#include -#include -#include -#include -#include + #ifndef __USE_UNIX98 #define __TYPES_H_UNISTD_U98 #define __USE_UNIX98 #endif -#include #ifdef __TYPES_H_UNISTD_U98 #undef __USE_UNIX98 #endif @@ -74,24 +61,11 @@ #define __TYPES_H_DIRECTIO_GNU #endif -#include #ifdef __TYPES_H_DIRECTIO_GNU #undef __USE_GNU /* for O_DIRECT define */ #endif -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - #if (__WORDSIZE == 64) #else diff --git a/fastos/src/vespa/fastos/unix_app.cpp b/fastos/src/vespa/fastos/unix_app.cpp index d52813ceb76..e736a157eb8 100644 --- a/fastos/src/vespa/fastos/unix_app.cpp +++ b/fastos/src/vespa/fastos/unix_app.cpp @@ -7,10 +7,12 @@ * Implementation of FastOS_UNIX_Application methods. *****************************************************************************/ -#include -#include -#include -#include +#include "app.h" +#include "time.h" +#include "process.h" +#include "unix_ipc.h" +#include +#include FastOS_UNIX_Application::FastOS_UNIX_Application () @@ -33,6 +35,36 @@ unsigned int FastOS_UNIX_Application::GetCurrentProcessId () return static_cast(getpid()); } +int +FastOS_UNIX_Application::GetOpt (const char *optionsString, + const char* &optionArgument, + int &optionIndex) +{ + optind = optionIndex; + + int rc = getopt(_argc, _argv, optionsString); + optionArgument = optarg; + optionIndex = optind; + return rc; +} + +int +FastOS_UNIX_Application::GetOptLong(const char *optionsString, + const char* &optionArgument, + int &optionIndex, + const struct option *longopts, + int *longindex) +{ + optind = optionIndex; + + int rc = getopt_long(_argc, _argv, optionsString, + longopts, + longindex); + + optionArgument = optarg; + optionIndex = optind; + return rc; +} bool FastOS_UNIX_Application:: SendIPCMessage (FastOS_UNIX_Process *xproc, const void *buffer, diff --git a/fastos/src/vespa/fastos/unix_app.h b/fastos/src/vespa/fastos/unix_app.h index db6669813cf..49a5950c433 100644 --- a/fastos/src/vespa/fastos/unix_app.h +++ b/fastos/src/vespa/fastos/unix_app.h @@ -9,8 +9,8 @@ #pragma once -#include -#include +#include "types.h" +#include "app.h" class FastOS_UNIX_ProcessStarter; class FastOS_UNIX_IPCHelper; @@ -34,34 +34,10 @@ public: FastOS_UNIX_Application (); virtual ~FastOS_UNIX_Application(); - int GetOpt (const char *optionsString, - const char* &optionArgument, - int &optionIndex) - { - optind = optionIndex; + int GetOpt (const char *optionsString, const char* &optionArgument, int &optionIndex); - int rc = getopt(_argc, _argv, optionsString); - optionArgument = optarg; - optionIndex = optind; - return rc; - } - - int GetOptLong(const char *optionsString, - const char* &optionArgument, - int &optionIndex, - const struct option *longopts, - int *longindex) - { - optind = optionIndex; - - int rc = getopt_long(_argc, _argv, optionsString, - longopts, - longindex); - - optionArgument = optarg; - optionIndex = optind; - return rc; - } + int GetOptLong(const char *optionsString, const char* &optionArgument, int &optionIndex, + const struct option *longopts, int *longindex); static unsigned int GetCurrentProcessId (); diff --git a/fastos/src/vespa/fastos/unix_dynamiclibrary.cpp b/fastos/src/vespa/fastos/unix_dynamiclibrary.cpp index f34bc053870..75d3ee9fb27 100644 --- a/fastos/src/vespa/fastos/unix_dynamiclibrary.cpp +++ b/fastos/src/vespa/fastos/unix_dynamiclibrary.cpp @@ -56,7 +56,7 @@ FastOS_UNIX_DynamicLibrary::Close() bool retcode = true; if (IsOpen()) { - retcode = (dlclose(_handle) == TRUE); + retcode = (dlclose(_handle) == 0); if (retcode) _handle = NULL; } diff --git a/fastos/src/vespa/fastos/unix_file.cpp b/fastos/src/vespa/fastos/unix_file.cpp index c4b1448c625..ac474dfcf1a 100644 --- a/fastos/src/vespa/fastos/unix_file.cpp +++ b/fastos/src/vespa/fastos/unix_file.cpp @@ -7,9 +7,15 @@ * Implementation of FastOS_UNIX_File methods. *****************************************************************************/ -#include -#include +#include "file.h" #include +#include +#include +#include +#include +#include +#include +#include bool FastOS_UNIX_File::SetPosition(int64_t desiredPosition) @@ -59,6 +65,8 @@ FastOS_UNIX_File::Stat(const char *filename, FastOS_StatInfo *statInfo) return rc; } +bool FastOS_UNIX_File::SetCurrentDirectory (const char *pathName) { return (chdir(pathName) == 0); } + int FastOS_UNIX_File::GetMaximumFilenameLength (const char *pathName) { diff --git a/fastos/src/vespa/fastos/unix_file.h b/fastos/src/vespa/fastos/unix_file.h index 8ac520ccd53..3311782b47a 100644 --- a/fastos/src/vespa/fastos/unix_file.h +++ b/fastos/src/vespa/fastos/unix_file.h @@ -43,7 +43,7 @@ public: static std::string getCurrentDirectory(); - static bool SetCurrentDirectory (const char *pathName) { return (chdir(pathName) == 0); } + static bool SetCurrentDirectory (const char *pathName); static int GetMaximumFilenameLength (const char *pathName); static int GetMaximumPathLength (const char *pathName); @@ -56,7 +56,6 @@ public: _mmapEnabled(false) { } - char *ToString(); bool Open(unsigned int openFlags, const char *filename) override; bool Close() override; bool IsOpened() const override { return _filedes >= 0; } diff --git a/fastos/src/vespa/fastos/unix_ipc.cpp b/fastos/src/vespa/fastos/unix_ipc.cpp index d02bc4189ca..f8cde75bc7a 100644 --- a/fastos/src/vespa/fastos/unix_ipc.cpp +++ b/fastos/src/vespa/fastos/unix_ipc.cpp @@ -1,11 +1,13 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include - -#include +#include "unix_ipc.h" +#include "ringbuffer.h" +#include +#include +#include +#include FastOS_UNIX_IPCHelper:: -FastOS_UNIX_IPCHelper (FastOS_ApplicationInterface *app, - int descriptor) +FastOS_UNIX_IPCHelper (FastOS_ApplicationInterface *app, int descriptor) : _lock(), _exitFlag(false), _app(app), diff --git a/fastos/src/vespa/fastos/unix_mutex.cpp b/fastos/src/vespa/fastos/unix_mutex.cpp index a41eb974604..4d802f691ec 100644 --- a/fastos/src/vespa/fastos/unix_mutex.cpp +++ b/fastos/src/vespa/fastos/unix_mutex.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include +#include "mutex.h" +#include FastOS_UNIX_Mutex::FastOS_UNIX_Mutex(void) : FastOS_MutexInterface(), diff --git a/fastos/src/vespa/fastos/unix_mutex.h b/fastos/src/vespa/fastos/unix_mutex.h index 4a1d466e405..30150bc1590 100644 --- a/fastos/src/vespa/fastos/unix_mutex.h +++ b/fastos/src/vespa/fastos/unix_mutex.h @@ -12,8 +12,8 @@ #pragma once -#include - +#include "mutex.h" +#include class FastOS_UNIX_Mutex : public FastOS_MutexInterface { diff --git a/fastos/src/vespa/fastos/unix_process.cpp b/fastos/src/vespa/fastos/unix_process.cpp index 6930dc0247e..f3d15561958 100644 --- a/fastos/src/vespa/fastos/unix_process.cpp +++ b/fastos/src/vespa/fastos/unix_process.cpp @@ -1,9 +1,13 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -#include -#include +#include "process.h" +#include "unix_ipc.h" +#include "time.h" +#include "ringbuffer.h" #include +#include +#include +#include +#include #ifndef AF_LOCAL #define AF_LOCAL AF_UNIX @@ -1408,6 +1412,29 @@ bool FastOS_UNIX_ProcessStarter::CreateSocketPairs () return rc; } +FastOS_UNIX_ProcessStarter::FastOS_UNIX_ProcessStarter (FastOS_ApplicationInterface *app) + : _app(app), + _processList(NULL), + _pid(-1), + _starterSocket(-1), + _mainSocket(-1), + _starterSocketDescr(-1), + _mainSocketDescr(-1), + _hasProxiedChildren(false), + _closedProxyProcessFiles(false), + _hasDetachedProcess(false), + _hasDirectChildren(false) +{ +} + +FastOS_UNIX_ProcessStarter::~FastOS_UNIX_ProcessStarter () +{ + if(_starterSocket != -1) + close(_starterSocket); + if(_mainSocket != -1) + close(_mainSocket); +} + bool FastOS_UNIX_ProcessStarter::Start () { bool rc = false; @@ -1979,3 +2006,41 @@ bool FastOS_UNIX_ProcessStarter::Detach(FastOS_UNIX_Process *process) process->_app->ProcessUnlock(); return rc; } + +FastOS_UNIX_Process::DescriptorHandle::DescriptorHandle() + : _fd(-1), + _wantRead(false), + _wantWrite(false), + _canRead(false), + _canWrite(false), + _pollIdx(-1), + _readBuffer(), + _writeBuffer() +{ +} +FastOS_UNIX_Process::DescriptorHandle::~DescriptorHandle() { } +void +FastOS_UNIX_Process::DescriptorHandle::CloseHandle() +{ + _wantRead = false; + _wantWrite = false; + _canRead = false; + _canWrite = false; + _pollIdx = -1; + if (_fd != -1) { + close(_fd); + _fd = -1; + } + if (_readBuffer.get() != NULL) + _readBuffer->Close(); + if (_writeBuffer.get() != NULL) + _writeBuffer->Close(); +} +void +FastOS_UNIX_Process::DescriptorHandle::CloseHandleDirectChild() +{ + if (_fd != -1) { + close(_fd); + _fd = -1; + } +} \ No newline at end of file diff --git a/fastos/src/vespa/fastos/unix_process.h b/fastos/src/vespa/fastos/unix_process.h index 97a5b57c08d..ff034b0e581 100644 --- a/fastos/src/vespa/fastos/unix_process.h +++ b/fastos/src/vespa/fastos/unix_process.h @@ -8,15 +8,14 @@ #pragma once -#include -#include +#include "process.h" +#include "app.h" #include #include class FastOS_BoolCond; class FastOS_UNIX_RealProcess; - -#include +class FastOS_RingBuffer; class FastOS_UNIX_Process : public FastOS_ProcessInterface { @@ -45,41 +44,10 @@ public: int _pollIdx; std::unique_ptr _readBuffer; std::unique_ptr _writeBuffer; - DescriptorHandle(void) - : _fd(-1), - _wantRead(false), - _wantWrite(false), - _canRead(false), - _canWrite(false), - _pollIdx(-1), - _readBuffer(), - _writeBuffer() - { - } - ~DescriptorHandle() { } - void CloseHandle(void) - { - _wantRead = false; - _wantWrite = false; - _canRead = false; - _canWrite = false; - _pollIdx = -1; - if (_fd != -1) { - close(_fd); - _fd = -1; - } - if (_readBuffer.get() != NULL) - _readBuffer->Close(); - if (_writeBuffer.get() != NULL) - _writeBuffer->Close(); - } - void CloseHandleDirectChild(void) - { - if (_fd != -1) { - close(_fd); - _fd = -1; - } - } + DescriptorHandle(); + ~DescriptorHandle(); + void CloseHandle(); + void CloseHandleDirectChild(); }; private: DescriptorHandle _descriptor[4]; @@ -95,8 +63,7 @@ private: GetProcessStarter(); } - bool InternalWait (int *returnCode, int timeOutSeconds, - bool *pollStillRunning); + bool InternalWait (int *returnCode, int timeOutSeconds, bool *pollStillRunning); public: enum DescriptorType { @@ -298,28 +265,8 @@ protected: void PollReapDirectChildren(void); public: - FastOS_UNIX_ProcessStarter (FastOS_ApplicationInterface *app) - : _app(app), - _processList(NULL), - _pid(-1), - _starterSocket(-1), - _mainSocket(-1), - _starterSocketDescr(-1), - _mainSocketDescr(-1), - _hasProxiedChildren(false), - _closedProxyProcessFiles(false), - _hasDetachedProcess(false), - _hasDirectChildren(false) - { - } - - ~FastOS_UNIX_ProcessStarter () - { - if(_starterSocket != -1) - close(_starterSocket); - if(_mainSocket != -1) - close(_mainSocket); - } + FastOS_UNIX_ProcessStarter (FastOS_ApplicationInterface *app); + ~FastOS_UNIX_ProcessStarter (); bool Start (); void Stop (); diff --git a/fastos/src/vespa/fastos/unix_socket.cpp b/fastos/src/vespa/fastos/unix_socket.cpp index ae72c39147d..2bdda49c982 100644 --- a/fastos/src/vespa/fastos/unix_socket.cpp +++ b/fastos/src/vespa/fastos/unix_socket.cpp @@ -1,6 +1,10 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include +#include "socket.h" +#include +#include +#include +#include FastOS_UNIX_Socket::~FastOS_UNIX_Socket() { diff --git a/fastos/src/vespa/fastos/unix_thread.cpp b/fastos/src/vespa/fastos/unix_thread.cpp index 3633d1cacc6..eca7a472c6d 100644 --- a/fastos/src/vespa/fastos/unix_thread.cpp +++ b/fastos/src/vespa/fastos/unix_thread.cpp @@ -1,7 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include +#include "thread.h" #include #include +#include namespace { std::atomic_size_t _G_nextCpuId(0); @@ -69,7 +70,7 @@ void FastOS_UNIX_Thread::PreEntry () { } -FastOS_UNIX_Thread::~FastOS_UNIX_Thread(void) +FastOS_UNIX_Thread::~FastOS_UNIX_Thread() { void *value; @@ -80,6 +81,18 @@ FastOS_UNIX_Thread::~FastOS_UNIX_Thread(void) } } +bool FastOS_UNIX_Thread::Sleep (int ms) +{ + bool rc=false; + + if (ms > 0) { + usleep(ms*1000); + rc = true; + } + + return rc; +} + FastOS_ThreadId FastOS_UNIX_Thread::GetThreadId () { return _handle; @@ -90,8 +103,7 @@ FastOS_ThreadId FastOS_UNIX_Thread::GetCurrentThreadId () return pthread_self(); } -bool FastOS_UNIX_Thread::CompareThreadIds (FastOS_ThreadId a, - FastOS_ThreadId b) +bool FastOS_UNIX_Thread::CompareThreadIds (FastOS_ThreadId a, FastOS_ThreadId b) { return (pthread_equal(a, b) != 0); } diff --git a/fastos/src/vespa/fastos/unix_thread.h b/fastos/src/vespa/fastos/unix_thread.h index 691a7909bbb..c6e0b040fc7 100644 --- a/fastos/src/vespa/fastos/unix_thread.h +++ b/fastos/src/vespa/fastos/unix_thread.h @@ -9,7 +9,7 @@ #pragma once -#include +#include "thread.h" class FastOS_UNIX_Thread : public FastOS_ThreadInterface { @@ -36,21 +36,9 @@ public: ~FastOS_UNIX_Thread(); - static bool Sleep (int ms) - { - bool rc=false; - - if (ms > 0) { - usleep(ms*1000); - rc = true; - } - - return rc; - } - + static bool Sleep (int ms); FastOS_ThreadId GetThreadId () override; - static bool CompareThreadIds (FastOS_ThreadId a, - FastOS_ThreadId b); + static bool CompareThreadIds (FastOS_ThreadId a, FastOS_ThreadId b); static FastOS_ThreadId GetCurrentThreadId (); }; diff --git a/fbench/src/fbench/client.cpp b/fbench/src/fbench/client.cpp index 5c828fc4282..0200ea2d067 100644 --- a/fbench/src/fbench/client.cpp +++ b/fbench/src/fbench/client.cpp @@ -1,8 +1,12 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "client.h" #include +#include #include #include -#include "client.h" +#include +#include Client::Client(ClientArguments *args) : _args(args), diff --git a/fbench/src/fbench/client.h b/fbench/src/fbench/client.h index 107b4997d93..1e0b750dbb2 100644 --- a/fbench/src/fbench/client.h +++ b/fbench/src/fbench/client.h @@ -1,7 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include #include #include @@ -150,6 +149,11 @@ private: ClientArguments &operator=(const ClientArguments &); }; + +class Timer; +class HTTPClient; +class FileReader; +class ClientStatus; /** * This class implements a single test client. The clients are run in * separate threads to simulate several simultanious users. The @@ -161,9 +165,9 @@ class Client private: std::unique_ptr _args; std::unique_ptr _status; - Timer::UP _reqTimer; - Timer::UP _cycleTimer; - Timer::UP _masterTimer; + std::unique_ptr _reqTimer; + std::unique_ptr _cycleTimer; + std::unique_ptr _masterTimer; std::unique_ptr _http; std::unique_ptr _reader; std::unique_ptr _output; diff --git a/fbench/src/fbench/fbench.cpp b/fbench/src/fbench/fbench.cpp index c840797fc4e..c6a34099b3b 100644 --- a/fbench/src/fbench/fbench.cpp +++ b/fbench/src/fbench/fbench.cpp @@ -2,10 +2,10 @@ #include #include #include +#include #include "client.h" #include "fbench.h" -#include - +#include #include sig_atomic_t exitSignal = 0; @@ -161,7 +161,7 @@ FBench::PrintSummary() if (_keepAlive) { printf("*** HTTP keep-alive statistics ***\n"); - printf("connection reuse count -- %" PRId64 "\n", status._reuseCnt); + printf("connection reuse count -- %zu\n", status._reuseCnt); } printf("***************** Benchmark Summary *****************\n"); printf("clients: %8ld\n", _clients.size()); diff --git a/fbench/src/httpclient/httpclient.cpp b/fbench/src/httpclient/httpclient.cpp index 56d8baa4264..c49ef5da12c 100644 --- a/fbench/src/httpclient/httpclient.cpp +++ b/fbench/src/httpclient/httpclient.cpp @@ -1,5 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "httpclient.h" +#include +#include #define FETCH_BUFLEN 5120 #define FIXED_REQ_MAX 256 diff --git a/fbench/src/test/clientstatus.cpp b/fbench/src/test/clientstatus.cpp index 751c578e4d3..c8b7bce1a34 100644 --- a/fbench/src/test/clientstatus.cpp +++ b/fbench/src/test/clientstatus.cpp @@ -1,7 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include -#include -#include +#include #include int diff --git a/fbench/src/test/httpclient.cpp b/fbench/src/test/httpclient.cpp index 31e3f8297c4..4201da68b97 100644 --- a/fbench/src/test/httpclient.cpp +++ b/fbench/src/test/httpclient.cpp @@ -49,6 +49,6 @@ main(int argc, char **argv) } else { printf("ERROR: could not fetch URL content.\n"); } - printf("REUSE COUNT: %" PRIu64 "\n", client->GetReuseCount()); + printf("REUSE COUNT: %zu\n", client->GetReuseCount()); return 0; } diff --git a/fbench/src/test/httpclient_splitstring.cpp b/fbench/src/test/httpclient_splitstring.cpp index 655738170bd..d766b0f8f4b 100644 --- a/fbench/src/test/httpclient_splitstring.cpp +++ b/fbench/src/test/httpclient_splitstring.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include +#include class DebugHTTPClient : public HTTPClient { diff --git a/fnet/src/vespa/fnet/iocomponent.cpp b/fnet/src/vespa/fnet/iocomponent.cpp index 52c9cfd09b5..e5544ceff0e 100644 --- a/fnet/src/vespa/fnet/iocomponent.cpp +++ b/fnet/src/vespa/fnet/iocomponent.cpp @@ -2,7 +2,8 @@ #include "iocomponent.h" #include "transport_thread.h" - +#include +#include FNET_IOComponent::FNET_IOComponent(FNET_TransportThread *owner, int socket_fd, diff --git a/fnet/src/vespa/fnet/packetqueue.cpp b/fnet/src/vespa/fnet/packetqueue.cpp index df1938beb8e..b2ed08d4b04 100644 --- a/fnet/src/vespa/fnet/packetqueue.cpp +++ b/fnet/src/vespa/fnet/packetqueue.cpp @@ -3,6 +3,7 @@ #include "packetqueue.h" #include "packet.h" #include +#include void FNET_PacketQueue_NoLock::ExpandBuf(uint32_t needentries) diff --git a/logd/src/logd/watch.cpp b/logd/src/logd/watch.cpp index 0ff6510bd25..4a5e7df1474 100644 --- a/logd/src/logd/watch.cpp +++ b/logd/src/logd/watch.cpp @@ -9,9 +9,11 @@ #include "perform.h" #include "cmdbuf.h" #include +#include +#include +#include LOG_SETUP(""); -LOG_RCSID("$Id$"); namespace logdemon { namespace { @@ -283,7 +285,7 @@ Watcher::watchfile() { removeOldLogs(filename); if (sb.st_size != offset) { - LOG(warning, "logfile rotation incomplete after %d s (dropping %" PRIu64 " bytes)", + LOG(warning, "logfile rotation incomplete after %d s (dropping %lu bytes)", rotTime, sb.st_size - offset); } else { LOG(debug, "logfile rotation complete after %d s", rotTime); @@ -412,7 +414,7 @@ Watcher::removeOldLogs(const char *prefix) if (totalsize > (_confsubscriber.getRemoveMegabytes() * 1048576LL)) { - LOG(info, "removing %s, total size (%" PRId64 ") too big", + LOG(info, "removing %s, total size (%ld) too big", fname, static_cast(totalsize)); if (unlink(fname) != 0) { LOG(warning, "cannot remove %s: %s", diff --git a/logd/src/tests/forward/forward.cpp b/logd/src/tests/forward/forward.cpp index 6a9a8668e9b..13e31cea464 100644 --- a/logd/src/tests/forward/forward.cpp +++ b/logd/src/tests/forward/forward.cpp @@ -3,6 +3,8 @@ #include #include #include +#include +#include using ns_log::Logger; using namespace logdemon; diff --git a/memfilepersistence/src/vespa/memfilepersistence/common/environment.cpp b/memfilepersistence/src/vespa/memfilepersistence/common/environment.cpp index 044bf1ea56e..5cbaef2363f 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/common/environment.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/common/environment.cpp @@ -3,7 +3,7 @@ #include "environment.h" #include -#include +#include #include #include #include @@ -85,12 +85,12 @@ Environment::calculatePathInDir(const Types::BucketId& id, Directory& dir) vespalib::RandomGen randomizer(static_cast(seed) ^ 0xba5eba11); for (uint32_t i = 1; i <= (uint32_t)_config->dirLevels; ++i) { - os << vespalib::make_vespa_string( + os << vespalib::make_string( "%.4x/", randomizer.nextUint32() % _config->dirSpread); } - os << vespalib::make_vespa_string("%.8" PRIx64 ".0", id.getId()); + os << vespalib::make_string("%.8" PRIx64 ".0", id.getId()); return os.str(); } diff --git a/memfilepersistence/src/vespa/memfilepersistence/device/mountpointlist.cpp b/memfilepersistence/src/vespa/memfilepersistence/device/mountpointlist.cpp index 39530d4d8d1..5e1d835e3a2 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/device/mountpointlist.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/device/mountpointlist.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include LOG_SETUP(".persistence.mountpointlist"); diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/bufferedfilewriter.cpp b/memfilepersistence/src/vespa/memfilepersistence/mapper/bufferedfilewriter.cpp index ee908fb6c6f..c4f4e7e8bc1 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/bufferedfilewriter.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/bufferedfilewriter.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include LOG_SETUP(".persistence.memfile.bufferedfilewriter"); diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/bufferedfilewriter.h b/memfilepersistence/src/vespa/memfilepersistence/mapper/bufferedfilewriter.h index 2370665f3d6..993004c01f0 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/bufferedfilewriter.h +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/bufferedfilewriter.h @@ -16,16 +16,15 @@ #pragma once -#include #include +#include +#include namespace vespalib { class File; } -namespace storage { - -namespace memfile { +namespace storage::memfile { class BufferedFileWriter { public: @@ -115,6 +114,3 @@ private: }; } - -} - diff --git a/metrics/src/vespa/metrics/jsonwriter.cpp b/metrics/src/vespa/metrics/jsonwriter.cpp index d0b269a1521..8dd5e8fdbcb 100644 --- a/metrics/src/vespa/metrics/jsonwriter.cpp +++ b/metrics/src/vespa/metrics/jsonwriter.cpp @@ -1,13 +1,12 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include +#include "jsonwriter.h" -#include -#include -#include -#include +#include "countmetric.h" +#include "valuemetric.h" +#include "metricsnapshot.h" -#include #include +#include namespace metrics { diff --git a/metrics/src/vespa/metrics/loadmetric.hpp b/metrics/src/vespa/metrics/loadmetric.hpp index 781a26a718d..0a66f985867 100644 --- a/metrics/src/vespa/metrics/loadmetric.hpp +++ b/metrics/src/vespa/metrics/loadmetric.hpp @@ -4,6 +4,7 @@ #include "loadmetric.h" #include "memoryconsumption.h" #include +#include namespace metrics { diff --git a/metrics/src/vespa/metrics/metric.cpp b/metrics/src/vespa/metrics/metric.cpp index 42096031486..5f39fccab07 100644 --- a/metrics/src/vespa/metrics/metric.cpp +++ b/metrics/src/vespa/metrics/metric.cpp @@ -10,6 +10,7 @@ #include #include #include +#include namespace metrics { diff --git a/metrics/src/vespa/metrics/metric.h b/metrics/src/vespa/metrics/metric.h index 7819dc5f012..1b97dcb7d27 100644 --- a/metrics/src/vespa/metrics/metric.h +++ b/metrics/src/vespa/metrics/metric.h @@ -4,7 +4,6 @@ #include #include #include -#include namespace metrics { diff --git a/metrics/src/vespa/metrics/metricset.cpp b/metrics/src/vespa/metrics/metricset.cpp index 0bc2f3363dc..af6d9c43d08 100644 --- a/metrics/src/vespa/metrics/metricset.cpp +++ b/metrics/src/vespa/metrics/metricset.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include LOG_SETUP(".metrics.metricsset"); @@ -74,6 +75,15 @@ MetricSet::getMetricInternal(const String& name) const return 0; } +int64_t MetricSet::getLongValue(const stringref &) const { + assert(false); + return 0; +} +double MetricSet::getDoubleValue(const stringref &) const { + assert(false); + return 0; +} + const Metric* MetricSet::getMetric(const String& name) const { diff --git a/metrics/src/vespa/metrics/metricset.h b/metrics/src/vespa/metrics/metricset.h index 5851cdea43c..e6f7cfc0deb 100644 --- a/metrics/src/vespa/metrics/metricset.h +++ b/metrics/src/vespa/metrics/metricset.h @@ -10,9 +10,7 @@ */ #pragma once -#include -#include -#include +#include "metric.h" namespace metrics { @@ -65,10 +63,8 @@ public: void print(std::ostream&, bool verbose, const std::string& indent, uint64_t secondsPassed) const override; // These should never be called on metrics set. - int64_t getLongValue(const stringref & id) const override - { (void) id; assert(false); return 0; } - double getDoubleValue(const stringref & id) const override - { (void) id; assert(false); return 0; } + int64_t getLongValue(const stringref & id) const override; + double getDoubleValue(const stringref & id) const override; const Metric* getMetric(const String& name) const; Metric* getMetric(const String& name) { diff --git a/metrics/src/vespa/metrics/metricsnapshot.cpp b/metrics/src/vespa/metrics/metricsnapshot.cpp index 78fbf6e57a2..0b6ad8f9acd 100644 --- a/metrics/src/vespa/metrics/metricsnapshot.cpp +++ b/metrics/src/vespa/metrics/metricsnapshot.cpp @@ -113,8 +113,8 @@ MetricSnapshotSet::timeForAnotherSnapshot(time_t currentTime) { if (currentTime >= lastTime + 2 * getPeriod()) { LOG(warning, "Metric snapshot set %s was asked if it was time for " "another snapshot, a whole period beyond when it " - "should have been done (Last update was at time %" - PRIu64 ", current time is %" PRIu64 " and period is %u). " + "should have been done (Last update was at time %lu" + ", current time is %lu and period is %u). " "Clearing data and updating time to current time.", getName().c_str(), lastTime, currentTime, getPeriod()); reset(currentTime); diff --git a/metrics/src/vespa/metrics/summetric.hpp b/metrics/src/vespa/metrics/summetric.hpp index 484d4f08169..01e4f5c5dfe 100644 --- a/metrics/src/vespa/metrics/summetric.hpp +++ b/metrics/src/vespa/metrics/summetric.hpp @@ -7,6 +7,7 @@ #include #include #include +#include namespace metrics { diff --git a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h index 0e2821036ea..19076f053eb 100644 --- a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h +++ b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h @@ -15,6 +15,7 @@ #include #include #include +#include namespace document { class FieldSet; diff --git a/persistence/src/vespa/persistence/spi/metricpersistenceprovider.cpp b/persistence/src/vespa/persistence/spi/metricpersistenceprovider.cpp index 19c1e8c7dd6..6f8600c7ca4 100644 --- a/persistence/src/vespa/persistence/spi/metricpersistenceprovider.cpp +++ b/persistence/src/vespa/persistence/spi/metricpersistenceprovider.cpp @@ -1,9 +1,9 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "metricpersistenceprovider.h" +#include #include - LOG_SETUP(".persistence.spi.metrics"); #define PRE_PROCESS(opIndex) \ diff --git a/searchcore/src/apps/fdispatch/fdispatch.cpp b/searchcore/src/apps/fdispatch/fdispatch.cpp index cf70edb4875..21fa696330a 100644 --- a/searchcore/src/apps/fdispatch/fdispatch.cpp +++ b/searchcore/src/apps/fdispatch/fdispatch.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include LOG_SETUP("fdispatch"); diff --git a/searchcore/src/apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp b/searchcore/src/apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp index 4422d659908..a0f34072f06 100644 --- a/searchcore/src/apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp +++ b/searchcore/src/apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp @@ -7,9 +7,10 @@ #include #include #include -#include #include #include +#include +#include #include LOG_SETUP("vespa-gen-testdocs"); diff --git a/searchcore/src/tests/proton/reference/document_db_reference_registry/document_db_reference_registry_test.cpp b/searchcore/src/tests/proton/reference/document_db_reference_registry/document_db_reference_registry_test.cpp index 9d2cb958d39..aa6cbd40126 100644 --- a/searchcore/src/tests/proton/reference/document_db_reference_registry/document_db_reference_registry_test.cpp +++ b/searchcore/src/tests/proton/reference/document_db_reference_registry/document_db_reference_registry_test.cpp @@ -4,14 +4,14 @@ #include #include #include +#include + #include LOG_SETUP("document_db_reference_registry_test"); -namespace proton -{ +namespace proton { -namespace -{ +namespace { std::mutex lock; diff --git a/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.cpp b/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.cpp index d9645e56606..248babad316 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.cpp +++ b/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "appcontext.h" +#include FastS_TimeKeeper::FastS_TimeKeeper() : _clock(0.010), diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.cpp index 402d6986aa8..1fcffa92cce 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.cpp @@ -4,6 +4,7 @@ #include "attribute_directory.h" #include #include +#include namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/matching/docid_range_scheduler.cpp b/searchcore/src/vespa/searchcore/proton/matching/docid_range_scheduler.cpp index 1826b3a8d98..88aea2bd86c 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/docid_range_scheduler.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/docid_range_scheduler.cpp @@ -1,9 +1,9 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "docid_range_scheduler.h" +#include -namespace proton { -namespace matching { +namespace proton::matching { namespace { @@ -160,5 +160,4 @@ AdaptiveDocidRangeScheduler::share_range(size_t thread_id, DocidRange todo) //----------------------------------------------------------------------------- -} // namespace proton::matching -} // namespace proton +} diff --git a/searchcore/src/vespa/searchcore/proton/server/disk_mem_usage_sampler.cpp b/searchcore/src/vespa/searchcore/proton/server/disk_mem_usage_sampler.cpp index 2de1b5fd83f..fb7d712db9d 100644 --- a/searchcore/src/vespa/searchcore/proton/server/disk_mem_usage_sampler.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/disk_mem_usage_sampler.cpp @@ -3,7 +3,7 @@ #include "disk_mem_usage_sampler.h" #include #include -#include +#include using search::makeLambdaTask; diff --git a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp index a833b063567..3750ba03f50 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include LOG_SETUP(".proton.server.feedhandler"); diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.cpp index 8035925f9ec..47af497ec15 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.cpp +++ b/searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.cpp @@ -42,11 +42,8 @@ IndexFlushTarget::needUrgentFlush(void) const { bool urgent = _numFrozenMemoryIndexes > _maxFrozenMemoryIndexes; SerialNum flushedSerial = _indexMaintainer.getFlushedSerialNum(); - LOG(debug, - "Num frozen: %" PRIu32 " Urgent: %d, flushedSerial=%" PRIu64, - _numFrozenMemoryIndexes, - static_cast(urgent), - flushedSerial); + LOG(debug, "Num frozen: %u Urgent: %d, flushedSerial=%lu", + _numFrozenMemoryIndexes, static_cast(urgent), flushedSerial); return urgent; } diff --git a/searchlib/src/apps/docstore/benchmarkdatastore.cpp b/searchlib/src/apps/docstore/benchmarkdatastore.cpp index a1121769557..3dcfbbb31cc 100644 --- a/searchlib/src/apps/docstore/benchmarkdatastore.cpp +++ b/searchlib/src/apps/docstore/benchmarkdatastore.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include LOG_SETUP("documentstore.benchmark"); diff --git a/searchlib/src/apps/uniform/uniform.cpp b/searchlib/src/apps/uniform/uniform.cpp index a42af9f1ff3..b69c2ddfc56 100644 --- a/searchlib/src/apps/uniform/uniform.cpp +++ b/searchlib/src/apps/uniform/uniform.cpp @@ -2,6 +2,7 @@ #include #include +#include static uint64_t diff --git a/searchlib/src/apps/vespa-index-inspect/vespa-index-inspect.cpp b/searchlib/src/apps/vespa-index-inspect/vespa-index-inspect.cpp index 4694eb55176..c2fcba379fd 100644 --- a/searchlib/src/apps/vespa-index-inspect/vespa-index-inspect.cpp +++ b/searchlib/src/apps/vespa-index-inspect/vespa-index-inspect.cpp @@ -9,13 +9,12 @@ #include #include #include -#include #include #include #include -#include #include #include +#include #include LOG_SETUP("vespa-index-inspect"); diff --git a/searchlib/src/tests/common/foregroundtaskexecutor/foregroundtaskexecutor_test.cpp b/searchlib/src/tests/common/foregroundtaskexecutor/foregroundtaskexecutor_test.cpp index a7b0e90ea1f..0cbd4bd9473 100644 --- a/searchlib/src/tests/common/foregroundtaskexecutor/foregroundtaskexecutor_test.cpp +++ b/searchlib/src/tests/common/foregroundtaskexecutor/foregroundtaskexecutor_test.cpp @@ -1,17 +1,16 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -LOG_SETUP("foregroundtaskexecutor_test"); + #include #include #include #include +#include -namespace search -{ +#include +LOG_SETUP("foregroundtaskexecutor_test"); -namespace common -{ +namespace search::common { class Fixture @@ -117,7 +116,6 @@ TEST_F("require that task with different ids are serialized", Fixture) } -} // namespace common -} // namespace search +} TEST_MAIN() { TEST_RUN_ALL(); } diff --git a/searchlib/src/tests/common/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp b/searchlib/src/tests/common/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp index 569bff0f6f3..7d158918715 100644 --- a/searchlib/src/tests/common/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp +++ b/searchlib/src/tests/common/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp @@ -1,18 +1,17 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -LOG_SETUP("sequencedtaskexecutor_test"); + #include #include #include #include #include +#include -namespace search -{ +#include +LOG_SETUP("sequencedtaskexecutor_test"); -namespace common -{ +namespace search::common { class Fixture @@ -236,7 +235,6 @@ TEST_F("require that executeLambda works", Fixture) } -} // namespace common -} // namespace search +} TEST_MAIN() { TEST_RUN_ALL(); } diff --git a/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp b/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp index 820386f41ce..c926d1c2831 100644 --- a/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp +++ b/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp @@ -1010,8 +1010,8 @@ TEST_F("requireThatInversionIsWorking", DictionaryFixture) LOG(info, "Before feature compaction: allocElems=%" PRIu64 ", usedElems=%" PRIu64 ", deadElems=%" PRIu64 ", holdElems=%" PRIu64 - ", freeBuffers=%" PRIu32 ", activeBuffers=%" PRIu32 - ", holdBuffers=%" PRIu32, + ", freeBuffers=%u, activeBuffers=%u" + ", holdBuffers=%u", beforeStats._allocElems, beforeStats._usedElems, beforeStats._deadElems, @@ -1030,8 +1030,8 @@ TEST_F("requireThatInversionIsWorking", DictionaryFixture) LOG(info, "During feature compaction: allocElems=%" PRIu64 ", usedElems=%" PRIu64 ", deadElems=%" PRIu64 ", holdElems=%" PRIu64 - ", freeBuffers=%" PRIu32 ", activeBuffers=%" PRIu32 - ", holdBuffers=%" PRIu32, + ", freeBuffers=%u, activeBuffers=%u" + ", holdBuffers=%u", duringStats._allocElems, duringStats._usedElems, duringStats._deadElems, @@ -1045,8 +1045,8 @@ TEST_F("requireThatInversionIsWorking", DictionaryFixture) LOG(info, "After feature compaction: allocElems=%" PRIu64 ", usedElems=%" PRIu64 ", deadElems=%" PRIu64 ", holdElems=%" PRIu64 - ", freeBuffers=%" PRIu32 ", activeBuffers=%" PRIu32 - ", holdBuffers=%" PRIu32, + ", freeBuffers=%u, activeBuffers=%u" + ", holdBuffers=%u", afterStats._allocElems, afterStats._usedElems, afterStats._deadElems, @@ -1059,14 +1059,12 @@ TEST_F("requireThatInversionIsWorking", DictionaryFixture) TermFieldMatchDataArray matchData; matchData.add(&tfmd); { - PostingIterator itr(f._d.findFrozen("not", 0), featureStoreRef(f._d, 0), - 0, matchData); + PostingIterator itr(f._d.findFrozen("not", 0), featureStoreRef(f._d, 0), 0, matchData); itr.initFullRange(); EXPECT_TRUE(itr.isAtEnd()); } { - PostingIterator itr(f._d.findFrozen("a", 0), featureStoreRef(f._d, 0), - 0, matchData); + PostingIterator itr(f._d.findFrozen("a", 0), featureStoreRef(f._d, 0), 0, matchData); itr.initFullRange(); EXPECT_EQUAL(10u, itr.getDocId()); itr.unpack(10); @@ -1083,33 +1081,27 @@ TEST_F("requireThatInversionIsWorking", DictionaryFixture) EXPECT_TRUE(itr.isAtEnd()); } { - PostingIterator itr(f._d.findFrozen("x", 0), featureStoreRef(f._d, 0), - 0, matchData); + PostingIterator itr(f._d.findFrozen("x", 0), featureStoreRef(f._d, 0), 0, matchData); itr.initFullRange(); EXPECT_TRUE(itr.isAtEnd()); } { - PostingIterator itr(f._d.findFrozen("x", 1), featureStoreRef(f._d, 1), - 1, matchData); + PostingIterator itr(f._d.findFrozen("x", 1), featureStoreRef(f._d, 1), 1, matchData); itr.initFullRange(); EXPECT_EQUAL(30u, itr.getDocId()); itr.unpack(30); - EXPECT_EQUAL("{6:2[e=0,w=1,l=6]}", - toString(tfmd.getIterator(), true, true)); + EXPECT_EQUAL("{6:2[e=0,w=1,l=6]}", toString(tfmd.getIterator(), true, true)); } { - PostingIterator itr(f._d.findFrozen("x", 2), featureStoreRef(f._d, 2), - 2, matchData); + PostingIterator itr(f._d.findFrozen("x", 2), featureStoreRef(f._d, 2), 2, matchData); itr.initFullRange(); EXPECT_EQUAL(30u, itr.getDocId()); itr.unpack(30); // weight is hardcoded to 1 for new style il doc array field - EXPECT_EQUAL("{2:1[e=0,w=1,l=2]}", - toString(tfmd.getIterator(), true, true)); + EXPECT_EQUAL("{2:1[e=0,w=1,l=2]}", toString(tfmd.getIterator(), true, true)); } { - PostingIterator itr(f._d.findFrozen("x", 3), featureStoreRef(f._d, 3), - 3, matchData); + PostingIterator itr(f._d.findFrozen("x", 3), featureStoreRef(f._d, 3), 3, matchData); itr.initFullRange(); EXPECT_EQUAL(30u, itr.getDocId()); itr.unpack(30); diff --git a/searchlib/src/tests/postinglistbm/postinglistbm.cpp b/searchlib/src/tests/postinglistbm/postinglistbm.cpp index 58341a3458e..3a20af3e00a 100644 --- a/searchlib/src/tests/postinglistbm/postinglistbm.cpp +++ b/searchlib/src/tests/postinglistbm/postinglistbm.cpp @@ -13,6 +13,8 @@ #include #include +#include + using search::ResultSet; using search::fef::TermFieldMatchData; using search::fef::TermFieldMatchDataArray; diff --git a/searchlib/src/tests/sort/uca.cpp b/searchlib/src/tests/sort/uca.cpp index 3c55ac3dc31..579f3e7906e 100644 --- a/searchlib/src/tests/sort/uca.cpp +++ b/searchlib/src/tests/sort/uca.cpp @@ -1,17 +1,14 @@ // Copyright 2017 Yahoo Holdings. 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 -#include #include #include +#include +#include +#include LOG_SETUP("uca_stress"); using icu::Collator; diff --git a/searchlib/src/tests/util/ioerrorhandler/ioerrorhandler_test.cpp b/searchlib/src/tests/util/ioerrorhandler/ioerrorhandler_test.cpp index 33d0879220b..f6055376907 100644 --- a/searchlib/src/tests/util/ioerrorhandler/ioerrorhandler_test.cpp +++ b/searchlib/src/tests/util/ioerrorhandler/ioerrorhandler_test.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include LOG_SETUP("ioerrorhandler_test"); diff --git a/searchlib/src/tests/util/sigbushandler/sigbushandler_test.cpp b/searchlib/src/tests/util/sigbushandler/sigbushandler_test.cpp index c4c6b616567..c86a1c86dbb 100644 --- a/searchlib/src/tests/util/sigbushandler/sigbushandler_test.cpp +++ b/searchlib/src/tests/util/sigbushandler/sigbushandler_test.cpp @@ -1,16 +1,19 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -LOG_SETUP("sigbushandler_test"); + #include #include #include #include -#include #include #include -#include #include #include +#include +#include +#include + +#include +LOG_SETUP("sigbushandler_test"); using namespace search::test::statefile; using namespace search::test::statestring; diff --git a/searchlib/src/tests/util/statefile/statefile_test.cpp b/searchlib/src/tests/util/statefile/statefile_test.cpp index 6480455ab3e..a9f087c773b 100644 --- a/searchlib/src/tests/util/statefile/statefile_test.cpp +++ b/searchlib/src/tests/util/statefile/statefile_test.cpp @@ -1,6 +1,5 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -LOG_SETUP("statefile_test"); + #include #include #include @@ -9,15 +8,18 @@ LOG_SETUP("statefile_test"); #include #include #include +#include +#include +#include +#include +LOG_SETUP("statefile_test"); using namespace search::test::statefile; -namespace search -{ +namespace search { -namespace -{ +namespace { bool hasFile(const char *name) diff --git a/searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp b/searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp index 8018c4f8010..4931455da8d 100644 --- a/searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp +++ b/searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "allocatedbitvector.h" +#include namespace search { diff --git a/searchlib/src/vespa/searchlib/common/allocatedbitvector.h b/searchlib/src/vespa/searchlib/common/allocatedbitvector.h index bc9437f1b36..1f895eee93f 100644 --- a/searchlib/src/vespa/searchlib/common/allocatedbitvector.h +++ b/searchlib/src/vespa/searchlib/common/allocatedbitvector.h @@ -4,7 +4,7 @@ #pragma once -#include +#include "bitvector.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/common/partialbitvector.cpp b/searchlib/src/vespa/searchlib/common/partialbitvector.cpp index 462f78446b4..e57396c0dfa 100644 --- a/searchlib/src/vespa/searchlib/common/partialbitvector.cpp +++ b/searchlib/src/vespa/searchlib/common/partialbitvector.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "partialbitvector.h" +#include namespace search { diff --git a/searchlib/src/vespa/searchlib/common/partialbitvector.h b/searchlib/src/vespa/searchlib/common/partialbitvector.h index d30f227304c..4cfd3e34383 100644 --- a/searchlib/src/vespa/searchlib/common/partialbitvector.h +++ b/searchlib/src/vespa/searchlib/common/partialbitvector.h @@ -4,7 +4,7 @@ #pragma once -#include +#include "bitvector.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/common/resultset.cpp b/searchlib/src/vespa/searchlib/common/resultset.cpp index 9a4627a56ab..69f3b13d709 100644 --- a/searchlib/src/vespa/searchlib/common/resultset.cpp +++ b/searchlib/src/vespa/searchlib/common/resultset.cpp @@ -4,6 +4,7 @@ #include "resultset.h" #include "bitvector.h" +#include using vespalib::alloc::Alloc; diff --git a/searchlib/src/vespa/searchlib/diskindex/wordnummapper.cpp b/searchlib/src/vespa/searchlib/diskindex/wordnummapper.cpp index d96f70e2cd3..0bc11dc30a6 100644 --- a/searchlib/src/vespa/searchlib/diskindex/wordnummapper.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/wordnummapper.cpp @@ -3,6 +3,7 @@ #include "wordnummapper.h" #include #include +#include namespace search::diskindex { diff --git a/searchlib/src/vespa/searchlib/predicate/simple_index.hpp b/searchlib/src/vespa/searchlib/predicate/simple_index.hpp index 23a4069d565..48207391eb1 100644 --- a/searchlib/src/vespa/searchlib/predicate/simple_index.hpp +++ b/searchlib/src/vespa/searchlib/predicate/simple_index.hpp @@ -4,8 +4,7 @@ #include "simple_index.h" #include -namespace search { -namespace predicate { +namespace search::predicate { namespace simpleindex { bool log_enabled(); @@ -219,7 +218,7 @@ void SimpleIndex::logVector( if (!simpleindex::log_enabled()) return; auto msg = vespalib::make_string( "%s vector for key '%016" PRIx64 "' with length %zu. Contains %zu documents " - "(doc id limit %" PRIu32", committed doc id limit %" PRIu32 ", ratio %f, " + "(doc id limit %u, committed doc id limit %u, ratio %f, " "vector count %zu)", action, key, vector_length, document_count, _limit_provider.getDocIdLimit(), _limit_provider.getCommittedDocIdLimit(), ratio, _vector_posting_lists.size()); @@ -312,5 +311,4 @@ MemoryUsage SimpleIndex::getMemoryUsage() const { return combined; }; -} // namespace predicate -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.cpp b/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.cpp index 0fd5d3d8acb..cfaf8108672 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.cpp +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.cpp @@ -2,10 +2,8 @@ #include "fakeegcompr64filterocc.h" #include "fpfactory.h" -#include -#include #include -#include +#include using search::fef::TermFieldMatchData; using search::fef::TermFieldMatchDataPosition; diff --git a/searchlib/src/vespa/searchlib/util/comprbuffer.cpp b/searchlib/src/vespa/searchlib/util/comprbuffer.cpp index 4f90d682988..8c7f97db022 100644 --- a/searchlib/src/vespa/searchlib/util/comprbuffer.cpp +++ b/searchlib/src/vespa/searchlib/util/comprbuffer.cpp @@ -3,6 +3,7 @@ #include "comprbuffer.h" #include #include +#include namespace search { diff --git a/searchlib/src/vespa/searchlib/util/dirtraverse.cpp b/searchlib/src/vespa/searchlib/util/dirtraverse.cpp index cb2dc39964b..57c7eee164f 100644 --- a/searchlib/src/vespa/searchlib/util/dirtraverse.cpp +++ b/searchlib/src/vespa/searchlib/util/dirtraverse.cpp @@ -5,6 +5,7 @@ #include "dirtraverse.h" #include #include +#include namespace search { diff --git a/searchlib/src/vespa/searchlib/util/filealign.cpp b/searchlib/src/vespa/searchlib/util/filealign.cpp index 175287b1487..15bef611714 100644 --- a/searchlib/src/vespa/searchlib/util/filealign.cpp +++ b/searchlib/src/vespa/searchlib/util/filealign.cpp @@ -3,6 +3,7 @@ #include "filealign.h" #include #include +#include namespace search { diff --git a/searchlib/src/vespa/searchlib/util/fileutil.cpp b/searchlib/src/vespa/searchlib/util/fileutil.cpp index 2ac25b5ceb2..c1d34f66b0b 100644 --- a/searchlib/src/vespa/searchlib/util/fileutil.cpp +++ b/searchlib/src/vespa/searchlib/util/fileutil.cpp @@ -4,6 +4,9 @@ #include "filesizecalculator.h" #include #include +#include +#include +#include #include LOG_SETUP(".searchlib.util.fileutil"); diff --git a/searchlib/src/vespa/searchlib/util/ioerrorhandler.cpp b/searchlib/src/vespa/searchlib/util/ioerrorhandler.cpp index d4de9202c4a..f044c2782b5 100644 --- a/searchlib/src/vespa/searchlib/util/ioerrorhandler.cpp +++ b/searchlib/src/vespa/searchlib/util/ioerrorhandler.cpp @@ -4,6 +4,7 @@ #include "statebuf.h" #include "statefile.h" #include +#include namespace search { diff --git a/searchlib/src/vespa/searchlib/util/rawbuf.cpp b/searchlib/src/vespa/searchlib/util/rawbuf.cpp index 77fbd556b83..7a23614df73 100644 --- a/searchlib/src/vespa/searchlib/util/rawbuf.cpp +++ b/searchlib/src/vespa/searchlib/util/rawbuf.cpp @@ -6,6 +6,7 @@ #include #include #include +#include namespace search { diff --git a/searchlib/src/vespa/searchlib/util/stringenum.cpp b/searchlib/src/vespa/searchlib/util/stringenum.cpp index 7e855c5b9f3..2a29754443a 100644 --- a/searchlib/src/vespa/searchlib/util/stringenum.cpp +++ b/searchlib/src/vespa/searchlib/util/stringenum.cpp @@ -4,6 +4,7 @@ #include "stringenum.h" #include +#include #include LOG_SETUP(".seachlib.util.stringenum"); diff --git a/staging_vespalib/src/tests/shutdownguard/shutdownguard_test.cpp b/staging_vespalib/src/tests/shutdownguard/shutdownguard_test.cpp index 09ef33413e0..e6f7bd21750 100644 --- a/staging_vespalib/src/tests/shutdownguard/shutdownguard_test.cpp +++ b/staging_vespalib/src/tests/shutdownguard/shutdownguard_test.cpp @@ -1,6 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include #include +#include +#include using namespace vespalib; diff --git a/staging_vespalib/src/tests/util/process_memory_stats/process_memory_stats_test.cpp b/staging_vespalib/src/tests/util/process_memory_stats/process_memory_stats_test.cpp index 3b09b672c57..c8a9590eb96 100644 --- a/staging_vespalib/src/tests/util/process_memory_stats/process_memory_stats_test.cpp +++ b/staging_vespalib/src/tests/util/process_memory_stats/process_memory_stats_test.cpp @@ -4,6 +4,9 @@ #include #include #include +#include +#include +#include using namespace vespalib; diff --git a/staging_vespalib/src/vespa/vespalib/util/clock.cpp b/staging_vespalib/src/vespa/vespalib/util/clock.cpp index 1e474155ff4..403e1408747 100644 --- a/staging_vespalib/src/vespa/vespalib/util/clock.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/clock.cpp @@ -1,5 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + #include "clock.h" +#include using namespace fastos; diff --git a/staging_vespalib/src/vespa/vespalib/util/shutdownguard.cpp b/staging_vespalib/src/vespa/vespalib/util/shutdownguard.cpp index da608447d35..b8fd84f812e 100644 --- a/staging_vespalib/src/vespa/vespalib/util/shutdownguard.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/shutdownguard.cpp @@ -1,5 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "shutdownguard.h" +#include #include LOG_SETUP(".vespalib.shutdownguard"); diff --git a/storage/src/tests/storageserver/documentapiconvertertest.cpp b/storage/src/tests/storageserver/documentapiconvertertest.cpp index d8761f9e84e..a0553625c8c 100644 --- a/storage/src/tests/storageserver/documentapiconvertertest.cpp +++ b/storage/src/tests/storageserver/documentapiconvertertest.cpp @@ -13,6 +13,7 @@ #include #include #include +#include using document::DataType; using document::DocIdString; diff --git a/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.cpp b/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.cpp index 4512c6ddf4f..84b90ceedec 100644 --- a/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.cpp +++ b/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.cpp @@ -2,6 +2,7 @@ #include "bucketmanagermetrics.h" #include +#include namespace storage { diff --git a/storage/src/vespa/storage/distributor/operations/external/visitororder.h b/storage/src/vespa/storage/distributor/operations/external/visitororder.h index 88fd242a454..69aefb1ec33 100644 --- a/storage/src/vespa/storage/distributor/operations/external/visitororder.h +++ b/storage/src/vespa/storage/distributor/operations/external/visitororder.h @@ -1,8 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -namespace storage { +#include -namespace distributor { +namespace storage::distributor { struct VisitorOrder { const document::OrderingSpecification& _ordering; @@ -78,6 +78,4 @@ struct VisitorOrder { } -} - diff --git a/storage/src/vespa/storage/distributor/operations/idealstate/joinoperation.cpp b/storage/src/vespa/storage/distributor/operations/idealstate/joinoperation.cpp index f17792302d1..536c9d764be 100644 --- a/storage/src/vespa/storage/distributor/operations/idealstate/joinoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/idealstate/joinoperation.cpp @@ -2,7 +2,7 @@ #include "joinoperation.h" #include - +#include #include LOG_SETUP(".distributor.operation.idealstate.join"); diff --git a/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.cpp b/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.cpp index 88f3a238a78..5c69c4576f0 100644 --- a/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.cpp @@ -4,9 +4,9 @@ #include #include #include +#include #include - LOG_SETUP(".distributor.operation.idealstate.split"); using namespace storage::distributor; diff --git a/storage/src/vespa/storage/distributor/pendingclusterstate.cpp b/storage/src/vespa/storage/distributor/pendingclusterstate.cpp index ac08e176a97..2039c1b5177 100644 --- a/storage/src/vespa/storage/distributor/pendingclusterstate.cpp +++ b/storage/src/vespa/storage/distributor/pendingclusterstate.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include LOG_SETUP(".pendingclusterstate"); diff --git a/storage/src/vespa/storage/persistence/bucketprocessor.cpp b/storage/src/vespa/storage/persistence/bucketprocessor.cpp index fd9b51a90c7..c512cdd461a 100644 --- a/storage/src/vespa/storage/persistence/bucketprocessor.cpp +++ b/storage/src/vespa/storage/persistence/bucketprocessor.cpp @@ -3,6 +3,7 @@ #include "bucketprocessor.h" #include #include +#include namespace storage { diff --git a/storage/src/vespa/storage/persistence/splitbitdetector.cpp b/storage/src/vespa/storage/persistence/splitbitdetector.cpp index d8bf01775c8..1133c470bb0 100644 --- a/storage/src/vespa/storage/persistence/splitbitdetector.cpp +++ b/storage/src/vespa/storage/persistence/splitbitdetector.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include LOG_SETUP(".persistence.split.bitdetector"); diff --git a/storage/src/vespa/storage/storageserver/distributornode.h b/storage/src/vespa/storage/storageserver/distributornode.h index 47b14470639..34f2dbb42a7 100644 --- a/storage/src/vespa/storage/storageserver/distributornode.h +++ b/storage/src/vespa/storage/storageserver/distributornode.h @@ -24,7 +24,7 @@ class DistributorNode uint64_t _lastUniqueTimestampRequested; uint32_t _uniqueTimestampCounter; bool _manageActiveBucketCopies; - StorageLink::UP _retrievedCommunicationManager; + std::unique_ptr _retrievedCommunicationManager; public: typedef std::unique_ptr UP; @@ -38,7 +38,7 @@ public: DistributorNodeContext&, ApplicationGenerationFetcher& generationFetcher, NeedActiveState, - StorageLink::UP communicationManager = StorageLink::UP()); + std::unique_ptr communicationManager); ~DistributorNode(); const lib::NodeType& getNodeType() const override { return lib::NodeType::DISTRIBUTOR; } @@ -49,7 +49,7 @@ public: private: void initializeNodeSpecific() override; - StorageLink::UP createChain() override; + std::unique_ptr createChain() override; api::Timestamp getUniqueTimestamp() override; /** diff --git a/storage/src/vespa/storage/storageserver/servicelayernode.h b/storage/src/vespa/storage/storageserver/servicelayernode.h index 4e0de3bbf24..848cc1d1475 100644 --- a/storage/src/vespa/storage/storageserver/servicelayernode.h +++ b/storage/src/vespa/storage/storageserver/servicelayernode.h @@ -11,6 +11,8 @@ #include "applicationgenerationfetcher.h" #include "servicelayernodecontext.h" #include "storagenode.h" +#include +#include #include #include #include @@ -65,7 +67,7 @@ private: void configure(std::unique_ptr config) override; VisitorMessageSession::UP createSession(Visitor&, VisitorThread&) override; documentapi::Priority::Value toDocumentPriority(uint8_t storagePriority) const override; - StorageLink::UP createChain() override; + std::unique_ptr createChain() override; void removeConfigSubscriptions() override; }; diff --git a/storage/src/vespa/storage/storageserver/storagenode.cpp b/storage/src/vespa/storage/storageserver/storagenode.cpp index ac386674032..27f98b478ce 100644 --- a/storage/src/vespa/storage/storageserver/storagenode.cpp +++ b/storage/src/vespa/storage/storageserver/storagenode.cpp @@ -1,37 +1,22 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "storagenode.h" -#include "bouncer.h" -#include "bucketintegritychecker.h" #include "communicationmanager.h" -#include "mergethrottler.h" -#include "opslogger.h" #include "statemanager.h" #include "statereporter.h" #include "storagemetricsset.h" +#include "storagenodecontext.h" -#include -#include -#include -#include -#include +#include +#include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include -#include -#include +#include +#include LOG_SETUP(".node.server"); namespace storage { diff --git a/storage/src/vespa/storage/storageserver/storagenode.h b/storage/src/vespa/storage/storageserver/storagenode.h index 530920b7578..4c4918e6977 100644 --- a/storage/src/vespa/storage/storageserver/storagenode.h +++ b/storage/src/vespa/storage/storageserver/storagenode.h @@ -12,35 +12,23 @@ #pragma once -#include "storagemetricsset.h" -#include "storagenodecontext.h" -#include "applicationgenerationfetcher.h" -#include -#include - -#include -#include -#include -#include -#include -#include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include +#include + +#include +#include +#include + +#include +#include +#include #include #include +namespace document { class DocumentTypeRepo; } + namespace storage { class StatusMetricConsumer; @@ -49,6 +37,17 @@ class CommunicationManager; class FileStorManager; class HostInfo; class StateManager; +class MemoryStatusViewer; +class StatusWebServer; +class StorageLink; +class DeadLockDetector; +class StorageMetricSet; +class StorageNodeContext; +class ApplicationGenerationFetcher; +class StorageComponent; + +namespace lib { class NodeType; } + class StorageNode : private config::IFetcherCallback, private config::IFetcherCallback, @@ -82,7 +81,7 @@ public: void updateMetrics(const MetricLockGuard & guard) override; /** Updates the document type repo. */ - void setNewDocumentRepo(const document::DocumentTypeRepo::SP& repo); + void setNewDocumentRepo(const std::shared_ptr& repo); /** * Pauses the persistence processing. While the returned ResumeGuard @@ -154,7 +153,7 @@ protected: std::unique_ptr _newDistributionConfig; std::unique_ptr _newPriorityConfig; std::unique_ptr _newDoctypesConfig; - StorageComponent::UP _component; + std::unique_ptr _component; config::ConfigUri _configUri; CommunicationManager* _communicationManager; @@ -170,7 +169,7 @@ protected: void initialize(); virtual void subscribeToConfigs(); virtual void initializeNodeSpecific() = 0; - virtual StorageLink::UP createChain() = 0; + virtual std::unique_ptr createChain() = 0; virtual void handleLiveConfigUpdate(); void shutdown(); virtual void removeConfigSubscriptions(); diff --git a/storage/src/vespa/storage/storageutil/resumeguard.h b/storage/src/vespa/storage/storageutil/resumeguard.h index f6003000205..a6fdcbbe506 100644 --- a/storage/src/vespa/storage/storageutil/resumeguard.h +++ b/storage/src/vespa/storage/storageutil/resumeguard.h @@ -13,7 +13,7 @@ public: }; ResumeGuard() - : _cb(NULL) + : _cb(nullptr) {} ResumeGuard(Callback& cb) @@ -21,7 +21,7 @@ public: ResumeGuard(const ResumeGuard& other) { _cb = other._cb; - const_cast(other)._cb = NULL; + const_cast(other)._cb = nullptr; } ~ResumeGuard() { diff --git a/storage/src/vespa/storage/tools/throttlingsim.cpp b/storage/src/vespa/storage/tools/throttlingsim.cpp index 26fa4f94875..cd3c0c1cea4 100644 --- a/storage/src/vespa/storage/tools/throttlingsim.cpp +++ b/storage/src/vespa/storage/tools/throttlingsim.cpp @@ -3,6 +3,7 @@ #include "throttlingsim.h" #include #include +#include bool Receiver::enqueue(const Message& msg) { vespalib::MonitorGuard lock(sync); diff --git a/storage/src/vespa/storage/visiting/visitormessagesessionfactory.h b/storage/src/vespa/storage/visiting/visitormessagesessionfactory.h index fb090fc2860..5515595a1c5 100644 --- a/storage/src/vespa/storage/visiting/visitormessagesessionfactory.h +++ b/storage/src/vespa/storage/visiting/visitormessagesessionfactory.h @@ -2,7 +2,7 @@ #pragma once -#include +#include "visitormessagesession.h" namespace storage { diff --git a/storageapi/src/vespa/storageapi/message/visitor.cpp b/storageapi/src/vespa/storageapi/message/visitor.cpp index 8da8f208f3d..851896f4d55 100644 --- a/storageapi/src/vespa/storageapi/message/visitor.cpp +++ b/storageapi/src/vespa/storageapi/message/visitor.cpp @@ -2,9 +2,9 @@ #include "visitor.h" #include +#include -namespace storage { -namespace api { +namespace storage::api { IMPLEMENT_COMMAND(CreateVisitorCommand, CreateVisitorReply) IMPLEMENT_REPLY(CreateVisitorReply) @@ -230,5 +230,4 @@ operator<<(std::ostream& out, const VisitorInfoCommand::BucketTimestampPair& pai return out << pair.bucketId << " - " << pair.timestamp; } -} // api -} // storage +} diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/component/componentregisterimpl.h b/storageframework/src/vespa/storageframework/defaultimplementation/component/componentregisterimpl.h index 87659b55250..7319a1e7d57 100644 --- a/storageframework/src/vespa/storageframework/defaultimplementation/component/componentregisterimpl.h +++ b/storageframework/src/vespa/storageframework/defaultimplementation/component/componentregisterimpl.h @@ -31,9 +31,8 @@ namespace metrics { } -namespace storage { -namespace framework { -namespace defaultimplementation { + +namespace storage::framework::defaultimplementation { struct ShutdownListener { virtual ~ShutdownListener() {} @@ -89,8 +88,4 @@ public: }; -} // defaultimplementation -} // framework -} // storage - - +} diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorystate.cpp b/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorystate.cpp index 54da9be7e31..2351edd267c 100644 --- a/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorystate.cpp +++ b/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorystate.cpp @@ -84,8 +84,8 @@ MemoryState::addToEntry(const MemoryAllocationType& type, uint64_t memory, AllocationResult result, bool forcedAllocation, uint64_t allocationCounts) { - LOG(spam, "Allocating memory %s - %" PRIu64 " bytes at priority %u. " - "Count %" PRIu64 ".", + LOG(spam, "Allocating memory %s - %lu bytes at priority %u. " + "Count %lu.", type.getName().c_str(), memory, priority, allocationCounts); PriorityMap& map(_current._allocations[&type]); Entry& e(map[priority]); @@ -110,7 +110,7 @@ MemoryState::addToEntry(const MemoryAllocationType& type, uint64_t memory, if (_current._usedWithoutCache > _max._usedWithoutCache + _minJumpToUpdateMax) { - LOG(spam, "Updating max to current %" PRIu64 " bytes of memory used", + LOG(spam, "Updating max to current %lu bytes of memory used", _current._usedWithoutCache); _max = _current; _max._timeTaken = _clock->getTimeInSeconds(); @@ -122,8 +122,8 @@ MemoryState::removeFromEntry(const MemoryAllocationType& type, uint64_t memory, uint8_t priority, uint64_t allocationCounts) { - LOG(spam, "Freeing memory %s - %" PRIu64 " bytes at priority %u. " - "Count %" PRIu64 ".", + LOG(spam, "Freeing memory %s - %lu bytes at priority %u. " + "Count %lu.", type.getName().c_str(), memory, priority, allocationCounts); PriorityMap& map(_current._allocations[&type]); Entry& e(map[priority]); diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/memory/prioritymemorylogic.cpp b/storageframework/src/vespa/storageframework/defaultimplementation/memory/prioritymemorylogic.cpp index 681ee10df0f..51bb7ba5019 100644 --- a/storageframework/src/vespa/storageframework/defaultimplementation/memory/prioritymemorylogic.cpp +++ b/storageframework/src/vespa/storageframework/defaultimplementation/memory/prioritymemorylogic.cpp @@ -5,14 +5,12 @@ #include LOG_SETUP(".memory.logic.priority"); -namespace storage { -namespace framework { -namespace defaultimplementation { +namespace storage::framework::defaultimplementation { PriorityMemoryLogic::PriorityMemoryLogic(Clock& c, uint64_t maxMem) : SimpleMemoryLogic(c, maxMem) { - LOG(debug, "Setup priority memory logic with max memory of %" PRIu64 " bytes", maxMem); + LOG(debug, "Setup priority memory logic with max memory of %lu bytes", maxMem); } float @@ -29,6 +27,4 @@ PriorityMemoryLogic::print(std::ostream& out, bool verbose, SimpleMemoryLogic::print(out, verbose, indent); } -} // defaultimplementation -} // framework -} // storage +} diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp b/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp index 1fb4adc6618..b9ccb2d4d9f 100644 --- a/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp +++ b/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp @@ -82,9 +82,9 @@ ThreadImpl::registerTick(CycleType cycleType, MilliSecTime time) if (data._lastTickMs == 0) { return; } if (previousTickMs > nowMs) { - LOGBP(warning, "Thread is registering tick at time %" PRIu64 ", but " - "last time it registered a tick, the time was %" - PRIu64 ". Assuming clock has been adjusted backwards", + LOGBP(warning, "Thread is registering tick at time %lu, but " + "last time it registered a tick, the time was %lu" + ". Assuming clock has been adjusted backwards", nowMs, previousTickMs); return; } diff --git a/storageframework/src/vespa/storageframework/generic/metric/metricregistrator.h b/storageframework/src/vespa/storageframework/generic/metric/metricregistrator.h index 7d0ae594e5f..7b05bbe8040 100644 --- a/storageframework/src/vespa/storageframework/generic/metric/metricregistrator.h +++ b/storageframework/src/vespa/storageframework/generic/metric/metricregistrator.h @@ -10,22 +10,24 @@ */ #pragma once -#include +#include #include -namespace storage { -namespace framework { +namespace metrics { + class Metric; +} + +namespace storage::framework { + +class MetricUpdateHook; struct MetricRegistrator { virtual ~MetricRegistrator() {} virtual void registerMetric(metrics::Metric&) = 0; - virtual void registerUpdateHook(vespalib::stringref name, - MetricUpdateHook& hook, - SecondTime period) = 0; + virtual void registerUpdateHook(vespalib::stringref name, MetricUpdateHook& hook, SecondTime period) = 0; virtual vespalib::MonitorGuard getMetricManagerLock() = 0; }; -} // framework -} // storage +} diff --git a/storageserver/src/vespa/storageserver/app/distributorprocess.cpp b/storageserver/src/vespa/storageserver/app/distributorprocess.cpp index 05b61944a33..6ef391fa56a 100644 --- a/storageserver/src/vespa/storageserver/app/distributorprocess.cpp +++ b/storageserver/src/vespa/storageserver/app/distributorprocess.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include +#include "distributorprocess.h" +#include #include #include @@ -49,12 +50,10 @@ DistributorProcess::updateConfig() { Process::updateConfig(); if (_distributorConfigHandler->isChanged()) { - _node->handleConfigChange( - *_distributorConfigHandler->getConfig()); + _node->handleConfigChange(*_distributorConfigHandler->getConfig()); } if (_visitDispatcherConfigHandler->isChanged()) { - _node->handleConfigChange( - *_visitDispatcherConfigHandler->getConfig()); + _node->handleConfigChange(*_visitDispatcherConfigHandler->getConfig()); } } @@ -76,11 +75,9 @@ DistributorProcess::configUpdated() void DistributorProcess::createNode() { - _node.reset(new DistributorNode(_configUri, _context, *this, _activeFlag)); - _node->handleConfigChange( - *_distributorConfigHandler->getConfig()); - _node->handleConfigChange( - *_visitDispatcherConfigHandler->getConfig()); + _node.reset(new DistributorNode(_configUri, _context, *this, _activeFlag, StorageLink::UP())); + _node->handleConfigChange(*_distributorConfigHandler->getConfig()); + _node->handleConfigChange(*_visitDispatcherConfigHandler->getConfig()); } } // storage diff --git a/storageserver/src/vespa/storageserver/app/process.cpp b/storageserver/src/vespa/storageserver/app/process.cpp index ea8ae4da485..a604490ba85 100644 --- a/storageserver/src/vespa/storageserver/app/process.cpp +++ b/storageserver/src/vespa/storageserver/app/process.cpp @@ -2,6 +2,7 @@ #include "process.h" #include +#include #include #include @@ -19,11 +20,9 @@ Process::setupConfig(uint64_t subscribeTimeout) { _documentHandler = _configSubscriber.subscribe(_configUri.getConfigId(), subscribeTimeout); if (!_configSubscriber.nextConfig()) { - throw vespalib::TimeoutException( - "Could not subscribe to document config within timeout"); + throw vespalib::TimeoutException("Could not subscribe to document config within timeout"); } - _repos.push_back(document::DocumentTypeRepo::SP( - new document::DocumentTypeRepo(*_documentHandler->getConfig()))); + _repos.push_back(std::make_shared(*_documentHandler->getConfig())); getContext().getComponentRegister().setDocumentTypeRepo(_repos.back()); } @@ -42,9 +41,7 @@ void Process::updateConfig() { if (_documentHandler->isChanged()) { - _repos.push_back(document::DocumentTypeRepo::SP( - new document::DocumentTypeRepo( - *_documentHandler->getConfig()))); + _repos.push_back(std::make_shared(*_documentHandler->getConfig())); getNode().setNewDocumentRepo(_repos.back()); } } diff --git a/vdslib/src/tests/container/documentlisttest.cpp b/vdslib/src/tests/container/documentlisttest.cpp index 17fc613c8ab..884241cc483 100644 --- a/vdslib/src/tests/container/documentlisttest.cpp +++ b/vdslib/src/tests/container/documentlisttest.cpp @@ -9,6 +9,8 @@ #include #include #include +#include +#include using document::DocumentTypeRepo; using document::readDocumenttypesConfig; diff --git a/vespaclient/src/vespa/vespaclient/spoolmaster/application.cpp b/vespaclient/src/vespa/vespaclient/spoolmaster/application.cpp index bc640370799..7406e17430d 100644 --- a/vespaclient/src/vespa/vespaclient/spoolmaster/application.cpp +++ b/vespaclient/src/vespa/vespaclient/spoolmaster/application.cpp @@ -5,6 +5,8 @@ #include #include #include +#include +#include #include "application.h" diff --git a/vespalib/src/tests/guard/guard_test.cpp b/vespalib/src/tests/guard/guard_test.cpp index 358a56d44cb..a9d5d5f894c 100644 --- a/vespalib/src/tests/guard/guard_test.cpp +++ b/vespalib/src/tests/guard/guard_test.cpp @@ -1,8 +1,9 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include -#include #include +#include +#include using namespace vespalib; diff --git a/vespalib/src/tests/net/selector/selector_test.cpp b/vespalib/src/tests/net/selector/selector_test.cpp index c91b3e0b054..964e37adf3b 100644 --- a/vespalib/src/tests/net/selector/selector_test.cpp +++ b/vespalib/src/tests/net/selector/selector_test.cpp @@ -6,6 +6,7 @@ #include #include #include +#include using namespace vespalib; diff --git a/vespalib/src/tests/net/socket/socket_test.cpp b/vespalib/src/tests/net/socket/socket_test.cpp index bfeb73f72fc..c7cb2a0b6d9 100644 --- a/vespalib/src/tests/net/socket/socket_test.cpp +++ b/vespalib/src/tests/net/socket/socket_test.cpp @@ -10,6 +10,8 @@ #include #include #include +#include +#include using namespace vespalib; diff --git a/vespalib/src/tests/signalhandler/signalhandler_test.cpp b/vespalib/src/tests/signalhandler/signalhandler_test.cpp index a83661e8697..b11cc5746d9 100644 --- a/vespalib/src/tests/signalhandler/signalhandler_test.cpp +++ b/vespalib/src/tests/signalhandler/signalhandler_test.cpp @@ -1,8 +1,11 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -LOG_SETUP("signalhandler_test"); + #include #include +#include + +#include +LOG_SETUP("signalhandler_test"); using namespace vespalib; diff --git a/vespalib/src/tests/text/utf8/utf8_test.cpp b/vespalib/src/tests/text/utf8/utf8_test.cpp index 9110b44f646..a44c0a7560b 100644 --- a/vespalib/src/tests/text/utf8/utf8_test.cpp +++ b/vespalib/src/tests/text/utf8/utf8_test.cpp @@ -1,10 +1,14 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -LOG_SETUP("utf8_test"); + #include #include #include +#include +#include + +#include +LOG_SETUP("utf8_test"); #if 0 #include #endif diff --git a/vespalib/src/vespa/vespalib/hwaccelrated/avxprivate.hpp b/vespalib/src/vespa/vespalib/hwaccelrated/avxprivate.hpp index f8df7cb5221..ee25652a3a8 100644 --- a/vespalib/src/vespa/vespalib/hwaccelrated/avxprivate.hpp +++ b/vespalib/src/vespa/vespalib/hwaccelrated/avxprivate.hpp @@ -3,12 +3,9 @@ #pragma once #include +#include -namespace vespalib { - -namespace hwaccelrated { - -namespace avx { +namespace vespalib::hwaccelrated::avx { namespace { @@ -80,5 +77,3 @@ T dotProductSelectAlignment(const T * af, const T * bf, size_t sz) } } -} -} diff --git a/vespalib/src/vespa/vespalib/io/fileutil.cpp b/vespalib/src/vespa/vespalib/io/fileutil.cpp index 3b092bd63f4..389218cea35 100644 --- a/vespalib/src/vespa/vespalib/io/fileutil.cpp +++ b/vespalib/src/vespa/vespalib/io/fileutil.cpp @@ -6,6 +6,9 @@ #include #include #include +#include +#include +#include #include #include diff --git a/vespalib/src/vespa/vespalib/stllike/asciistream.cpp b/vespalib/src/vespa/vespalib/stllike/asciistream.cpp index 8d3ff1d77dc..7b895f3eb73 100644 --- a/vespalib/src/vespa/vespalib/stllike/asciistream.cpp +++ b/vespalib/src/vespa/vespalib/stllike/asciistream.cpp @@ -9,6 +9,7 @@ #include #include #include +#include namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/test/socket_options_verifier.h b/vespalib/src/vespa/vespalib/test/socket_options_verifier.h index ace0adb9c8e..2be96b861af 100644 --- a/vespalib/src/vespa/vespalib/test/socket_options_verifier.h +++ b/vespalib/src/vespa/vespalib/test/socket_options_verifier.h @@ -3,6 +3,9 @@ #pragma once #include +#include +#include +#include namespace vespalib { namespace test { diff --git a/vespalib/src/vespa/vespalib/testkit/test_kit.h b/vespalib/src/vespa/vespalib/testkit/test_kit.h index d9f8428c680..7e6b07d71df 100644 --- a/vespalib/src/vespa/vespalib/testkit/test_kit.h +++ b/vespalib/src/vespa/vespalib/testkit/test_kit.h @@ -3,6 +3,7 @@ #pragma once #include +#include #include "test_macros.h" #include "test_comparators.h" #include "test_master.h" diff --git a/vespalib/src/vespa/vespalib/testkit/test_master.cpp b/vespalib/src/vespa/vespalib/testkit/test_master.cpp index 9ea5a8a1c6a..d5309845dfd 100644 --- a/vespalib/src/vespa/vespalib/testkit/test_master.cpp +++ b/vespalib/src/vespa/vespalib/testkit/test_master.cpp @@ -2,6 +2,7 @@ #include "test_master.h" #include +#include namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/alloc.cpp b/vespalib/src/vespa/vespalib/util/alloc.cpp index be443163b81..dff744a0a41 100644 --- a/vespalib/src/vespa/vespalib/util/alloc.cpp +++ b/vespalib/src/vespa/vespalib/util/alloc.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include LOG_SETUP(".vespalib.alloc"); diff --git a/vespalib/src/vespa/vespalib/util/slaveproc.cpp b/vespalib/src/vespa/vespalib/util/slaveproc.cpp index 76fa86ac5db..8b35fa3559b 100644 --- a/vespalib/src/vespa/vespalib/util/slaveproc.cpp +++ b/vespalib/src/vespa/vespalib/util/slaveproc.cpp @@ -3,6 +3,7 @@ #include #include "guard.h" #include "slaveproc.h" +#include #ifndef FASTOS_NO_THREADS diff --git a/vespalib/src/vespa/vespalib/util/stringfmt.h b/vespalib/src/vespa/vespalib/util/stringfmt.h index 625c9530a48..f806368adf5 100644 --- a/vespalib/src/vespa/vespalib/util/stringfmt.h +++ b/vespalib/src/vespa/vespalib/util/stringfmt.h @@ -7,6 +7,7 @@ #ifndef PRId64 #define PRId64 "ld" #define PRIu64 "lu" + #define PRIx64 "lx" #endif namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/sync.h b/vespalib/src/vespa/vespalib/util/sync.h index 737cdbc3fed..ccadbfb8dfc 100644 --- a/vespalib/src/vespa/vespalib/util/sync.h +++ b/vespalib/src/vespa/vespalib/util/sync.h @@ -6,6 +6,8 @@ #include #include #include +#include + namespace vespalib { diff --git a/vespalog/src/test/threads/testthreads.cpp b/vespalog/src/test/threads/testthreads.cpp index b6fea71cb6c..dc469018a5f 100644 --- a/vespalog/src/test/threads/testthreads.cpp +++ b/vespalog/src/test/threads/testthreads.cpp @@ -4,6 +4,9 @@ #include #include #include +#include +#include +#include using std::string; diff --git a/vespalog/src/vespa/log/log.cpp b/vespalog/src/vespa/log/log.cpp index c44d490229b..eb100fd6631 100644 --- a/vespalog/src/vespa/log/log.cpp +++ b/vespalog/src/vespa/log/log.cpp @@ -13,6 +13,9 @@ LOG_SETUP_INDIRECT(".log", "$Id$"); #include "bufferedlogger.h" #include +#include +#include +#include namespace ns_log { diff --git a/vespalog/src/vespa/log/log.h b/vespalog/src/vespa/log/log.h index b78fcf4a72d..127baf14d55 100644 --- a/vespalog/src/vespa/log/log.h +++ b/vespalog/src/vespa/log/log.h @@ -300,3 +300,9 @@ extern void log_abort(const char *message, #else #define LOG_ASSERT(expr) #endif // #ifndef NDEBUG + +#ifndef PRId64 + #define PRId64 "ld" + #define PRIu64 "lu" + #define PRIx64 "lx" +#endif diff --git a/vespamalloc/src/tests/doubledelete/expectsignal.cpp b/vespamalloc/src/tests/doubledelete/expectsignal.cpp index e65f0d67615..9ac93da014d 100644 --- a/vespamalloc/src/tests/doubledelete/expectsignal.cpp +++ b/vespamalloc/src/tests/doubledelete/expectsignal.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include #include +#include using namespace vespalib; diff --git a/vespamalloc/src/tests/overwrite/expectsignal.cpp b/vespamalloc/src/tests/overwrite/expectsignal.cpp index ec1ce893d2e..e78f1b7b181 100644 --- a/vespamalloc/src/tests/overwrite/expectsignal.cpp +++ b/vespamalloc/src/tests/overwrite/expectsignal.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include #include +#include using namespace vespalib; diff --git a/vespamalloc/src/tests/test.cpp b/vespamalloc/src/tests/test.cpp index 6499eaca7ea..899c37d0c0e 100644 --- a/vespamalloc/src/tests/test.cpp +++ b/vespamalloc/src/tests/test.cpp @@ -1,6 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include +#include +#include namespace vespamalloc { void info(); diff --git a/vespamalloc/src/tests/thread/racemanythreads.cpp b/vespamalloc/src/tests/thread/racemanythreads.cpp index 692228ced9e..656a7ef487a 100644 --- a/vespamalloc/src/tests/thread/racemanythreads.cpp +++ b/vespamalloc/src/tests/thread/racemanythreads.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include +#include using namespace vespalib; diff --git a/vespamalloc/src/tests/thread/thread.cpp b/vespamalloc/src/tests/thread/thread.cpp index b121f1e513b..04be3b38b3d 100644 --- a/vespamalloc/src/tests/thread/thread.cpp +++ b/vespamalloc/src/tests/thread/thread.cpp @@ -2,6 +2,7 @@ #include #include +#include using namespace vespalib; -- cgit v1.2.3 From 7bbbf406f3cd920222aba9039c6a460370a4ab14 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 18 Aug 2017 03:04:40 +0200 Subject: Add missing file. --- fastos/src/vespa/fastos/process.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 fastos/src/vespa/fastos/process.cpp diff --git a/fastos/src/vespa/fastos/process.cpp b/fastos/src/vespa/fastos/process.cpp new file mode 100644 index 00000000000..a806799e933 --- /dev/null +++ b/fastos/src/vespa/fastos/process.cpp @@ -0,0 +1,26 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "process.h" +#include + +FastOS_ProcessInterface::FastOS_ProcessInterface (const char *cmdLine, + bool pipeStdin, + FastOS_ProcessRedirectListener *stdoutListener, + FastOS_ProcessRedirectListener *stderrListener, + int bufferSize) : + _extradoublehackforalignment(0.0), + _cmdLine(NULL), + _pipeStdin(pipeStdin), + _stdoutListener(stdoutListener), + _stderrListener(stderrListener), + _bufferSize(bufferSize), + _next(NULL), + _prev(NULL) +{ + _cmdLine = strdup(cmdLine); +} + +FastOS_ProcessInterface::~FastOS_ProcessInterface () +{ + free (_cmdLine); +} -- cgit v1.2.3 From 64809ac8367bb4c059f55a8595f47a323237b238 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 18 Aug 2017 12:04:45 +0200 Subject: Remove more clutter in fastos/types.h --- configd/src/apps/sentinel/sentinel.cpp | 2 +- configd/src/apps/sentinel/service.cpp | 2 +- document/src/tests/heapdebuggerlinux.cpp | 2 +- document/src/vespa/document/select/valuenodes.cpp | 1 + fastos/src/tests/backtracetest.cpp | 2 +- fastos/src/tests/sockettest.cpp | 1 + fastos/src/vespa/fastos/process.h | 1 + fastos/src/vespa/fastos/serversocket.cpp | 73 ++++++------------- fastos/src/vespa/fastos/serversocket.h | 2 +- fastos/src/vespa/fastos/socket.cpp | 15 ++++ fastos/src/vespa/fastos/socket.h | 17 +---- fastos/src/vespa/fastos/socketevent.h | 4 +- fastos/src/vespa/fastos/timestamp.cpp | 4 +- fastos/src/vespa/fastos/types.h | 81 ---------------------- fastos/src/vespa/fastos/unix_app.cpp | 1 + fastos/src/vespa/fastos/unix_cond.cpp | 5 +- fastos/src/vespa/fastos/unix_file.cpp | 5 +- fastos/src/vespa/fastos/unix_file.h | 3 +- fastos/src/vespa/fastos/unix_process.cpp | 1 + fastos/src/vespa/fastos/unix_socket.h | 10 +-- fastos/src/vespa/fastos/unix_time.cpp | 2 +- fbench/src/fbench/fbench.cpp | 1 + fbench/src/filterfile/filterfile.cpp | 2 +- fbench/src/test/filereader.cpp | 2 +- fnet/src/tests/examples/examples_test.cpp | 1 + fnet/src/vespa/fnet/transport_thread.cpp | 1 + fsa/src/libfsa/automaton-alternate.h | 2 +- fsa/src/vespa/fsa/automaton.h | 2 +- fsa/src/vespa/fsa/conceptnet.h | 2 +- fsa/src/vespa/fsa/unicode.cpp | 2 +- fsa/src/vespa/fsamanagers/mutex.cpp | 2 +- fsa/src/vespa/fsamanagers/rwlock.cpp | 2 +- juniper/src/vespa/juniper/hashbase.h | 2 +- logd/src/apps/logd/main.cpp | 20 ++---- logd/src/logd/service.cpp | 2 +- logd/src/logd/watch.cpp | 1 + .../vespa/memfilepersistence/tools/vdsdisktool.cpp | 10 ++- .../src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp | 4 +- .../vespa/searchcore/proton/common/config_hash.hpp | 2 +- .../proton/common/monitored_refcount.cpp | 2 +- .../proton/reference/gid_to_lid_change_handler.cpp | 2 +- .../reference/gid_to_lid_change_registrator.cpp | 2 +- .../attribute/benchmark/attributebenchmark.cpp | 3 +- .../groupingengine/groupingengine_benchmark.cpp | 2 + searchlib/src/tests/query/query-old-large.cpp | 2 +- .../src/vespa/searchlib/common/address_space.cpp | 2 +- .../src/vespa/searchlib/diskindex/fileheader.cpp | 55 ++++----------- searchlib/src/vespa/searchlib/fef/simpletermdata.h | 2 +- slobrok/src/apps/slobrok/slobrok.cpp | 1 + .../src/tests/array/allocinarray_benchmark.cpp | 2 + .../src/tests/array/sort_benchmark.cpp | 2 + .../src/vespa/vespalib/util/shutdownguard.cpp | 12 +++- .../src/vespa/vespalib/util/shutdownguard.h | 10 +-- storageserver/src/apps/storaged/storage.cpp | 2 +- storageserver/src/tests/storageservertest.cpp | 2 + vdslib/src/vespa/vdslib/thread/taskscheduler.cpp | 1 + .../src/vespa/vespaclient/vdsstates/statesapp.cpp | 1 + vespalib/src/tests/alloc/allocate_and_core.cpp | 2 +- vespalib/src/tests/exception_classes/mmap.cpp | 2 +- vespalib/src/tests/zcurve/zcurve_test.cpp | 40 +++++------ .../src/vespa/vespalib/data/slime/inspector.cpp | 2 +- vespalib/src/vespa/vespalib/data/slime/strfmt.cpp | 2 +- vespalib/src/vespa/vespalib/net/socket_handle.cpp | 2 +- .../vespa/vespalib/test/socket_options_verifier.h | 8 +-- vespalib/src/vespa/vespalib/util/arrayqueue.hpp | 2 +- vespalib/src/vespa/vespalib/util/backtrace.cpp | 2 +- .../src/vespa/vespalib/util/generationhandler.h | 2 +- vespalib/src/vespa/vespalib/util/linkedptr.h | 2 +- vespalib/src/vespa/vespalib/util/signalhandler.h | 2 +- vespalib/src/vespa/vespalib/util/valgrind.cpp | 2 +- vespalog/src/logger/runserver.cpp | 2 +- vespalog/src/test/logtest.cpp | 2 +- vespalog/src/test/simple/logtest.cpp | 2 +- vespalog/src/vespa-logfmt/logfilter.c | 2 +- vespalog/src/vespa/log/log.cpp | 1 + vespamalloc/src/vespamalloc/malloc/memorywatcher.h | 2 +- vespamalloc/src/vespamalloc/util/traceutil.h | 4 +- 77 files changed, 180 insertions(+), 304 deletions(-) diff --git a/configd/src/apps/sentinel/sentinel.cpp b/configd/src/apps/sentinel/sentinel.cpp index 61aec8b3376..45bbbe19cf3 100644 --- a/configd/src/apps/sentinel/sentinel.cpp +++ b/configd/src/apps/sentinel/sentinel.cpp @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include -#include +#include #include #include #include diff --git a/configd/src/apps/sentinel/service.cpp b/configd/src/apps/sentinel/service.cpp index 492616c2db4..fc1f768f989 100644 --- a/configd/src/apps/sentinel/service.cpp +++ b/configd/src/apps/sentinel/service.cpp @@ -4,7 +4,7 @@ #include "output-connection.h" #include -#include +#include #include #include #include diff --git a/document/src/tests/heapdebuggerlinux.cpp b/document/src/tests/heapdebuggerlinux.cpp index 125bb2cce24..1b9b2e48e1a 100644 --- a/document/src/tests/heapdebuggerlinux.cpp +++ b/document/src/tests/heapdebuggerlinux.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include diff --git a/document/src/vespa/document/select/valuenodes.cpp b/document/src/vespa/document/select/valuenodes.cpp index cc5ec08dc73..479896f9124 100644 --- a/document/src/vespa/document/select/valuenodes.cpp +++ b/document/src/vespa/document/select/valuenodes.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include diff --git a/fastos/src/tests/backtracetest.cpp b/fastos/src/tests/backtracetest.cpp index 48935e4b6a3..df0887c6b63 100644 --- a/fastos/src/tests/backtracetest.cpp +++ b/fastos/src/tests/backtracetest.cpp @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include -#include +#include #include #include "tests.h" diff --git a/fastos/src/tests/sockettest.cpp b/fastos/src/tests/sockettest.cpp index 0b6e8c9360d..3a9c9dab565 100644 --- a/fastos/src/tests/sockettest.cpp +++ b/fastos/src/tests/sockettest.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #define MAZE_FILE_OFFSET 1078 diff --git a/fastos/src/vespa/fastos/process.h b/fastos/src/vespa/fastos/process.h index e29b90d49cd..1810a730d9d 100644 --- a/fastos/src/vespa/fastos/process.h +++ b/fastos/src/vespa/fastos/process.h @@ -11,6 +11,7 @@ #pragma once #include "types.h" +#include /** * This class serves as a sink for redirected (piped) output from diff --git a/fastos/src/vespa/fastos/serversocket.cpp b/fastos/src/vespa/fastos/serversocket.cpp index 2ad8ed32bb3..a79e163db17 100644 --- a/fastos/src/vespa/fastos/serversocket.cpp +++ b/fastos/src/vespa/fastos/serversocket.cpp @@ -1,12 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -//************************************************************************ -/** - * Implementation of FastOS_ServerSocket methods. - * - * @author Div, Oivind H. Danielsen - */ #include "serversocket.h" +#include #include @@ -23,75 +18,57 @@ void FastOS_ServerSocket::SetSocketFactory(FastOS_SocketFactory *socketFactory) FastOS_SocketInterface *FastOS_ServerSocket::CreateHandlerSocket(void) { - FastOS_SocketInterface *newSocket = NULL; - if (_socketFactory != NULL) - { - newSocket = _socketFactory->CreateSocket(); - } - else - { - newSocket = new FastOS_Socket(); - } - - return newSocket; + return (_socketFactory != nullptr) + ? _socketFactory->CreateSocket() + : (FastOS_SocketInterface *)new FastOS_Socket(); } FastOS_SocketInterface *FastOS_ServerSocket::Accept() { - FastOS_SocketInterface *handlerSocket = NULL; - int handlerSocketHandle; struct sockaddr_storage clientAddress; socklen_t clientAddressLength = sizeof(clientAddress); memset(&clientAddress, 0, sizeof(clientAddress)); - handlerSocketHandle = accept(_socketHandle, - reinterpret_cast(&clientAddress), - &clientAddressLength); + int handlerSocketHandle = accept(_socketHandle, reinterpret_cast(&clientAddress), + &clientAddressLength); - if (handlerSocketHandle >= 0) - { - handlerSocket = CreateHandlerSocket(); + if (handlerSocketHandle >= 0) { + FastOS_SocketInterface *handlerSocket = CreateHandlerSocket(); - if (handlerSocket != NULL) - { - handlerSocket->SetUp(handlerSocketHandle, - reinterpret_cast(&clientAddress)); + if (handlerSocket != nullptr) { + handlerSocket->SetUp(handlerSocketHandle, reinterpret_cast(&clientAddress)); } + return handlerSocket; } - return handlerSocket; + return nullptr; } FastOS_Socket *FastOS_ServerSocket::AcceptPlain() { - FastOS_Socket *handlerSocket = NULL; - int handlerSocketHandle; struct sockaddr_storage clientAddress; socklen_t clientAddressLength = sizeof(clientAddress); memset(&clientAddress, 0, sizeof(clientAddress)); - handlerSocketHandle = accept(_socketHandle, - reinterpret_cast(&clientAddress), - &clientAddressLength); + int handlerSocketHandle = accept(_socketHandle, reinterpret_cast(&clientAddress), + &clientAddressLength); - if (handlerSocketHandle >= 0) - { - handlerSocket = new FastOS_Socket(); + if (handlerSocketHandle >= 0) { + FastOS_Socket *handlerSocket = new FastOS_Socket(); - if (handlerSocket != NULL) - { - handlerSocket->SetUp(handlerSocketHandle, - reinterpret_cast(&clientAddress)); + if (handlerSocket != nullptr) { + handlerSocket->SetUp(handlerSocketHandle, reinterpret_cast(&clientAddress)); } + return handlerSocket; } - return handlerSocket; + return nullptr; } FastOS_ServerSocket::FastOS_ServerSocket(int socketHandle, FastOS_SocketFactory *socketFactory) @@ -117,8 +94,7 @@ bool FastOS_ServerSocket::Listen () (_address.ss_family == AF_INET6 && reinterpret_cast(_address).sin6_port != 0)) reuseAddr = true; - if (SetSoReuseAddr(reuseAddr)) - { + if (SetSoReuseAddr(reuseAddr)) { size_t socketAddrLen; switch (_address.ss_family) { @@ -135,11 +111,8 @@ bool FastOS_ServerSocket::Listen () default: socketAddrLen = sizeof(sockaddr_storage); } - if(bind(_socketHandle, reinterpret_cast(&_address), - socketAddrLen) >= 0) - { - if(listen(_socketHandle, _backLog) >= 0) - { + if(bind(_socketHandle, reinterpret_cast(&_address), socketAddrLen) >= 0) { + if(listen(_socketHandle, _backLog) >= 0) { rc = true; } } diff --git a/fastos/src/vespa/fastos/serversocket.h b/fastos/src/vespa/fastos/serversocket.h index 8452649015c..93f1efe21fc 100644 --- a/fastos/src/vespa/fastos/serversocket.h +++ b/fastos/src/vespa/fastos/serversocket.h @@ -10,7 +10,7 @@ #pragma once -#include +#include "socket.h" /** diff --git a/fastos/src/vespa/fastos/socket.cpp b/fastos/src/vespa/fastos/socket.cpp index 21f5d788b18..2732a38cf4c 100644 --- a/fastos/src/vespa/fastos/socket.cpp +++ b/fastos/src/vespa/fastos/socket.cpp @@ -5,6 +5,8 @@ #include #include #include +#include +#include FastOS_SocketInterface::FastOS_SocketInterface() : _readEventEnabled(false), @@ -264,6 +266,19 @@ int FastOS_SocketInterface::GetLocalPort () return result; } +unsigned short +FastOS_SocketInterface::GetPort () const +{ + switch (_address.ss_family) { + case AF_INET: + return reinterpret_cast(_address).sin_port; + case AF_INET6: + return reinterpret_cast(_address).sin6_port; + default: + return 0; + } +} + std::string FastOS_SocketInterface::getLastErrorString(void) { return FastOS_Socket::getErrorString(FastOS_Socket::GetLastError()); diff --git a/fastos/src/vespa/fastos/socket.h b/fastos/src/vespa/fastos/socket.h index 1d4bf31bf52..6f4650ab64a 100644 --- a/fastos/src/vespa/fastos/socket.h +++ b/fastos/src/vespa/fastos/socket.h @@ -3,9 +3,8 @@ #pragma once #include - #include -#include +#include class FastOS_SocketInterface; class FastOS_ServerSocket; @@ -64,7 +63,7 @@ public: * Convenience method. Does GetErrorString(GetLastError()) * @return Error string */ - static std::string getLastErrorString(void); + static std::string getLastErrorString(); static const char *InitializeServices (); static void CleanupServices (); @@ -282,17 +281,7 @@ public: /** * Return socket port. */ - unsigned short GetPort () const - { - switch (_address.ss_family) { - case AF_INET: - return reinterpret_cast(_address).sin_port; - case AF_INET6: - return reinterpret_cast(_address).sin6_port; - default: - return 0; - } - } + unsigned short GetPort () const; /** * Tune the socket for transport use. diff --git a/fastos/src/vespa/fastos/socketevent.h b/fastos/src/vespa/fastos/socketevent.h index e7f67816586..6ed6b73a86c 100644 --- a/fastos/src/vespa/fastos/socketevent.h +++ b/fastos/src/vespa/fastos/socketevent.h @@ -47,8 +47,8 @@ public: static FastOS_SocketEventObjects *_objects; static FastOS_SocketEventObjects *ObtainObject (FastOS_SocketEvent *event); static void ReleaseObject (FastOS_SocketEventObjects *node); - static void ClassCleanup(void); - static void InitializeClass(void); + static void ClassCleanup(); + static void InitializeClass(); }; diff --git a/fastos/src/vespa/fastos/timestamp.cpp b/fastos/src/vespa/fastos/timestamp.cpp index c671b71de8c..da0aa6bbd01 100644 --- a/fastos/src/vespa/fastos/timestamp.cpp +++ b/fastos/src/vespa/fastos/timestamp.cpp @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include +#include "timestamp.h" #include +#include namespace fastos { diff --git a/fastos/src/vespa/fastos/types.h b/fastos/src/vespa/fastos/types.h index 506d514f642..c474558cdcc 100644 --- a/fastos/src/vespa/fastos/types.h +++ b/fastos/src/vespa/fastos/types.h @@ -1,87 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -//**************************************************************************** -/** - * @file - * Type definitions used in FastOS. - * @author Oivind H. Danielsen - * @date Creation date: 2000-01-18 - *****************************************************************************/ - #pragma once -/** - * @def __STDC_LIMIT_MACROS - * According to C99, C++ implementations will only define UINT64_MAX - * etc when __STDC_LIMIT_MACROS is defined when including stdint.h. - * UINT64_C etc will only be defined when __STDC_CONSTANT_MACROS is - * defined. Since this file can be included from any of the files - * below, we define the behaviour here. - */ -#ifndef __STDC_LIMIT_MACROS - #define __STDC_LIMIT_MACROS 1 -#endif -#ifndef __STDC_CONSTANT_MACROS - #define __STDC_CONSTANT_MACROS 1 -#endif -#ifndef __STDC_FORMAT_MACROS - #define __STDC_FORMAT_MACROS -#endif - -#ifdef __TYPES_H_PTHREAD_U98 -#undef __USE_UNIX98 -#endif - - - -#ifndef __USE_UNIX98 -#define __TYPES_H_UNISTD_U98 -#define __USE_UNIX98 -#endif -#ifdef __TYPES_H_UNISTD_U98 -#undef __USE_UNIX98 -#endif - -#include - -#include - -#include -#include -#include - -#include -#include - -#include -#include - -#ifndef __USE_GNU -#define __USE_GNU /* for O_DIRECT define */ -#define __TYPES_H_DIRECTIO_GNU -#endif - - -#ifdef __TYPES_H_DIRECTIO_GNU -#undef __USE_GNU /* for O_DIRECT define */ -#endif - -#if (__WORDSIZE == 64) - -#else - #error "Only LP 64 environments are supported." -#endif - #define FASTOS_PREFIX(a) FastOS_##a -#define FASTOS_EMFILE_VERIFIED (-1) -#ifdef EMFILE -#undef FASTOS_EMFILE_VERIFIED -#define FASTOS_EMFILE_VERIFIED EMFILE -#endif - -#define FASTOS_ENFILE_VERIFIED (-1) -#ifdef ENFILE -#undef FASTOS_ENFILE_VERIFIED -#define FASTOS_ENFILE_VERIFIED ENFILE -#endif diff --git a/fastos/src/vespa/fastos/unix_app.cpp b/fastos/src/vespa/fastos/unix_app.cpp index e736a157eb8..5916017e95c 100644 --- a/fastos/src/vespa/fastos/unix_app.cpp +++ b/fastos/src/vespa/fastos/unix_app.cpp @@ -12,6 +12,7 @@ #include "process.h" #include "unix_ipc.h" #include +#include #include diff --git a/fastos/src/vespa/fastos/unix_cond.cpp b/fastos/src/vespa/fastos/unix_cond.cpp index 6704ba5ea33..f2e541055ff 100644 --- a/fastos/src/vespa/fastos/unix_cond.cpp +++ b/fastos/src/vespa/fastos/unix_cond.cpp @@ -1,6 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include +#include "cond.h" +#include +#include FastOS_UNIX_Cond::FastOS_UNIX_Cond(void) : FastOS_CondInterface(), @@ -23,6 +25,7 @@ FastOS_UNIX_Cond::Wait(void) bool FastOS_UNIX_Cond::TimedWait(int milliseconds) { + struct timeval currentTime; struct timespec absTime; int error; diff --git a/fastos/src/vespa/fastos/unix_file.cpp b/fastos/src/vespa/fastos/unix_file.cpp index ac474dfcf1a..fb3bcab6b53 100644 --- a/fastos/src/vespa/fastos/unix_file.cpp +++ b/fastos/src/vespa/fastos/unix_file.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -388,10 +389,10 @@ FastOS_UNIX_File::TranslateError (const int osError) case ENXIO: return ERR_NXIO; // Device not configured } - if (osError == FASTOS_ENFILE_VERIFIED) + if (osError == ENFILE) return ERR_NFILE; - if (osError == FASTOS_EMFILE_VERIFIED) + if (osError == EMFILE) return ERR_MFILE; return ERR_UNKNOWN; diff --git a/fastos/src/vespa/fastos/unix_file.h b/fastos/src/vespa/fastos/unix_file.h index 3311782b47a..aa5ea4edb01 100644 --- a/fastos/src/vespa/fastos/unix_file.h +++ b/fastos/src/vespa/fastos/unix_file.h @@ -94,8 +94,7 @@ public: static int64_t GetFreeDiskSpace (const char *path); }; - - +#include /** * This is the generic UNIX implementation of @ref FastOS_DirectoryScan. */ diff --git a/fastos/src/vespa/fastos/unix_process.cpp b/fastos/src/vespa/fastos/unix_process.cpp index f3d15561958..70e441c64db 100644 --- a/fastos/src/vespa/fastos/unix_process.cpp +++ b/fastos/src/vespa/fastos/unix_process.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #ifndef AF_LOCAL diff --git a/fastos/src/vespa/fastos/unix_socket.h b/fastos/src/vespa/fastos/unix_socket.h index a4b5d738d32..a1f25a8d159 100644 --- a/fastos/src/vespa/fastos/unix_socket.h +++ b/fastos/src/vespa/fastos/unix_socket.h @@ -2,7 +2,7 @@ #pragma once -#include +#include "socket.h" class FastOS_UNIX_Socket : public FastOS_SocketInterface { @@ -26,8 +26,8 @@ public: ERR_INPROGRESS = EINPROGRESS, ERR_WOULDBLOCK = EWOULDBLOCK, ERR_ADDRNOTAVAIL = EADDRNOTAVAIL, - ERR_MFILE = FASTOS_EMFILE_VERIFIED, - ERR_NFILE = FASTOS_ENFILE_VERIFIED, + ERR_MFILE = EMFILE, + ERR_NFILE = ENFILE, ERR_CONNRESET = ECONNRESET, ERR_EAGAIN = EAGAIN, // Old style error codes @@ -36,8 +36,8 @@ public: ERR_EINPROGRESS = EINPROGRESS, ERR_EWOULDBLOCK = EWOULDBLOCK, ERR_EADDRNOTAVAIL = EADDRNOTAVAIL, - ERR_EMFILE = FASTOS_EMFILE_VERIFIED, - ERR_ENFILE = FASTOS_ENFILE_VERIFIED + ERR_EMFILE = EMFILE, + ERR_ENFILE = ENFILE }; }; diff --git a/fastos/src/vespa/fastos/unix_time.cpp b/fastos/src/vespa/fastos/unix_time.cpp index 5961d875840..4b83dcd60f5 100644 --- a/fastos/src/vespa/fastos/unix_time.cpp +++ b/fastos/src/vespa/fastos/unix_time.cpp @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "time.h" -#include "types.h" +#include double FastOS_UNIX_Time::MicroSecs() const diff --git a/fbench/src/fbench/fbench.cpp b/fbench/src/fbench/fbench.cpp index c6a34099b3b..c98c3ead4fe 100644 --- a/fbench/src/fbench/fbench.cpp +++ b/fbench/src/fbench/fbench.cpp @@ -7,6 +7,7 @@ #include "fbench.h" #include #include +#include sig_atomic_t exitSignal = 0; diff --git a/fbench/src/filterfile/filterfile.cpp b/fbench/src/filterfile/filterfile.cpp index 918d62215e6..ca93b70a046 100644 --- a/fbench/src/filterfile/filterfile.cpp +++ b/fbench/src/filterfile/filterfile.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include /** * Extract query urls from web logs. The filterfile application reads diff --git a/fbench/src/test/filereader.cpp b/fbench/src/test/filereader.cpp index e85ef6c5821..d01c42fab6f 100644 --- a/fbench/src/test/filereader.cpp +++ b/fbench/src/test/filereader.cpp @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include #include -#include +#include int main(int argc, char **argv) diff --git a/fnet/src/tests/examples/examples_test.cpp b/fnet/src/tests/examples/examples_test.cpp index df5cceb624d..c823c52b995 100644 --- a/fnet/src/tests/examples/examples_test.cpp +++ b/fnet/src/tests/examples/examples_test.cpp @@ -4,6 +4,7 @@ #include #include #include +#include // reserved in vespa/factory/doc/port-ranges.txt static const int PORT0 = 18570; diff --git a/fnet/src/vespa/fnet/transport_thread.cpp b/fnet/src/vespa/fnet/transport_thread.cpp index 4a637b03532..6610d217294 100644 --- a/fnet/src/vespa/fnet/transport_thread.cpp +++ b/fnet/src/vespa/fnet/transport_thread.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include LOG_SETUP(".fnet"); diff --git a/fsa/src/libfsa/automaton-alternate.h b/fsa/src/libfsa/automaton-alternate.h index 535b0f16014..1d64a08ee52 100644 --- a/fsa/src/libfsa/automaton-alternate.h +++ b/fsa/src/libfsa/automaton-alternate.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include // for mmap() etc #include "blob.h" diff --git a/fsa/src/vespa/fsa/automaton.h b/fsa/src/vespa/fsa/automaton.h index 18d56cd4291..f1bcca87cf6 100644 --- a/fsa/src/vespa/fsa/automaton.h +++ b/fsa/src/vespa/fsa/automaton.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include "blob.h" #include "fsa.h" diff --git a/fsa/src/vespa/fsa/conceptnet.h b/fsa/src/vespa/fsa/conceptnet.h index f082660ff18..d17b64bead5 100644 --- a/fsa/src/vespa/fsa/conceptnet.h +++ b/fsa/src/vespa/fsa/conceptnet.h @@ -10,7 +10,7 @@ #pragma once -#include +#include #include #include "file.h" // for FileAccessMethod #include "fsa.h" diff --git a/fsa/src/vespa/fsa/unicode.cpp b/fsa/src/vespa/fsa/unicode.cpp index d4e92d6ca23..870d16ced2c 100644 --- a/fsa/src/vespa/fsa/unicode.cpp +++ b/fsa/src/vespa/fsa/unicode.cpp @@ -5,7 +5,7 @@ #include "unicode.h" -#include +#include #include namespace fsa { diff --git a/fsa/src/vespa/fsamanagers/mutex.cpp b/fsa/src/vespa/fsamanagers/mutex.cpp index 01915b3c185..ba3e5b70c6f 100644 --- a/fsa/src/vespa/fsamanagers/mutex.cpp +++ b/fsa/src/vespa/fsamanagers/mutex.cpp @@ -15,7 +15,7 @@ #ifndef DISABLE_THREADS #include #include -#include +#include #endif #include "mutex.h" diff --git a/fsa/src/vespa/fsamanagers/rwlock.cpp b/fsa/src/vespa/fsamanagers/rwlock.cpp index 3e15d5fd9cf..ee322494968 100644 --- a/fsa/src/vespa/fsamanagers/rwlock.cpp +++ b/fsa/src/vespa/fsamanagers/rwlock.cpp @@ -15,7 +15,7 @@ #ifndef DISABLE_THREADS #include #include -#include +#include #endif #include "rwlock.h" diff --git a/juniper/src/vespa/juniper/hashbase.h b/juniper/src/vespa/juniper/hashbase.h index 0fe03514e48..d651e1d2705 100644 --- a/juniper/src/vespa/juniper/hashbase.h +++ b/juniper/src/vespa/juniper/hashbase.h @@ -2,7 +2,7 @@ #pragma once #include -#include +#include // Simple default order that everybody has - pointer order: template diff --git a/logd/src/apps/logd/main.cpp b/logd/src/apps/logd/main.cpp index 48450f323e9..caeaf83c7cc 100644 --- a/logd/src/apps/logd/main.cpp +++ b/logd/src/apps/logd/main.cpp @@ -1,16 +1,4 @@ // Copyright 2017 Yahoo Holdings. 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 -LOG_SETUP("logdemon"); -LOG_RCSID("$Id$"); #include #include @@ -18,8 +6,14 @@ LOG_RCSID("$Id$"); #include #include #include -#include #include +#include +#include + +#include +LOG_SETUP("logdemon"); + + using namespace logdemon; using config::FileSpec; diff --git a/logd/src/logd/service.cpp b/logd/src/logd/service.cpp index 8e2237b1973..cd4304f5405 100644 --- a/logd/src/logd/service.cpp +++ b/logd/src/logd/service.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include diff --git a/logd/src/logd/watch.cpp b/logd/src/logd/watch.cpp index 4a5e7df1474..0558d0b4548 100644 --- a/logd/src/logd/watch.cpp +++ b/logd/src/logd/watch.cpp @@ -12,6 +12,7 @@ #include #include #include +#include LOG_SETUP(""); diff --git a/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp b/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp index baba449adff..4372f0a67d3 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp @@ -1,6 +1,5 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - #include #include #include @@ -9,15 +8,15 @@ #include #include #include -#include +#include +#include #include LOG_SETUP(".vdsdiskapp"); using std::vector; -namespace storage { -namespace memfile { +namespace storage::memfile { using vespalib::getLastErrorString; @@ -516,5 +515,4 @@ VdsDiskTool::run(int argc, const char * const * argv, return 0; } -} // memfile -} // storage +} diff --git a/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp b/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp index f7588a83236..9a351b56eda 100644 --- a/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp +++ b/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp @@ -1,15 +1,13 @@ // Copyright 2017 Yahoo Holdings. 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 -#include +#include #include LOG_SETUP("vespa-proton-cmd"); diff --git a/searchcore/src/vespa/searchcore/proton/common/config_hash.hpp b/searchcore/src/vespa/searchcore/proton/common/config_hash.hpp index 7578f0e33f4..84e5a632c09 100644 --- a/searchcore/src/vespa/searchcore/proton/common/config_hash.hpp +++ b/searchcore/src/vespa/searchcore/proton/common/config_hash.hpp @@ -4,7 +4,7 @@ #include "config_hash.h" #include -#include +#include namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/common/monitored_refcount.cpp b/searchcore/src/vespa/searchcore/proton/common/monitored_refcount.cpp index b2a12d8a9c0..3cecc8308ad 100644 --- a/searchcore/src/vespa/searchcore/proton/common/monitored_refcount.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/monitored_refcount.cpp @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "monitored_refcount.h" -#include +#include namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.cpp b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.cpp index a70fb5b119d..e7b347c4c80 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.cpp +++ b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include using search::makeLambdaTask; diff --git a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_registrator.cpp b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_registrator.cpp index 19ec153c741..3567a69e8a3 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_registrator.cpp +++ b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_registrator.cpp @@ -2,7 +2,7 @@ #include "gid_to_lid_change_registrator.h" #include "i_gid_to_lid_change_listener.h" -#include +#include namespace proton { diff --git a/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp b/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp index 00321093600..8eef498d85c 100644 --- a/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp +++ b/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp @@ -8,13 +8,12 @@ #include #include #include -#include #include #include #include #include "../attributesearcher.h" #include "../attributeupdater.h" -#include "../runnable.h" +#include #include diff --git a/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp b/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp index ba78f00ffca..37aa9cc3268 100644 --- a/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp +++ b/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp @@ -13,6 +13,8 @@ #include #include #include +#include + #include LOG_SETUP("grouping_benchmark"); diff --git a/searchlib/src/tests/query/query-old-large.cpp b/searchlib/src/tests/query/query-old-large.cpp index 8bdc65c12c1..f1ff391cc2c 100644 --- a/searchlib/src/tests/query/query-old-large.cpp +++ b/searchlib/src/tests/query/query-old-large.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include using namespace search; using namespace search::query; diff --git a/searchlib/src/vespa/searchlib/common/address_space.cpp b/searchlib/src/vespa/searchlib/common/address_space.cpp index a2dcaf024e5..af5e754e68f 100644 --- a/searchlib/src/vespa/searchlib/common/address_space.cpp +++ b/searchlib/src/vespa/searchlib/common/address_space.cpp @@ -2,7 +2,7 @@ #include "address_space.h" #include -#include +#include namespace search { diff --git a/searchlib/src/vespa/searchlib/diskindex/fileheader.cpp b/searchlib/src/vespa/searchlib/diskindex/fileheader.cpp index b8ac5822692..7e479cb2905 100644 --- a/searchlib/src/vespa/searchlib/diskindex/fileheader.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/fileheader.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include LOG_SETUP(".diskindex.fileheader"); @@ -25,19 +26,7 @@ FileHeader::FileHeader() { } - -FileHeader::~FileHeader() -{ -} - - -static inline uint32_t -bswap(uint32_t val) -{ - __asm__("bswap %0" : "=r" (val) : "0" (val)); - return val; -} - +FileHeader::~FileHeader() {} bool FileHeader::taste(const vespalib::string &name, @@ -62,10 +51,8 @@ FileHeader::taste(const vespalib::string &name, } catch (vespalib::IllegalHeaderException &e) { if (e.getMessage() != "Failed to read header info." && e.getMessage() != "Failed to verify magic bits.") { - LOG(error, - "FileHeader::tastGeneric(\"%s\") exception: %s", - name.c_str(), - e.getMessage().c_str()); + LOG(error, "FileHeader::tastGeneric(\"%s\") exception: %s", + name.c_str(), e.getMessage().c_str()); } file.Close(); return false; @@ -82,9 +69,7 @@ FileHeader::taste(const vespalib::string &name, } else if (endian == "little") { _bigEndian = false; } else { - LOG(error, - "Bad endian: %s", - endian.c_str()); + LOG(error, "Bad endian: %s", endian.c_str()); return false; } } @@ -92,33 +77,23 @@ FileHeader::taste(const vespalib::string &name, if (header.hasTag("frozen")) { _completed = header.getTag("frozen").asInteger() != 0; } else { - LOG(error, - "FileHeader::taste(\"%s\"): Missing frozen tag", - name.c_str()); + LOG(error, "FileHeader::taste(\"%s\"): Missing frozen tag", name.c_str()); return false; } if (header.hasTag("fileBitSize")) { _fileBitSize = header.getTag("fileBitSize").asInteger(); if (_completed && _fileBitSize < 8 * _headerLen) { - LOG(error, - "FileHeader::taste(\"%s\"): " - "fleBitSize(%" PRIu64 ") < 8 * headerLen(%u)", - name.c_str(), - _fileBitSize, _headerLen); + LOG(error, "FileHeader::taste(\"%s\"): fleBitSize(%" PRIu64 ") < 8 * headerLen(%u)", + name.c_str(), _fileBitSize, _headerLen); return false; } if (_completed && _fileBitSize > 8 * fileSize) { - LOG(error, - "FileHeader::taste(\"%s\"): " - "fleBitSize(%" PRIu64 ") > 8 * fileSize(%" PRIu64 ")", - name.c_str(), - _fileBitSize, fileSize); + LOG(error, "FileHeader::taste(\"%s\"): fleBitSize(%" PRIu64 ") > 8 * fileSize(%" PRIu64 ")", + name.c_str(), _fileBitSize, fileSize); abort(); } } else if (!_allowNoFileBitSize) { - LOG(error, - "FileHeader::taste(\"%s\"): Missing fileBitSize tag", - name.c_str()); + LOG(error, "FileHeader::taste(\"%s\"): Missing fileBitSize tag", name.c_str()); return false; } for (uint32_t i = 0; ;++i) { @@ -132,10 +107,8 @@ FileHeader::taste(const vespalib::string &name, return true; } - bool -FileHeader::taste(const vespalib::string &name, - const TuneFileSeqWrite &tuneFileWrite) +FileHeader::taste(const vespalib::string &name, const TuneFileSeqWrite &tuneFileWrite) { TuneFileSeqRead tuneFileRead; if (tuneFileWrite.getWantDirectIO()) @@ -143,10 +116,8 @@ FileHeader::taste(const vespalib::string &name, return taste(name, tuneFileRead); } - bool -FileHeader::taste(const vespalib::string &name, - const TuneFileRandRead &tuneFileSearch) +FileHeader::taste(const vespalib::string &name, const TuneFileRandRead &tuneFileSearch) { TuneFileSeqRead tuneFileRead; if (tuneFileSearch.getWantDirectIO()) diff --git a/searchlib/src/vespa/searchlib/fef/simpletermdata.h b/searchlib/src/vespa/searchlib/fef/simpletermdata.h index 2126d1c69ba..ef2d91d6e68 100644 --- a/searchlib/src/vespa/searchlib/fef/simpletermdata.h +++ b/searchlib/src/vespa/searchlib/fef/simpletermdata.h @@ -7,7 +7,7 @@ #include "simpletermfielddata.h" #include #include -#include +#include namespace search { namespace fef { diff --git a/slobrok/src/apps/slobrok/slobrok.cpp b/slobrok/src/apps/slobrok/slobrok.cpp index 688181865be..277cc2f3a87 100644 --- a/slobrok/src/apps/slobrok/slobrok.cpp +++ b/slobrok/src/apps/slobrok/slobrok.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include LOG_SETUP("vespa-slobrok"); diff --git a/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp b/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp index 1331c070612..d222a26c496 100644 --- a/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp +++ b/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp @@ -4,6 +4,8 @@ #include #include #include +#include + #include LOG_SETUP("allocinarray_benchmark"); diff --git a/staging_vespalib/src/tests/array/sort_benchmark.cpp b/staging_vespalib/src/tests/array/sort_benchmark.cpp index f3650273644..a7629084094 100644 --- a/staging_vespalib/src/tests/array/sort_benchmark.cpp +++ b/staging_vespalib/src/tests/array/sort_benchmark.cpp @@ -2,6 +2,8 @@ #include #include #include +#include + #include LOG_SETUP("sort_benchmark"); diff --git a/staging_vespalib/src/vespa/vespalib/util/shutdownguard.cpp b/staging_vespalib/src/vespa/vespalib/util/shutdownguard.cpp index b8fd84f812e..5d8ec190d59 100644 --- a/staging_vespalib/src/vespa/vespalib/util/shutdownguard.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/shutdownguard.cpp @@ -1,12 +1,23 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "shutdownguard.h" #include +#include #include LOG_SETUP(".vespalib.shutdownguard"); namespace vespalib { +namespace { +enum { STACK_SIZE = (1u << 16) }; + +static uint64_t getTimeInMillis() { + struct timeval mytime; + gettimeofday(&mytime, 0); + uint64_t mult = 1000; + return (mytime.tv_sec * mult) + (mytime.tv_usec / mult); +} +} void ShutdownGuard::Run(FastOS_ThreadInterface *, void *) { while (_dieAtTime > getTimeInMillis()) { @@ -32,5 +43,4 @@ ShutdownGuard::~ShutdownGuard() _pool.Close(); } - } diff --git a/staging_vespalib/src/vespa/vespalib/util/shutdownguard.h b/staging_vespalib/src/vespa/vespalib/util/shutdownguard.h index 2eeb06e1a03..5a9aad5d4d4 100644 --- a/staging_vespalib/src/vespa/vespalib/util/shutdownguard.h +++ b/staging_vespalib/src/vespa/vespalib/util/shutdownguard.h @@ -2,6 +2,7 @@ #pragma once #include +#include namespace vespalib { @@ -14,15 +15,6 @@ namespace vespalib { **/ class ShutdownGuard : public FastOS_Runnable { - enum { STACK_SIZE = (1u << 16) }; - - static uint64_t getTimeInMillis() { - struct timeval mytime; - gettimeofday(&mytime, 0); - uint64_t mult = 1000; - return (mytime.tv_sec * mult) + (mytime.tv_usec / mult); - } - FastOS_ThreadPool _pool; volatile uint64_t _dieAtTime; diff --git a/storageserver/src/apps/storaged/storage.cpp b/storageserver/src/apps/storaged/storage.cpp index f1a22d93d41..1f3109381fd 100644 --- a/storageserver/src/apps/storaged/storage.cpp +++ b/storageserver/src/apps/storaged/storage.cpp @@ -11,7 +11,7 @@ * application, but as little as possible else. */ -#include +#include #include #include #include diff --git a/storageserver/src/tests/storageservertest.cpp b/storageserver/src/tests/storageservertest.cpp index d1ef15b7298..2564c500cbc 100644 --- a/storageserver/src/tests/storageservertest.cpp +++ b/storageserver/src/tests/storageservertest.cpp @@ -24,6 +24,8 @@ #include #include #include +#include + #include LOG_SETUP(".storageservertest"); diff --git a/vdslib/src/vespa/vdslib/thread/taskscheduler.cpp b/vdslib/src/vespa/vdslib/thread/taskscheduler.cpp index a0fc63da0be..08c7b80e406 100644 --- a/vdslib/src/vespa/vdslib/thread/taskscheduler.cpp +++ b/vdslib/src/vespa/vdslib/thread/taskscheduler.cpp @@ -3,6 +3,7 @@ #include "taskscheduler.h" #include #include +#include namespace vdslib { diff --git a/vespaclient/src/vespa/vespaclient/vdsstates/statesapp.cpp b/vespaclient/src/vespa/vespaclient/vdsstates/statesapp.cpp index dbec559e5da..99c91216d20 100644 --- a/vespaclient/src/vespa/vespaclient/vdsstates/statesapp.cpp +++ b/vespaclient/src/vespa/vespaclient/vdsstates/statesapp.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include LOG_SETUP("vdsstatetool"); diff --git a/vespalib/src/tests/alloc/allocate_and_core.cpp b/vespalib/src/tests/alloc/allocate_and_core.cpp index faf44aa2669..7b72f35ac0e 100644 --- a/vespalib/src/tests/alloc/allocate_and_core.cpp +++ b/vespalib/src/tests/alloc/allocate_and_core.cpp @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include #include -#include +#include using namespace vespalib::alloc; diff --git a/vespalib/src/tests/exception_classes/mmap.cpp b/vespalib/src/tests/exception_classes/mmap.cpp index 3ba286f2a35..2d4c4796473 100644 --- a/vespalib/src/tests/exception_classes/mmap.cpp +++ b/vespalib/src/tests/exception_classes/mmap.cpp @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include #include -#include +#include #include #include diff --git a/vespalib/src/tests/zcurve/zcurve_test.cpp b/vespalib/src/tests/zcurve/zcurve_test.cpp index 89bc3fed051..67f6a622ff0 100644 --- a/vespalib/src/tests/zcurve/zcurve_test.cpp +++ b/vespalib/src/tests/zcurve/zcurve_test.cpp @@ -1,12 +1,14 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -LOG_SETUP("zcurve_test"); #include #include #include #include #include +#include + +#include +LOG_SETUP("zcurve_test"); namespace vespalib { @@ -20,34 +22,26 @@ public: { } - void - testEncoding(void); + void testEncoding(); - void - testDecoding(void); + void testDecoding(); - double - ftime(void); + double ftime(); - static inline int64_t - encodexy3(int32_t x, int32_t y); + static inline int64_t encodexy3(int32_t x, int32_t y); #define BMLIMIT 0x1000000 template - int64_t - bm(void); + int64_t bm(); template - int64_t - bm2(void); + int64_t bm2(); template - int64_t - bm3(void); + int64_t bm3(); - int64_t - bmcheck(); + int64_t bmcheck(); int Main() override; }; @@ -140,7 +134,7 @@ ZCurveTest::testDecoding(void) double -ZCurveTest::ftime(void) +ZCurveTest::ftime() { struct timeval tv; gettimeofday(&tv, NULL); @@ -183,7 +177,7 @@ ZCurveTest::encodexy3(int32_t x, int32_t y) template int64_t -ZCurveTest::bm(void) +ZCurveTest::bm() { int64_t res = 0; double before = ftime(); @@ -265,7 +259,7 @@ ZCurveTest::bm2(void) template int64_t -ZCurveTest::bm3(void) +ZCurveTest::bm3() { int64_t res = 0; double before = ftime(); @@ -305,7 +299,7 @@ ZCurveTest::bm3(void) int64_t -ZCurveTest::bmcheck(void) +ZCurveTest::bmcheck() { int64_t res = 0; double before = ftime(); @@ -348,7 +342,7 @@ ZCurveTest::bmcheck(void) int -ZCurveTest::Main(void) +ZCurveTest::Main() { TEST_INIT("zcurve_test"); diff --git a/vespalib/src/vespa/vespalib/data/slime/inspector.cpp b/vespalib/src/vespa/vespalib/data/slime/inspector.cpp index 46847c20754..1f5631accc6 100644 --- a/vespalib/src/vespa/vespalib/data/slime/inspector.cpp +++ b/vespalib/src/vespa/vespalib/data/slime/inspector.cpp @@ -3,7 +3,7 @@ #include "inspector.h" #include "object_traverser.h" #include "array_traverser.h" -#include +#include namespace vespalib { namespace slime { diff --git a/vespalib/src/vespa/vespalib/data/slime/strfmt.cpp b/vespalib/src/vespa/vespalib/data/slime/strfmt.cpp index 7b16382dde3..487badfabf8 100644 --- a/vespalib/src/vespa/vespalib/data/slime/strfmt.cpp +++ b/vespalib/src/vespa/vespalib/data/slime/strfmt.cpp @@ -3,7 +3,7 @@ #include "strfmt.h" #include #include -#include +#include namespace vespalib { namespace slime { diff --git a/vespalib/src/vespa/vespalib/net/socket_handle.cpp b/vespalib/src/vespa/vespalib/net/socket_handle.cpp index 5e1e8f0155b..36eae46031f 100644 --- a/vespalib/src/vespa/vespalib/net/socket_handle.cpp +++ b/vespalib/src/vespa/vespalib/net/socket_handle.cpp @@ -3,7 +3,7 @@ #include "socket_handle.h" #include #include -#include +#include namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/test/socket_options_verifier.h b/vespalib/src/vespa/vespalib/test/socket_options_verifier.h index 2be96b861af..72694f643e2 100644 --- a/vespalib/src/vespa/vespalib/test/socket_options_verifier.h +++ b/vespalib/src/vespa/vespalib/test/socket_options_verifier.h @@ -6,9 +6,10 @@ #include #include #include +#include +#include -namespace vespalib { -namespace test { +namespace vespalib::test { namespace { @@ -59,5 +60,4 @@ struct SocketOptionsVerifier { } }; -} // namespace vespalib::test -} // namespace vespalib +} diff --git a/vespalib/src/vespa/vespalib/util/arrayqueue.hpp b/vespalib/src/vespa/vespalib/util/arrayqueue.hpp index 85f4afabf9f..6c26fd3a0c4 100644 --- a/vespalib/src/vespa/vespalib/util/arrayqueue.hpp +++ b/vespalib/src/vespa/vespalib/util/arrayqueue.hpp @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include "traits.h" diff --git a/vespalib/src/vespa/vespalib/util/backtrace.cpp b/vespalib/src/vespa/vespalib/util/backtrace.cpp index 33c3cebe8a8..ee7f39597a6 100644 --- a/vespalib/src/vespa/vespalib/util/backtrace.cpp +++ b/vespalib/src/vespa/vespalib/util/backtrace.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include namespace { diff --git a/vespalib/src/vespa/vespalib/util/generationhandler.h b/vespalib/src/vespa/vespalib/util/generationhandler.h index fbc6f1ae78a..d8af7f39c3e 100644 --- a/vespalib/src/vespa/vespalib/util/generationhandler.h +++ b/vespalib/src/vespa/vespalib/util/generationhandler.h @@ -4,7 +4,7 @@ #include #include -#include +#include namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/linkedptr.h b/vespalib/src/vespa/vespalib/util/linkedptr.h index ca464f48cbb..517208b9ef9 100644 --- a/vespalib/src/vespa/vespalib/util/linkedptr.h +++ b/vespalib/src/vespa/vespalib/util/linkedptr.h @@ -5,7 +5,7 @@ #include #include -#include +#include namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/signalhandler.h b/vespalib/src/vespa/vespalib/util/signalhandler.h index 7db23f72570..6b233b2e690 100644 --- a/vespalib/src/vespa/vespalib/util/signalhandler.h +++ b/vespalib/src/vespa/vespalib/util/signalhandler.h @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include #include namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/valgrind.cpp b/vespalib/src/vespa/vespalib/util/valgrind.cpp index d84855e8005..cbb6cc808fc 100644 --- a/vespalib/src/vespa/vespalib/util/valgrind.cpp +++ b/vespalib/src/vespa/vespalib/util/valgrind.cpp @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include -#include +#include #include #include diff --git a/vespalog/src/logger/runserver.cpp b/vespalog/src/logger/runserver.cpp index ee8125c333a..7cbe3711889 100644 --- a/vespalog/src/logger/runserver.cpp +++ b/vespalog/src/logger/runserver.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include diff --git a/vespalog/src/test/logtest.cpp b/vespalog/src/test/logtest.cpp index b55c05ae93e..42b7bfc6ef9 100644 --- a/vespalog/src/test/logtest.cpp +++ b/vespalog/src/test/logtest.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include diff --git a/vespalog/src/test/simple/logtest.cpp b/vespalog/src/test/simple/logtest.cpp index ff52eeff1bf..020c97dd1a8 100644 --- a/vespalog/src/test/simple/logtest.cpp +++ b/vespalog/src/test/simple/logtest.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include diff --git a/vespalog/src/vespa-logfmt/logfilter.c b/vespalog/src/vespa-logfmt/logfilter.c index cd8dcc86deb..2db108771ee 100644 --- a/vespalog/src/vespa-logfmt/logfilter.c +++ b/vespalog/src/vespa-logfmt/logfilter.c @@ -4,7 +4,7 @@ #include #include #include -#include +#include int main(int argc, char *argv[]) { diff --git a/vespalog/src/vespa/log/log.cpp b/vespalog/src/vespa/log/log.cpp index eb100fd6631..a0977406dc0 100644 --- a/vespalog/src/vespa/log/log.cpp +++ b/vespalog/src/vespa/log/log.cpp @@ -16,6 +16,7 @@ LOG_SETUP_INDIRECT(".log", "$Id$"); #include #include #include +#include namespace ns_log { diff --git a/vespamalloc/src/vespamalloc/malloc/memorywatcher.h b/vespamalloc/src/vespamalloc/malloc/memorywatcher.h index 05290bcda60..00240cadf12 100644 --- a/vespamalloc/src/vespamalloc/malloc/memorywatcher.h +++ b/vespamalloc/src/vespamalloc/malloc/memorywatcher.h @@ -2,7 +2,7 @@ #pragma once #include -#include +#include #include #include #include diff --git a/vespamalloc/src/vespamalloc/util/traceutil.h b/vespamalloc/src/vespamalloc/util/traceutil.h index 664ee970a89..513dfdf8c80 100644 --- a/vespamalloc/src/vespamalloc/util/traceutil.h +++ b/vespamalloc/src/vespamalloc/util/traceutil.h @@ -2,9 +2,9 @@ #pragma once #include -#include +#include #include -#include +#include #include #include #include -- cgit v1.2.3 From 28c129658fa7084c8fcf4981fc57f71a41dc5362 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 18 Aug 2017 14:00:30 +0200 Subject: Hide the thread thread implementation a bit more. --- .../documentmetastore/documentmetastore_test.cpp | 6 ++-- .../searchcore/proton/flushengine/flushengine.h | 1 + .../proton/server/executor_thread_service.cpp | 20 ++++++++---- .../proton/server/executor_thread_service.h | 4 ++- vespalib/src/tests/executor/stress_test.cpp | 5 ++- .../vespalib/util/threadstackexecutorbase.cpp | 28 ++++++++++++----- .../vespa/vespalib/util/threadstackexecutorbase.h | 36 ++++++++++------------ 7 files changed, 60 insertions(+), 40 deletions(-) diff --git a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp index bc17a698536..440e720a0b6 100644 --- a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp +++ b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp @@ -45,11 +45,11 @@ using storage::spi::Timestamp; using vespalib::GenerationHandler; using vespalib::GenerationHolder; using searchcorespi::IFlushTarget; +using namespace std::literals; namespace proton { -namespace -{ +namespace { static constexpr uint32_t numBucketBits = UINT32_C(20); static constexpr uint64_t timestampBias = UINT64_C(2000000000000); @@ -666,7 +666,7 @@ TEST("requireThatStatsAreUpdated") EXPECT_GREATER(lastAllocated, perGidUsed); EXPECT_GREATER(lastUsed, perGidUsed); - FastOS_Thread::Sleep(2200); + std::this_thread::sleep_for(2200ms); addGid(dms, gid1, bucketId1, time1); EXPECT_EQUAL(2u, dms.getStatus().getNumDocs()); EXPECT_EQUAL(2u, dms.getStatus().getNumValues()); diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h index f703223bcbb..7f4698610c8 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h @@ -7,6 +7,7 @@ #include #include #include +#include #include namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/server/executor_thread_service.cpp b/searchcore/src/vespa/searchcore/proton/server/executor_thread_service.cpp index 4927f831fc4..af8e16f657b 100644 --- a/searchcore/src/vespa/searchcore/proton/server/executor_thread_service.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/executor_thread_service.cpp @@ -2,8 +2,7 @@ #include "executor_thread_service.h" #include -#include -#include +#include using vespalib::makeClosure; using vespalib::makeTask; @@ -14,6 +13,13 @@ using vespalib::ThreadStackExecutorBase; namespace proton { +namespace internal { + +struct ThreadId { + FastOS_ThreadId _id; +}; +} + namespace { void @@ -22,11 +28,11 @@ sampleThreadId(FastOS_ThreadId *threadId) *threadId = FastOS_Thread::GetCurrentThreadId(); } -FastOS_ThreadId +std::unique_ptr getThreadId(ThreadStackExecutorBase &executor) { - FastOS_ThreadId id; - executor.execute(makeTask(makeClosure(&sampleThreadId, &id))); + std::unique_ptr id = std::make_unique(); + executor.execute(makeTask(makeClosure(&sampleThreadId, &id->_id))); executor.sync(); return id; } @@ -46,6 +52,8 @@ ExecutorThreadService::ExecutorThreadService(ThreadStackExecutorBase &executor) { } +ExecutorThreadService::~ExecutorThreadService() {} + void ExecutorThreadService::run(Runnable &runnable) { @@ -62,7 +70,7 @@ bool ExecutorThreadService::isCurrentThread() const { FastOS_ThreadId currentThreadId = FastOS_Thread::GetCurrentThreadId(); - return FastOS_Thread::CompareThreadIds(_threadId, currentThreadId); + return FastOS_Thread::CompareThreadIds(_threadId->_id, currentThreadId); } } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/executor_thread_service.h b/searchcore/src/vespa/searchcore/proton/server/executor_thread_service.h index ea4c51f8858..47e41fcd1db 100644 --- a/searchcore/src/vespa/searchcore/proton/server/executor_thread_service.h +++ b/searchcore/src/vespa/searchcore/proton/server/executor_thread_service.h @@ -6,6 +6,7 @@ namespace proton { +namespace internal { class ThreadId; } /** * Implementation of IThreadService using an underlying thread stack executor * with a single thread. @@ -14,10 +15,11 @@ class ExecutorThreadService : public searchcorespi::index::IThreadService { private: vespalib::ThreadStackExecutorBase &_executor; - FastOS_ThreadId _threadId; + std::unique_ptr _threadId; public: ExecutorThreadService(vespalib::ThreadStackExecutorBase &executor); + ~ExecutorThreadService(); /** * Implements IThreadService diff --git a/vespalib/src/tests/executor/stress_test.cpp b/vespalib/src/tests/executor/stress_test.cpp index aa5d9d53955..5c7620afb14 100644 --- a/vespalib/src/tests/executor/stress_test.cpp +++ b/vespalib/src/tests/executor/stress_test.cpp @@ -2,12 +2,11 @@ #include #include -#include #include #include -#include using namespace vespalib; +using namespace std::literals; uint32_t doStuff(uint32_t input) { char buf[128]; @@ -131,7 +130,7 @@ Test::Main() Executor::Task::UP t(new CPUTask(taskSize, result)); t = executor.execute(std::move(t)); while (t.get() != 0) { - FastOS_Thread::Sleep(10); + std::this_thread::sleep_for(10ms); t = executor.execute(std::move(t)); } } diff --git a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp index e9f101f242e..76557762479 100644 --- a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp +++ b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp @@ -1,15 +1,29 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "threadstackexecutorbase.h" +#include namespace vespalib { +namespace thread { + +struct ThreadInit : public FastOS_Runnable { + Runnable &worker; + ThreadStackExecutorBase::init_fun_t init_fun; + + explicit ThreadInit(Runnable &worker_in, ThreadStackExecutorBase::init_fun_t init_fun_in) + : worker(worker_in), init_fun(std::move(init_fun_in)) {} + + void Run(FastOS_ThreadInterface *, void *) override; +}; + void -ThreadStackExecutorBase::ThreadInit::Run(FastOS_ThreadInterface *, void *) -{ +ThreadInit::Run(FastOS_ThreadInterface *, void *) { init_fun(worker); } +} + void ThreadStackExecutorBase::BlockedThread::wait() const { @@ -115,7 +129,7 @@ ThreadStackExecutorBase::run() ThreadStackExecutorBase::ThreadStackExecutorBase(uint32_t stackSize, uint32_t taskLimit, init_fun_t init_fun) - : _pool(stackSize), + : _pool(std::make_unique(stackSize)), _monitor(), _stats(), _executorCompletion(), @@ -125,7 +139,7 @@ ThreadStackExecutorBase::ThreadStackExecutorBase(uint32_t stackSize, _taskCount(0), _taskLimit(taskLimit), _closed(false), - _thread_init(std::make_unique(*this, std::move(init_fun))) + _thread_init(std::make_unique(*this, std::move(init_fun))) { assert(taskLimit > 0); } @@ -135,7 +149,7 @@ ThreadStackExecutorBase::start(uint32_t threads) { assert(threads > 0); for (uint32_t i = 0; i < threads; ++i) { - FastOS_ThreadInterface *thread = _pool.NewThread(_thread_init.get()); + FastOS_ThreadInterface *thread = _pool->NewThread(_thread_init.get()); assert(thread != 0); (void)thread; } @@ -236,12 +250,12 @@ ThreadStackExecutorBase::cleanup() { shutdown().sync(); _executorCompletion.countDown(); - _pool.Close(); + _pool->Close(); } ThreadStackExecutorBase::~ThreadStackExecutorBase() { - assert(_pool.isClosed()); + assert(_pool->isClosed()); assert(_taskCount == 0); assert(_blocked.empty()); } diff --git a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h index a91114b055e..4ea27a2bcde 100644 --- a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h +++ b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h @@ -11,10 +11,13 @@ #include #include #include -#include + +class FastOS_ThreadPool; namespace vespalib { +namespace thread { class ThreadInit; } + // Convenience macro used to create a function that can be used as an // init function when creating an executor to inject a frame with the // given name into the stack of all worker threads. @@ -46,13 +49,6 @@ public: using init_fun_t = std::function; private: - struct ThreadInit : public FastOS_Runnable { - Runnable &worker; - init_fun_t init_fun; - explicit ThreadInit(Runnable &worker_in, init_fun_t init_fun_in) - : worker(worker_in), init_fun(std::move(init_fun_in)) {} - void Run(FastOS_ThreadInterface *, void *) override; - }; struct TaggedTask { Task::UP task; @@ -102,18 +98,18 @@ private: void unblock(); }; - FastOS_ThreadPool _pool; - Monitor _monitor; - Stats _stats; - Gate _executorCompletion; - ArrayQueue _tasks; - ArrayQueue _workers; - std::vector _blocked; - EventBarrier _barrier; - uint32_t _taskCount; - uint32_t _taskLimit; - bool _closed; - std::unique_ptr _thread_init; + std::unique_ptr _pool; + Monitor _monitor; + Stats _stats; + Gate _executorCompletion; + ArrayQueue _tasks; + ArrayQueue _workers; + std::vector _blocked; + EventBarrier _barrier; + uint32_t _taskCount; + uint32_t _taskLimit; + bool _closed; + std::unique_ptr _thread_init; void block_thread(const LockGuard &, BlockedThread &blocked_thread); void unblock_threads(const MonitorGuard &); -- cgit v1.2.3 From b6ccc1da256bb75c2ef6f2de1585bf767c030470 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 18 Aug 2017 14:05:43 +0200 Subject: Remove unused. --- .../src/tests/proton/documentmetastore/documentmetastore_test.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp index 440e720a0b6..c9761ee7e6e 100644 --- a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp +++ b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp @@ -6,8 +6,6 @@ #include #include #include -#include -#include #include #include #include -- cgit v1.2.3 From 5f36b7efbf8a6a22c3371b34451e0975aea57b30 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 18 Aug 2017 14:34:52 +0200 Subject: NULL -> nullptr --- fastos/src/tests/backtracetest.cpp | 2 +- fastos/src/tests/coretest.cpp | 8 +- fastos/src/tests/coretest2.cpp | 8 +- fastos/src/tests/filetest.cpp | 4 +- fastos/src/tests/job.h | 18 ++-- fastos/src/tests/performancetest.cpp | 4 +- fastos/src/tests/prefetchtest.cpp | 4 +- fastos/src/tests/processtest.cpp | 28 +++--- fastos/src/tests/sockettest.cpp | 40 ++++---- fastos/src/tests/thread_bounce_test.cpp | 2 +- fastos/src/tests/thread_joinwait_test.cpp | 6 +- fastos/src/tests/thread_mutex_test.cpp | 14 +-- fastos/src/tests/thread_sleep_test.cpp | 6 +- fastos/src/tests/thread_stats_test.cpp | 2 +- fastos/src/tests/thread_test_base.hpp | 8 +- fastos/src/tests/threadtest.cpp | 42 ++++----- fastos/src/tests/timetest.cpp | 2 +- fastos/src/tests/typetest.cpp | 2 +- fastos/src/tests/usecputest.cpp | 2 +- fastos/src/vespa/fastos/app.cpp | 30 +++--- fastos/src/vespa/fastos/dynamiclibrary.h | 4 +- fastos/src/vespa/fastos/file.cpp | 22 ++--- fastos/src/vespa/fastos/file.h | 24 ++--- fastos/src/vespa/fastos/linux_file.cpp | 8 +- fastos/src/vespa/fastos/linux_file.h | 2 +- fastos/src/vespa/fastos/process.cpp | 6 +- fastos/src/vespa/fastos/process.h | 14 +-- fastos/src/vespa/fastos/serversocket.h | 16 ++-- fastos/src/vespa/fastos/socket.cpp | 28 +++--- fastos/src/vespa/fastos/socket.h | 4 +- fastos/src/vespa/fastos/socketevent.cpp | 32 +++---- fastos/src/vespa/fastos/socketevent.h | 6 +- fastos/src/vespa/fastos/thread.cpp | 44 ++++----- fastos/src/vespa/fastos/thread.h | 16 ++-- fastos/src/vespa/fastos/timestamp.cpp | 2 +- fastos/src/vespa/fastos/unix_app.cpp | 24 ++--- fastos/src/vespa/fastos/unix_cond.cpp | 4 +- fastos/src/vespa/fastos/unix_dynamiclibrary.cpp | 14 +-- fastos/src/vespa/fastos/unix_dynamiclibrary.h | 6 +- fastos/src/vespa/fastos/unix_file.h | 12 +-- fastos/src/vespa/fastos/unix_ipc.cpp | 38 ++++---- fastos/src/vespa/fastos/unix_mutex.cpp | 2 +- fastos/src/vespa/fastos/unix_process.cpp | 120 ++++++++++++------------ fastos/src/vespa/fastos/unix_process.h | 18 ++-- fastos/src/vespa/fastos/unix_socket.cpp | 4 +- fastos/src/vespa/fastos/unix_thread.cpp | 8 +- fastos/src/vespa/fastos/unix_time.cpp | 2 +- 47 files changed, 356 insertions(+), 356 deletions(-) diff --git a/fastos/src/tests/backtracetest.cpp b/fastos/src/tests/backtracetest.cpp index df0887c6b63..6c68765c1ee 100644 --- a/fastos/src/tests/backtracetest.cpp +++ b/fastos/src/tests/backtracetest.cpp @@ -116,7 +116,7 @@ int main (int argc, char **argv) { BackTraceTest app; - setvbuf(stdout, NULL, _IOLBF, 8192); + setvbuf(stdout, nullptr, _IOLBF, 8192); return app.Entry(argc, argv); } diff --git a/fastos/src/tests/coretest.cpp b/fastos/src/tests/coretest.cpp index 2337c392730..a53eaf9d2a4 100644 --- a/fastos/src/tests/coretest.cpp +++ b/fastos/src/tests/coretest.cpp @@ -8,7 +8,7 @@ bomb(void) { char *p; - p = NULL; + p = nullptr; *p = 4; } @@ -29,8 +29,8 @@ bombMain(void) FastS_Bomber bomber; FastOS_ThreadInterface *thread; - thread = pool->NewThread(&bomber, NULL); - if (thread != NULL) + thread = pool->NewThread(&bomber, nullptr); + if (thread != nullptr) thread->Join(); pool->Close(); @@ -60,7 +60,7 @@ int main(int argc, char **argv) { FastS_CoreTestApp app; - setvbuf(stdout, NULL, _IOLBF, 8192); + setvbuf(stdout, nullptr, _IOLBF, 8192); if (argc == 1) return app.Entry(argc, argv); else diff --git a/fastos/src/tests/coretest2.cpp b/fastos/src/tests/coretest2.cpp index a8c416f2de4..e11d334e65e 100644 --- a/fastos/src/tests/coretest2.cpp +++ b/fastos/src/tests/coretest2.cpp @@ -8,7 +8,7 @@ bomb(void) { char *p; - p = NULL; + p = nullptr; *p = 4; } @@ -16,7 +16,7 @@ void *BomberRun(void *arg) { (void) arg; bomb(); - return NULL; + return nullptr; }; static int @@ -25,8 +25,8 @@ bombMain(void) pthread_t thread; void *ret; - (void) pthread_create(&thread, NULL, BomberRun, NULL); - ret = NULL; + (void) pthread_create(&thread, nullptr, BomberRun, nullptr); + ret = nullptr; (void) pthread_join(thread, &ret); return (0); } diff --git a/fastos/src/tests/filetest.cpp b/fastos/src/tests/filetest.cpp index ad411364c0c..e063ccbc89d 100644 --- a/fastos/src/tests/filetest.cpp +++ b/fastos/src/tests/filetest.cpp @@ -278,7 +278,7 @@ public: Progress(rc, "Opening file 'generated/memorymaptest' read-only"); if (rc) { bool mmapEnabled; - char *mmapBuffer = NULL; + char *mmapBuffer = nullptr; mmapEnabled = file.IsMemoryMapped(); mmapBuffer = static_cast(file.MemoryMapPtr(0)); @@ -832,6 +832,6 @@ int main (int argc, char **argv) { FileTest app; - setvbuf(stdout, NULL, _IOLBF, 8192); + setvbuf(stdout, nullptr, _IOLBF, 8192); return app.Entry(argc, argv); } diff --git a/fastos/src/tests/job.h b/fastos/src/tests/job.h index 5199169409d..a5b84fa0f9c 100644 --- a/fastos/src/tests/job.h +++ b/fastos/src/tests/job.h @@ -42,17 +42,17 @@ public: Job() : code(NOP), - message(NULL), - mutex(NULL), - condition(NULL), - boolcondition(NULL), - otherThread(NULL), - ownThread(NULL), - timebuf(NULL), + message(nullptr), + mutex(nullptr), + condition(nullptr), + boolcondition(nullptr), + otherThread(nullptr), + ownThread(nullptr), + timebuf(nullptr), average(0.0), result(-1), _threadId(), - otherjob(NULL), + otherjob(nullptr), bouncewakeupcnt(0), bouncewakeup(false) { @@ -60,7 +60,7 @@ public: ~Job() { - if(message != NULL) + if(message != nullptr) free(message); } }; diff --git a/fastos/src/tests/performancetest.cpp b/fastos/src/tests/performancetest.cpp index 1465ee3d223..55174fcc4e3 100644 --- a/fastos/src/tests/performancetest.cpp +++ b/fastos/src/tests/performancetest.cpp @@ -12,14 +12,14 @@ int main (int argc, char **argv) void (*test)(char *buffer) = PerformanceTest; - test(NULL); + test(nullptr); return 0; } void PerformanceTest (char *buffer) { // Cause exception - *static_cast(NULL) = 'e'; + *static_cast(nullptr) = 'e'; #if 1 FastOS_File file("test.txt"); diff --git a/fastos/src/tests/prefetchtest.cpp b/fastos/src/tests/prefetchtest.cpp index 26ab67251b3..38d3eed837c 100644 --- a/fastos/src/tests/prefetchtest.cpp +++ b/fastos/src/tests/prefetchtest.cpp @@ -35,7 +35,7 @@ public: size = 32; size *= 1024*1024/sizeof(*a); - if ((a = static_cast(calloc(size, sizeof(*a)))) != NULL) + if ((a = static_cast(calloc(size, sizeof(*a)))) != nullptr) { // Standard loop start.SetNow(); @@ -155,6 +155,6 @@ public: int main (int argc, char **argv) { PrefetchTestApp app; - setvbuf(stdout, NULL, _IOLBF, 8192); + setvbuf(stdout, nullptr, _IOLBF, 8192); return app.Entry(argc, argv); } diff --git a/fastos/src/tests/processtest.cpp b/fastos/src/tests/processtest.cpp index 5036676a504..11e1307027d 100644 --- a/fastos/src/tests/processtest.cpp +++ b/fastos/src/tests/processtest.cpp @@ -47,7 +47,7 @@ public: void OnReceiveData (const void *data, size_t length) override { _receivedBytes += length; - if(data != NULL) + if(data != nullptr) { #if 0 printf("[%s] received %u bytes of data:\n%s\n", @@ -62,7 +62,7 @@ public: int MyListener::_allocCount = 0; int MyListener::_successCount = 0; int MyListener::_failCount = 0; -FastOS_Mutex *MyListener::_counterLock = NULL; +FastOS_Mutex *MyListener::_counterLock = nullptr; class ThreadRunJob : public FastOS_Runnable @@ -128,7 +128,7 @@ public: ProcessTest () : _gotMessage(false), _receivedMessages(0), - _counterLock(NULL), + _counterLock(nullptr), _isChild(true) { } @@ -154,7 +154,7 @@ public: _gotMessage = true; // We only have the counter lock if we are the parent process. - if(_counterLock != NULL) + if(_counterLock != nullptr) { _counterLock->Lock(); _receivedMessages++; @@ -197,7 +197,7 @@ public: if(i == 5) { // Make sort quit - xproc->WriteStdin(NULL, 0); + xproc->WriteStdin(nullptr, 0); } FastOS_Thread::Sleep(1000); @@ -257,7 +257,7 @@ public: if(!waitKill && stdinPre) { xproc->WriteStdin(str, strlen(str)); - xproc->WriteStdin(NULL, 0); + xproc->WriteStdin(nullptr, 0); } if(doKill) @@ -269,7 +269,7 @@ public: if(!waitKill && !stdinPre) { xproc->WriteStdin(str, strlen(str)); - xproc->WriteStdin(NULL, 0); + xproc->WriteStdin(nullptr, 0); } } else @@ -277,7 +277,7 @@ public: Progress(false, "Process.CreateWithShell failure %d", GetLastError()); delete xproc; - xproc = NULL; + xproc = nullptr; } procs[j] = xproc; } @@ -285,7 +285,7 @@ public: for(j=0; j 0, "Number of files processed = %d\n", numProc); @@ -469,6 +469,6 @@ public: int main (int argc, char **argv) { ProcessTest app; - setvbuf(stdout, NULL, _IOLBF, 8192); + setvbuf(stdout, nullptr, _IOLBF, 8192); return app.Entry(argc, argv); } diff --git a/fastos/src/tests/sockettest.cpp b/fastos/src/tests/sockettest.cpp index 3a9c9dab565..29dcb1b089e 100644 --- a/fastos/src/tests/sockettest.cpp +++ b/fastos/src/tests/sockettest.cpp @@ -150,7 +150,7 @@ public: BaseTest *_app; MazeServer(BaseTest *app) - : _serverSocket(NULL), + : _serverSocket(nullptr), _app(app) { } @@ -185,7 +185,7 @@ public: { int serverPort = 18334; _serverSocket = new FastOS_ServerSocket(serverPort); - _app->Progress(_serverSocket != NULL, + _app->Progress(_serverSocket != nullptr, "Creating ServerSocket instance"); _app->Progress(_serverSocket->SetSoBlocking(false), @@ -224,12 +224,12 @@ public: { FastOS_Socket *connSocket = _serverSocket->AcceptPlain(); - _app->Progress(connSocket != NULL, "Accepting socket (%p)", + _app->Progress(connSocket != nullptr, "Accepting socket (%p)", connSocket); for(i=0; iSetSocketEvent(&socketEvent); connSocket->EnableReadEvent(true); @@ -256,7 +256,7 @@ public: for(i=0; i_socket)) { @@ -273,7 +273,7 @@ public: if(conn->_shouldFree) { delete(conn); - connections[i] = NULL; + connections[i] = nullptr; } } } @@ -438,7 +438,7 @@ public: #if 0 void PrintOut() { - if(_server != NULL) + if(_server != nullptr) { for(int y=0; yGetValidAddressFlag(); Progress(rc, "Address Valid Flag check"); @@ -684,7 +684,7 @@ public: TestHeader("HTTP Client Test"); FastOS_Socket *sock = new FastOS_Socket(); - Progress(sock != NULL, "Allocating socket instance"); + Progress(sock != nullptr, "Allocating socket instance"); char hostAddress[] = "www.vg.no"; @@ -714,7 +714,7 @@ public: int readLength = strlen(expectedResult); char *readBuffer = new char[readLength+1]; - if(readBuffer != NULL) + if(readBuffer != nullptr) { memset(readBuffer, 0, readLength+1); @@ -756,7 +756,7 @@ public: TestHeader("Client/Server Test"); FastOS_ServerSocket *serverSocket = new FastOS_ServerSocket(18333); - Progress(serverSocket != NULL, "Allocating serversocket instance"); + Progress(serverSocket != nullptr, "Allocating serversocket instance"); Progress(rc = serverSocket->Listen(), "Bind socket to port %d. Listen for incoming connections.", 18333); assert(rc); @@ -775,7 +775,7 @@ public: bool rc; FastOS_Socket *sock = new FastOS_Socket(); - Progress(rc = (sock != NULL), "Allocating socket instance"); + Progress(rc = (sock != nullptr), "Allocating socket instance"); if(rc) { sock->SetAddress(8001, serverAddress); @@ -786,7 +786,7 @@ public: { MazeClient *client = new MazeClient(this, sock); - Progress(rc = (client != NULL), "Allocating MazeClient instance"); + Progress(rc = (client != nullptr), "Allocating MazeClient instance"); if(rc) { client->Run(); @@ -818,7 +818,7 @@ public: #if DO_MAZE_SERVER DoMazeServer(); #else - char *mazeServerAddress = NULL; + char *mazeServerAddress = nullptr; if(_argc == 3) { @@ -832,7 +832,7 @@ public: ClientServerTest(); StrictBindTest(); - if(mazeServerAddress != NULL) + if(mazeServerAddress != nullptr) MazeTest(mazeServerAddress); #endif @@ -850,6 +850,6 @@ int main (int argc, char **argv) { SocketTest app; - setvbuf(stdout, NULL, _IOLBF, 8192); + setvbuf(stdout, nullptr, _IOLBF, 8192); return app.Entry(argc, argv); } diff --git a/fastos/src/tests/thread_bounce_test.cpp b/fastos/src/tests/thread_bounce_test.cpp index 729c16fab5f..bf94f3e1aab 100644 --- a/fastos/src/tests/thread_bounce_test.cpp +++ b/fastos/src/tests/thread_bounce_test.cpp @@ -89,6 +89,6 @@ int Thread_Bounce_Test::Main () int main (int argc, char **argv) { Thread_Bounce_Test app; - setvbuf(stdout, NULL, _IOLBF, 8192); + setvbuf(stdout, nullptr, _IOLBF, 8192); return app.Entry(argc, argv); } diff --git a/fastos/src/tests/thread_joinwait_test.cpp b/fastos/src/tests/thread_joinwait_test.cpp index 98e0a1ac467..05ab1627334 100644 --- a/fastos/src/tests/thread_joinwait_test.cpp +++ b/fastos/src/tests/thread_joinwait_test.cpp @@ -38,7 +38,7 @@ class Thread_JoinWait_Test : public ThreadTestBase jobs[i].ownThread = pool.NewThread(this, static_cast(&jobs[i])); - rc = (jobs[i].ownThread != NULL); + rc = (jobs[i].ownThread != nullptr); Progress(rc, "Creating Thread %d", i+1); if(!rc) @@ -56,7 +56,7 @@ class Thread_JoinWait_Test : public ThreadTestBase static_cast (&jobs[lastThreadNum])); - rc = (lastThread != NULL); + rc = (lastThread != nullptr); Progress(rc, "Creating last thread"); if(rc) @@ -115,6 +115,6 @@ int Thread_JoinWait_Test::Main () int main (int argc, char **argv) { Thread_JoinWait_Test app; - setvbuf(stdout, NULL, _IOLBF, 8192); + setvbuf(stdout, nullptr, _IOLBF, 8192); return app.Entry(argc, argv); } diff --git a/fastos/src/tests/thread_mutex_test.cpp b/fastos/src/tests/thread_mutex_test.cpp index 602d89c0b05..b8ac575038b 100644 --- a/fastos/src/tests/thread_mutex_test.cpp +++ b/fastos/src/tests/thread_mutex_test.cpp @@ -21,11 +21,11 @@ class Thread_Mutex_Test : public ThreadTestBase FastOS_ThreadPool *pool = new FastOS_ThreadPool(128*1024, MAX_THREADS); - if(Progress(pool != NULL, "Allocating ThreadPool")) + if(Progress(pool != nullptr, "Allocating ThreadPool")) { int i; Job jobs[MUTEX_TEST_THREADS]; - FastOS_Mutex *myMutex=NULL; + FastOS_Mutex *myMutex=nullptr; if(usingMutex) myMutex = new FastOS_Mutex(); @@ -40,7 +40,7 @@ class Thread_Mutex_Test : public ThreadTestBase for(i=0; iNewThread(this, + bool rc = (nullptr != pool->NewThread(this, static_cast(&jobs[i]))); Progress(rc, "Creating Thread with%s mutex", (usingMutex ? "" : "out")); }; @@ -99,7 +99,7 @@ class Thread_Mutex_Test : public ThreadTestBase } } - if(myMutex != NULL) + if(myMutex != nullptr) delete(myMutex); Progress(true, "Closing threadpool..."); @@ -125,9 +125,9 @@ class Thread_Mutex_Test : public ThreadTestBase job.ownThread = pool.NewThread(this, static_cast(&job)); - Progress(job.ownThread !=NULL, "Creating thread"); + Progress(job.ownThread !=nullptr, "Creating thread"); - if(job.ownThread != NULL) + if(job.ownThread != nullptr) { bool lockrc; @@ -188,6 +188,6 @@ int Thread_Mutex_Test::Main () int main (int argc, char **argv) { Thread_Mutex_Test app; - setvbuf(stdout, NULL, _IOLBF, 8192); + setvbuf(stdout, nullptr, _IOLBF, 8192); return app.Entry(argc, argv); } diff --git a/fastos/src/tests/thread_sleep_test.cpp b/fastos/src/tests/thread_sleep_test.cpp index 914438cdd83..7fd3412b7c3 100644 --- a/fastos/src/tests/thread_sleep_test.cpp +++ b/fastos/src/tests/thread_sleep_test.cpp @@ -14,9 +14,9 @@ class Thread_Sleep_Test : public ThreadTestBase FastOS_ThreadPool *pool = new FastOS_ThreadPool(128*1024); - if(Progress(pool != NULL, "Allocating ThreadPool")) + if(Progress(pool != nullptr, "Allocating ThreadPool")) { - bool rc = (NULL != pool->NewThread(this, NULL)); + bool rc = (nullptr != pool->NewThread(this, nullptr)); Progress(rc, "Creating Thread"); Progress(true, "Sleeping 3 seconds"); @@ -47,6 +47,6 @@ int Thread_Sleep_Test::Main () int main (int argc, char **argv) { Thread_Sleep_Test app; - setvbuf(stdout, NULL, _IOLBF, 8192); + setvbuf(stdout, nullptr, _IOLBF, 8192); return app.Entry(argc, argv); } diff --git a/fastos/src/tests/thread_stats_test.cpp b/fastos/src/tests/thread_stats_test.cpp index 3ac4b0a52d6..3633c12bcaa 100644 --- a/fastos/src/tests/thread_stats_test.cpp +++ b/fastos/src/tests/thread_stats_test.cpp @@ -131,6 +131,6 @@ int Thread_Stats_Test::Main () int main (int argc, char **argv) { Thread_Stats_Test app; - setvbuf(stdout, NULL, _IOLBF, 8192); + setvbuf(stdout, nullptr, _IOLBF, 8192); return app.Entry(argc, argv); } diff --git a/fastos/src/tests/thread_test_base.hpp b/fastos/src/tests/thread_test_base.hpp index 3cd16065726..5305b132d3c 100644 --- a/fastos/src/tests/thread_test_base.hpp +++ b/fastos/src/tests/thread_test_base.hpp @@ -57,7 +57,7 @@ public: void ThreadTestBase::Run (FastOS_ThreadInterface *thread, void *arg) { - if(arg == NULL) + if(arg == nullptr) return; Job *job = static_cast(arg); @@ -93,7 +93,7 @@ void ThreadTestBase::Run (FastOS_ThreadInterface *thread, void *arg) { int result; - if(job->mutex != NULL) + if(job->mutex != nullptr) job->mutex->Lock(); result = static_cast(number); @@ -107,7 +107,7 @@ void ThreadTestBase::Run (FastOS_ThreadInterface *thread, void *arg) FastOS_Thread::Sleep(1000); } - if(job->mutex != NULL) + if(job->mutex != nullptr) job->mutex->Unlock(); job->result = result; // This marks the end of the thread @@ -135,7 +135,7 @@ void ThreadTestBase::Run (FastOS_ThreadInterface *thread, void *arg) if(job->mutex) job->mutex->Lock(); - if(job->otherThread != NULL) + if(job->otherThread != nullptr) job->otherThread->Join(); if(job->mutex) diff --git a/fastos/src/tests/threadtest.cpp b/fastos/src/tests/threadtest.cpp index 57e60d9413b..81ea234fb97 100644 --- a/fastos/src/tests/threadtest.cpp +++ b/fastos/src/tests/threadtest.cpp @@ -54,7 +54,7 @@ class ThreadTest : public ThreadTestBase FastOS_ThreadPool *pool = new FastOS_ThreadPool(128*1024, MAX_THREADS); - if(Progress(pool != NULL, "Allocating ThreadPool")) + if(Progress(pool != nullptr, "Allocating ThreadPool")) { int i; Job jobs[MAX_THREADS]; @@ -70,13 +70,13 @@ class ThreadTest : public ThreadTestBase { if(i==MAX_THREADS) { - bool rc = (NULL == pool->NewThread(this, + bool rc = (nullptr == pool->NewThread(this, static_cast(&jobs[0]))); Progress(rc, "Creating too many threads should fail."); } else { - bool rc = (NULL != pool->NewThread(this, + bool rc = (nullptr != pool->NewThread(this, static_cast(&jobs[i]))); Progress(rc, "Creating Thread"); } @@ -110,7 +110,7 @@ class ThreadTest : public ThreadTestBase FastOS_ThreadPool *pool = new FastOS_ThreadPool(128*1024, HOW_MAX_THREADS); - if(Progress(pool != NULL, "Allocating ThreadPool")) + if(Progress(pool != nullptr, "Allocating ThreadPool")) { int i; Job jobs[HOW_MAX_THREADS]; @@ -126,13 +126,13 @@ class ThreadTest : public ThreadTestBase { if(i==HOW_MAX_THREADS) { - bool rc = (NULL == pool->NewThread(this, + bool rc = (nullptr == pool->NewThread(this, static_cast(&jobs[0]))); Progress(rc, "Creating too many threads should fail."); } else { - bool rc = (NULL != pool->NewThread(this, + bool rc = (nullptr != pool->NewThread(this, static_cast(&jobs[i]))); Progress(rc, "Creating Thread"); } @@ -164,14 +164,14 @@ class ThreadTest : public ThreadTestBase FastOS_ThreadPool *pool = new FastOS_ThreadPool(128*1024); - if(Progress(pool != NULL, "Allocating ThreadPool")) + if(Progress(pool != nullptr, "Allocating ThreadPool")) { Job job; job.code = NOP; job.result = -1; - bool rc = (NULL != pool->NewThread(this, &job)); + bool rc = (nullptr != pool->NewThread(this, &job)); Progress(rc, "Creating Thread"); WaitForThreadsToFinish(&job, 1); @@ -201,8 +201,8 @@ class ThreadTest : public ThreadTestBase FastOS_ThreadPool *pool = new FastOS_ThreadPool(128 * 1024); if (!silent) - Progress(pool != NULL, "Allocating ThreadPool"); - if (pool != NULL) { + Progress(pool != nullptr, "Allocating ThreadPool"); + if (pool != nullptr) { Job *jobs = new Job[count]; threadsok = 0; @@ -210,23 +210,23 @@ class ThreadTest : public ThreadTestBase for (i = 0; i < count; i++) { jobs[i].code = SILENTNOP; jobs[i].ownThread = pool->NewThread(this, &jobs[i]); - rc = (jobs[i].ownThread != NULL); + rc = (jobs[i].ownThread != nullptr); if (rc) threadsok++; } for (j = 0; j < outercount; j++) { for (i = 0; i < count; i++) { - if (jobs[i].ownThread != NULL) + if (jobs[i].ownThread != nullptr) jobs[i].ownThread->Join(); jobs[i].ownThread = pool->NewThread(this, &jobs[i]); - rc = (jobs[i].ownThread != NULL); + rc = (jobs[i].ownThread != nullptr); if (rc) threadsok++; } } for (i = 0; i < count; i++) { - if (jobs[i].ownThread != NULL) + if (jobs[i].ownThread != nullptr) jobs[i].ownThread->Join(); } endtime.SetNow(); @@ -286,7 +286,7 @@ class ThreadTest : public ThreadTestBase { jobs[i].code = INCREASE_NUMBER; - bool rc = (NULL != pool.NewThread(this, + bool rc = (nullptr != pool.NewThread(this, static_cast(&jobs[i]))); Progress(rc, "Creating Thread %d", i+1); } @@ -311,7 +311,7 @@ class ThreadTest : public ThreadTestBase { jobs[i].code = WAIT_FOR_BREAK_FLAG; - bool rc = (NULL != pool.NewThread(this, + bool rc = (nullptr != pool.NewThread(this, static_cast(&jobs[i]))); Progress(rc, "Creating Thread %d", i+1); } @@ -333,7 +333,7 @@ class ThreadTest : public ThreadTestBase jobs[i].ownThread = pool->NewThread(this, static_cast(&jobs[i])); - bool rc=(jobs[i].ownThread != NULL); + bool rc=(jobs[i].ownThread != nullptr); Progress(rc, "CreatingThread %d", i+1); } @@ -412,7 +412,7 @@ class ThreadTest : public ThreadTestBase jobs[i].mutex = &slowStartMutex; jobs[i].ownThread = pool.NewThread(this, static_cast(&jobs[i])); - bool rc=(jobs[i].ownThread != NULL); + bool rc=(jobs[i].ownThread != nullptr); if(rc) jobs[i]._threadId = jobs[i].ownThread->GetThreadId(); Progress(rc, "CreatingThread %d id:%lu", i+1, @@ -457,9 +457,9 @@ class ThreadTest : public ThreadTestBase job.ownThread = pool.NewThread(this, static_cast(&job)); - Progress(job.ownThread !=NULL, "Creating thread"); + Progress(job.ownThread !=nullptr, "Creating thread"); - if(job.ownThread != NULL) + if(job.ownThread != nullptr) { condition.Lock(); bool gotCond = condition.TimedWait(500); @@ -597,6 +597,6 @@ int ThreadTest::Main () int main (int argc, char **argv) { ThreadTest app; - setvbuf(stdout, NULL, _IOLBF, 8192); + setvbuf(stdout, nullptr, _IOLBF, 8192); return app.Entry(argc, argv); } diff --git a/fastos/src/tests/timetest.cpp b/fastos/src/tests/timetest.cpp index fa9ef71ba9c..0618e28bcd0 100644 --- a/fastos/src/tests/timetest.cpp +++ b/fastos/src/tests/timetest.cpp @@ -290,7 +290,7 @@ int main (int argc, char **argv) { TimeTest app; - setvbuf(stdout, NULL, _IOLBF, 8192); + setvbuf(stdout, nullptr, _IOLBF, 8192); return app.Entry(argc, argv); } diff --git a/fastos/src/tests/typetest.cpp b/fastos/src/tests/typetest.cpp index 87e3d76c461..51bda7e5dbc 100644 --- a/fastos/src/tests/typetest.cpp +++ b/fastos/src/tests/typetest.cpp @@ -51,7 +51,7 @@ public: int main (int argc, char **argv) { - setvbuf(stdout, NULL, _IOLBF, 8192); + setvbuf(stdout, nullptr, _IOLBF, 8192); TypeTest app; return app.Entry(argc, argv); } diff --git a/fastos/src/tests/usecputest.cpp b/fastos/src/tests/usecputest.cpp index 930b1fb305f..9812ed7575d 100644 --- a/fastos/src/tests/usecputest.cpp +++ b/fastos/src/tests/usecputest.cpp @@ -63,7 +63,7 @@ void UseSomeCpu (int i, ThreadRunJob *threadRunJob) int main (int argc, char **argv) { UseCpuTest app; - setvbuf(stdout, NULL, _IOLBF, 8192); + setvbuf(stdout, nullptr, _IOLBF, 8192); return app.Entry(argc, argv); } diff --git a/fastos/src/vespa/fastos/app.cpp b/fastos/src/vespa/fastos/app.cpp index 079dab55754..824d009591f 100644 --- a/fastos/src/vespa/fastos/app.cpp +++ b/fastos/src/vespa/fastos/app.cpp @@ -27,16 +27,16 @@ FastOS_ThreadPool *FastOS_ApplicationInterface::GetThreadPool () } FastOS_ApplicationInterface::FastOS_ApplicationInterface() : - _threadPool(NULL), - _processList(NULL), - _processListMutex(NULL), + _threadPool(nullptr), + _processList(nullptr), + _processListMutex(nullptr), _disableLeakReporting(false), _argc(0), - _argv(NULL) + _argv(nullptr) { FastOS_ProcessInterface::_app = this; char * fadvise = getenv("VESPA_FADVISE_OPTIONS"); - if (fadvise != NULL) { + if (fadvise != nullptr) { int fadviseOptions(0); if (strstr(fadvise, "SEQUENTIAL")) { fadviseOptions |= POSIX_FADV_SEQUENTIAL; } if (strstr(fadvise, "RANDOM")) { fadviseOptions |= POSIX_FADV_RANDOM; } @@ -63,7 +63,7 @@ bool FastOS_ApplicationInterface::Init () { const char *errorMsg = FastOS_Socket::InitializeServices(); - if(errorMsg == NULL) + if(errorMsg == nullptr) { _processListMutex = new FastOS_Mutex(); _threadPool = new FastOS_ThreadPool(128 * 1024); @@ -91,19 +91,19 @@ bool FastOS_ApplicationInterface::Init () void FastOS_ApplicationInterface::Cleanup () { - if(_threadPool != NULL) + if(_threadPool != nullptr) { // printf("Closing threadpool...\n"); _threadPool->Close(); // printf("Deleting threadpool...\n"); delete _threadPool; - _threadPool = NULL; + _threadPool = nullptr; } - if(_processListMutex != NULL) + if(_processListMutex != nullptr) { delete _processListMutex; - _processListMutex = NULL; + _processListMutex = nullptr; } FastOS_Socket::CleanupServices(); @@ -139,10 +139,10 @@ OnReceivedIPCMessage (const void *data, size_t length) void FastOS_ApplicationInterface:: AddChildProcess (FastOS_ProcessInterface *node) { - node->_prev = NULL; + node->_prev = nullptr; node->_next = _processList; - if(_processList != NULL) + if(_processList != nullptr) _processList->_prev = node; _processList = node; @@ -159,11 +159,11 @@ RemoveChildProcess (FastOS_ProcessInterface *node) if(node->_next) { node->_next->_prev = node->_prev; - node->_next = NULL; + node->_next = nullptr; } - if(node->_prev != NULL) - node->_prev = NULL; + if(node->_prev != nullptr) + node->_prev = nullptr; } bool diff --git a/fastos/src/vespa/fastos/dynamiclibrary.h b/fastos/src/vespa/fastos/dynamiclibrary.h index b0bf5730405..15cc28fa130 100644 --- a/fastos/src/vespa/fastos/dynamiclibrary.h +++ b/fastos/src/vespa/fastos/dynamiclibrary.h @@ -34,7 +34,7 @@ public: * @param libname the name of the library to open * @return Boolean success/failure */ - virtual bool Open(const char *libname = NULL) = 0; + virtual bool Open(const char *libname = nullptr) = 0; /** * Close (unload) the library. @@ -45,7 +45,7 @@ public: /** * Find the address of a symbol in the library. * @param symbol Name of symbol to find - * @return Address of the symbol, or NULL if an error has occurred + * @return Address of the symbol, or nullptr if an error has occurred */ virtual void * GetSymbol(const char *symbol) const = 0; diff --git a/fastos/src/vespa/fastos/file.cpp b/fastos/src/vespa/fastos/file.cpp index 8f164c2a522..42ca432329d 100644 --- a/fastos/src/vespa/fastos/file.cpp +++ b/fastos/src/vespa/fastos/file.cpp @@ -27,7 +27,7 @@ DirectIOException::DirectIOException(const char * fileName, const void * buffer, DirectIOException::~DirectIOException() {} -FastOS_FileInterface::FailedHandler FastOS_FileInterface::_failedHandler = NULL; +FastOS_FileInterface::FailedHandler FastOS_FileInterface::_failedHandler = nullptr; int FastOS_FileInterface::_defaultFAdviseOptions = POSIX_FADV_NORMAL; static const size_t MAX_WRITE_CHUNK_SIZE = 0x4000000; // 64 MB @@ -35,12 +35,12 @@ static const size_t MAX_WRITE_CHUNK_SIZE = 0x4000000; // 64 MB FastOS_FileInterface::FastOS_FileInterface(const char *filename) : _fAdviseOptions(_defaultFAdviseOptions), _writeChunkSize(MAX_WRITE_CHUNK_SIZE), - _filename(NULL), + _filename(nullptr), _openFlags(0), _directIOEnabled(false), _syncWritesEnabled(false) { - if (filename != NULL) + if (filename != nullptr) SetFileName(filename); } @@ -200,7 +200,7 @@ FastOS_FileInterface::MemoryMapPtr(int64_t position) const { // Only subclases with support for memory mapping do something here. (void) position; - return NULL; + return nullptr; } @@ -218,8 +218,8 @@ FastOS_FileInterface::CopyFile( const char *src, const char *dst ) FastOS_StatInfo statInfo; bool success = false; - if ( src != NULL && - dst != NULL && + if ( src != nullptr && + dst != nullptr && strcmp(src, dst) != 0 && FastOS_File::Stat( src, &statInfo )) { @@ -233,7 +233,7 @@ FastOS_FileInterface::CopyFile( const char *src, const char *dst ) bufSize = static_cast(bufSizeBound); char *tmpBuf = new char[ bufSize ]; - if ( tmpBuf != NULL ) { + if ( tmpBuf != nullptr ) { int64_t copied = 0; success = true; do { @@ -278,7 +278,7 @@ FastOS_FileInterface::MoveFile(const char* src, const char* dst) void FastOS_FileInterface::EmptyDirectory( const char *dir, - const char *keepFile /* = NULL */ ) + const char *keepFile /* = nullptr */ ) { FastOS_StatInfo statInfo; if (!FastOS_File::Stat(dir, &statInfo)) @@ -288,7 +288,7 @@ FastOS_FileInterface::EmptyDirectory( const char *dir, while (dirScan.ReadNext()) { if (strcmp(dirScan.GetName(), ".") != 0 && strcmp(dirScan.GetName(), "..") != 0 && - (keepFile == NULL || strcmp(dirScan.GetName(), keepFile) != 0)) + (keepFile == nullptr || strcmp(dirScan.GetName(), keepFile) != 0)) { std::string name = dir; name += GetPathSeparator(); @@ -347,7 +347,7 @@ FastOS_FileInterface::MakeDirIfNotPresentOrExit(const char *name) void FastOS_FileInterface::SetFileName(const char *filename) { - if (_filename != NULL) { + if (_filename != nullptr) { free(_filename); } @@ -358,7 +358,7 @@ FastOS_FileInterface::SetFileName(const char *filename) const char * FastOS_FileInterface::GetFileName() const { - return (_filename != NULL) ? _filename : ""; + return (_filename != nullptr) ? _filename : ""; } diff --git a/fastos/src/vespa/fastos/file.h b/fastos/src/vespa/fastos/file.h index 00ba61b793f..43e10fcd120 100644 --- a/fastos/src/vespa/fastos/file.h +++ b/fastos/src/vespa/fastos/file.h @@ -181,7 +181,7 @@ public: * @param keepFile a 'const char *' value. If supplied, leave files with * this name alone. */ - static void EmptyDirectory( const char *dir, const char *keepFile = NULL); + static void EmptyDirectory( const char *dir, const char *keepFile = nullptr); /** * Make a directory (special compatibility version) @@ -205,7 +205,7 @@ public: * later using @ref SetFileName() or @ref Open(). * @param filename a filename (optional) */ - FastOS_FileInterface(const char *filename=NULL); + FastOS_FileInterface(const char *filename=nullptr); /** * Destructor. If the current file is open, the destructor will close @@ -243,7 +243,7 @@ public: * @ref Open(). * @return Boolean success/failure */ - virtual bool Open(unsigned int openFlags, const char *filename=NULL) = 0; + virtual bool Open(unsigned int openFlags, const char *filename=nullptr) = 0; /** * Open a file for read/write access. The file will be created if it does @@ -254,7 +254,7 @@ public: * @ref SetFileName() or a previous call to @ref Open(). * @return Boolean success/failure */ - bool OpenReadWrite(const char *filename=NULL); + bool OpenReadWrite(const char *filename=nullptr); /** * Open a file for read/write access. This method fails if the file does @@ -267,7 +267,7 @@ public: * @ref Open(). * @return Boolean success/failure */ - bool OpenExisting(bool abortIfNotExist=false, const char *filename=NULL); + bool OpenExisting(bool abortIfNotExist=false, const char *filename=nullptr); /** * Open a file for read access. This method fails if the file does @@ -280,7 +280,7 @@ public: * @ref Open(). * @return Boolean success/failure */ - bool OpenReadOnlyExisting (bool abortIfNotExist=false, const char *filename=NULL); + bool OpenReadOnlyExisting (bool abortIfNotExist=false, const char *filename=nullptr); /** * Open a file for write access. If the file does not exist, it is created. @@ -292,7 +292,7 @@ public: * @ref Open(). * @return Boolean success/failure */ - bool OpenWriteOnlyTruncate(const char *filename=NULL); + bool OpenWriteOnlyTruncate(const char *filename=nullptr); /** * Open a file for write access. This method fails if the file does @@ -305,7 +305,7 @@ public: * @ref Open(). * @return Boolean success/failure */ - bool OpenWriteOnlyExisting (bool abortIfNotExist=false, const char *filename=NULL); + bool OpenWriteOnlyExisting (bool abortIfNotExist=false, const char *filename=nullptr); /** * Open a file for read-access only. This method fails if the file does @@ -316,7 +316,7 @@ public: * @ref SetFileName() or a previous call to @ref Open(). * @return Boolean success/failure */ - bool OpenReadOnly(const char *filename=NULL); + bool OpenReadOnly(const char *filename=nullptr); /** * Open a file for write-access only. The file will be created if it does @@ -327,7 +327,7 @@ public: * @ref SetFileName() or a previous call to @ref Open(). * @return Boolean success/failure */ - bool OpenWriteOnly(const char *filename=NULL); + bool OpenWriteOnly(const char *filename=nullptr); bool OpenStdin(); @@ -567,7 +567,7 @@ public: * from malloc will be saved. Use free() with * this pointer to deallocate the buffer. * This value is always set. - * @return Alligned pointer value or NULL if out of memory + * @return Alligned pointer value or nullptr if out of memory */ virtual void *AllocateDirectIOBuffer(size_t byteSize, void *&realPtr); @@ -581,7 +581,7 @@ public: /** * Inquiry about where in memory file data is located. * @return location of file data in memory. If the file is not mapped, - * NULL is returned. + * nullptr is returned. */ virtual void *MemoryMapPtr(int64_t position) const; diff --git a/fastos/src/vespa/fastos/linux_file.cpp b/fastos/src/vespa/fastos/linux_file.cpp index 3817e337490..08dc78585ec 100644 --- a/fastos/src/vespa/fastos/linux_file.cpp +++ b/fastos/src/vespa/fastos/linux_file.cpp @@ -32,7 +32,7 @@ ssize_t FastOS_Linux_File::readInternal(int fh, void *buffer, size_t length, int64_t readOffset) { ssize_t readResult = ::pread(fh, buffer, length, readOffset); - if (readResult < 0 && _failedHandler != NULL) { + if (readResult < 0 && _failedHandler != nullptr) { int error = errno; const char *fileName = GetFileName(); _failedHandler("read", fileName, error, readOffset, length, readResult); @@ -46,7 +46,7 @@ ssize_t FastOS_Linux_File::readInternal(int fh, void *buffer, size_t length) { ssize_t readResult = ::read(fh, buffer, length); - if (readResult < 0 && _failedHandler != NULL) { + if (readResult < 0 && _failedHandler != nullptr) { int error = errno; int64_t readOffset = GetPosition(); const char *fileName = GetFileName(); @@ -61,7 +61,7 @@ ssize_t FastOS_Linux_File::writeInternal(int fh, const void *buffer, size_t length, int64_t writeOffset) { ssize_t writeRes = ::pwrite(fh, buffer, length, writeOffset); - if (writeRes < 0 && _failedHandler != NULL) { + if (writeRes < 0 && _failedHandler != nullptr) { int error = errno; const char *fileName = GetFileName(); _failedHandler("write", fileName, error, writeOffset, length, writeRes); @@ -74,7 +74,7 @@ ssize_t FastOS_Linux_File::writeInternal(int fh, const void *buffer, size_t length) { ssize_t writeRes = ::write(fh, buffer, length); - if (writeRes < 0 && _failedHandler != NULL) { + if (writeRes < 0 && _failedHandler != nullptr) { int error = errno; int64_t writeOffset = GetPosition(); const char *fileName = GetFileName(); diff --git a/fastos/src/vespa/fastos/linux_file.h b/fastos/src/vespa/fastos/linux_file.h index 95f2b935958..d33884c872a 100644 --- a/fastos/src/vespa/fastos/linux_file.h +++ b/fastos/src/vespa/fastos/linux_file.h @@ -24,7 +24,7 @@ protected: int64_t _filePointer; // Only maintained/used in directio mode public: - FastOS_Linux_File (const char *filename = NULL); + FastOS_Linux_File (const char *filename = nullptr); ~FastOS_Linux_File () { Close(); } diff --git a/fastos/src/vespa/fastos/process.cpp b/fastos/src/vespa/fastos/process.cpp index a806799e933..cac491de1e1 100644 --- a/fastos/src/vespa/fastos/process.cpp +++ b/fastos/src/vespa/fastos/process.cpp @@ -9,13 +9,13 @@ FastOS_ProcessInterface::FastOS_ProcessInterface (const char *cmdLine, FastOS_ProcessRedirectListener *stderrListener, int bufferSize) : _extradoublehackforalignment(0.0), - _cmdLine(NULL), + _cmdLine(nullptr), _pipeStdin(pipeStdin), _stdoutListener(stdoutListener), _stderrListener(stderrListener), _bufferSize(bufferSize), - _next(NULL), - _prev(NULL) + _next(nullptr), + _prev(nullptr) { _cmdLine = strdup(cmdLine); } diff --git a/fastos/src/vespa/fastos/process.h b/fastos/src/vespa/fastos/process.h index 1810a730d9d..f0c1fcaa2a9 100644 --- a/fastos/src/vespa/fastos/process.h +++ b/fastos/src/vespa/fastos/process.h @@ -26,7 +26,7 @@ public: * You should assume that any thread can invoke this method. * For convenience the data buffer is always zero- terminated * (static_cast(data[length]) = '\\0'). - * When the pipe closes, the method is invoked with data = NULL + * When the pipe closes, the method is invoked with data = nullptr * and length = 0. * @param data Pointer to data * @param length Length of data block in bytes @@ -76,7 +76,7 @@ public: * of PrefopenNoInherit. * @return Internal data needed to cancel object inheritance. */ - static void *PrefopenNoInherit (void) {return NULL;} + static void *PrefopenNoInherit (void) {return nullptr;} /** * Call this after opening files with fopen to avoid having @@ -105,14 +105,14 @@ public: * @ref CreateWithShell to actually start the process. * @param cmdLine Command line * @param pipeStdin set to true in order to redirect stdin - * @param stdoutListener non-NULL to redirect stdout - * @param stderrListener non-NULL to redirect stderr + * @param stdoutListener non-nullptr to redirect stdout + * @param stderrListener non-nullptr to redirect stderr * @param bufferSize Size of redirect buffers */ FastOS_ProcessInterface (const char *cmdLine, bool pipeStdin = false, - FastOS_ProcessRedirectListener *stdoutListener = NULL, - FastOS_ProcessRedirectListener *stderrListener = NULL, + FastOS_ProcessRedirectListener *stdoutListener = nullptr, + FastOS_ProcessRedirectListener *stderrListener = nullptr, int bufferSize = 65535); /** @@ -154,7 +154,7 @@ public: /** * If you are redirecting the standard input stream of the process, * use this method to write data. To close the input stream, - * invoke @ref WriteStdin with data=NULL. If the input stream + * invoke @ref WriteStdin with data=nullptr. If the input stream * is not redirected, @ref WriteStdin will fail. * @param data Pointer to data * @param length Length of data block in bytes diff --git a/fastos/src/vespa/fastos/serversocket.h b/fastos/src/vespa/fastos/serversocket.h index 93f1efe21fc..2e0690ffc3b 100644 --- a/fastos/src/vespa/fastos/serversocket.h +++ b/fastos/src/vespa/fastos/serversocket.h @@ -74,14 +74,14 @@ protected: /** * The socket factory to use for incoming connections. - * If this is NULL, the default action is to create an + * If this is nullptr, the default action is to create an * instance of the regular @ref FastOS_Socket. */ FastOS_SocketFactory *_socketFactory; /** * Create socket for handling an incoming connection - * @return Returns pointer to newly created socket, or NULL on + * @return Returns pointer to newly created socket, or nullptr on * failure. */ FastOS_SocketInterface *CreateHandlerSocket(); @@ -98,8 +98,8 @@ public: * @param strictBindHostName IP address or hostname for strict binding */ FastOS_ServerSocket (int portnum, int backLog=5, - FastOS_SocketFactory *socketFactory=NULL, - const char *strictBindHostName=NULL) + FastOS_SocketFactory *socketFactory=nullptr, + const char *strictBindHostName=nullptr) : _portNumber(portnum), _backLog(backLog), _socketFactory(socketFactory), @@ -126,7 +126,7 @@ public: * start to listen for incoming connections. You should * call @ref Listen() if you have supplied a pre-created listening * socket handle trough the constructor - * @ref FastOS_ServerSocket(int listenSocketHandle, FastOS_SocketFactory *socketFactory=NULL). + * @ref FastOS_ServerSocket(int listenSocketHandle, FastOS_SocketFactory *socketFactory=nullptr). * @return Boolean success/failure */ bool Listen (); @@ -137,7 +137,7 @@ public: * Make sure you have a listening socket (see @ref Listen()) before * calling @ref Accept(). * @return Returns pointer to newly created socket object for the - * connection that was accepted, or NULL on failure. + * connection that was accepted, or nullptr on failure. */ FastOS_SocketInterface *Accept (); @@ -147,7 +147,7 @@ public: * Make sure you have a listening socket (see @ref Listen()) before * calling @ref AcceptPlain(). * @return Returns pointer to newly created socket object for the - * connection that was accepted, or NULL on failure. + * connection that was accepted, or nullptr on failure. */ FastOS_Socket *AcceptPlain (); @@ -157,7 +157,7 @@ public: * factory will be called to create a new socket object for the * connection. * - * SetSocketFactory(NULL) will enable the default socket factory + * SetSocketFactory(nullptr) will enable the default socket factory * mechanism which will create regular @ref FastOS_Socket instances * on accepted connections. */ diff --git a/fastos/src/vespa/fastos/socket.cpp b/fastos/src/vespa/fastos/socket.cpp index 2732a38cf4c..c274f42bc68 100644 --- a/fastos/src/vespa/fastos/socket.cpp +++ b/fastos/src/vespa/fastos/socket.cpp @@ -14,8 +14,8 @@ FastOS_SocketInterface::FastOS_SocketInterface() _readPossible(false), _writePossible(false), _epolled(false), - _socketEvent(NULL), - _eventAttribute(NULL), + _socketEvent(nullptr), + _eventAttribute(nullptr), _socketEventArrayPos(-1), _address(), _socketHandle(-1), @@ -30,8 +30,8 @@ FastOS_SocketInterface::FastOS_SocketInterface(int socketHandle, struct sockaddr _readPossible(false), _writePossible(false), _epolled(false), - _socketEvent(NULL), - _eventAttribute(NULL), + _socketEvent(nullptr), + _eventAttribute(nullptr), _socketEventArrayPos(-1), _address(), _socketHandle(-1), @@ -145,10 +145,10 @@ void FastOS_SocketInterface::ConstructorWork () { _socketHandle = -1; _epolled = false; - _socketEvent = NULL; + _socketEvent = nullptr; _readEventEnabled = false; _writeEventEnabled = false; - _eventAttribute = NULL; + _eventAttribute = nullptr; _socketEventArrayPos = -1; } @@ -234,10 +234,10 @@ bool FastOS_SocketInterface::GetSoIntOpt(int option, int &value) void FastOS_SocketInterface::CleanupEvents () { - if (_socketEvent != NULL) { + if (_socketEvent != nullptr) { _socketEvent->Detach(this); assert(!_epolled); - _socketEvent = NULL; + _socketEvent = nullptr; } } @@ -287,7 +287,7 @@ FastOS_SocketInterface::getLastErrorString(void) { const char * FastOS_SocketInterface::InitializeServices(void) { FastOS_SocketEventObjects::InitializeClass(); - return NULL; + return nullptr; } void FastOS_SocketInterface::CleanupServices () { @@ -301,14 +301,14 @@ bool FastOS_SocketInterface::SetSocketEvent (FastOS_SocketEvent *event, void *at if (CreateIfNoSocketYet()) { if (_socketEvent != event) { - if (_socketEvent != NULL) { + if (_socketEvent != nullptr) { // Disable events for this socket on the old SocketEvent _socketEvent->Detach(this); assert(!_epolled); - _socketEvent = NULL; + _socketEvent = nullptr; } - if (event != NULL) { + if (event != nullptr) { event->Attach(this, _readEventEnabled, _writeEventEnabled); _socketEvent = event; } @@ -322,7 +322,7 @@ bool FastOS_SocketInterface::SetSocketEvent (FastOS_SocketEvent *event, void *at void FastOS_SocketInterface::EnableReadEvent (bool enabled) { if (_readEventEnabled == enabled) { return; } _readEventEnabled = enabled; - if (_socketEvent != NULL) { + if (_socketEvent != nullptr) { _socketEvent->EnableEvent(this, _readEventEnabled, _writeEventEnabled); } } @@ -337,7 +337,7 @@ void FastOS_SocketInterface::EnableReadEvent (bool enabled) { void FastOS_SocketInterface::EnableWriteEvent (bool enabled) { if (_writeEventEnabled == enabled) { return; } _writeEventEnabled = enabled; - if (_socketEvent != NULL) { + if (_socketEvent != nullptr) { _socketEvent->EnableEvent(this, _readEventEnabled, _writeEventEnabled); } } diff --git a/fastos/src/vespa/fastos/socket.h b/fastos/src/vespa/fastos/socket.h index 6f4650ab64a..31b8903a4e4 100644 --- a/fastos/src/vespa/fastos/socket.h +++ b/fastos/src/vespa/fastos/socket.h @@ -244,11 +244,11 @@ public: * @param attribute Event attribute pointer * @return Boolean success/failure. */ - bool SetSocketEvent (FastOS_SocketEvent *event, void *attribute=NULL); + bool SetSocketEvent (FastOS_SocketEvent *event, void *attribute=nullptr); /** * Get socket event object - * @return Associated socket event object or NULL + * @return Associated socket event object or nullptr */ FastOS_SocketEvent *GetSocketEvent () { return _socketEvent; } diff --git a/fastos/src/vespa/fastos/socketevent.cpp b/fastos/src/vespa/fastos/socketevent.cpp index e3bc7d28888..a80cb015782 100644 --- a/fastos/src/vespa/fastos/socketevent.cpp +++ b/fastos/src/vespa/fastos/socketevent.cpp @@ -6,7 +6,7 @@ #include -FastOS_SocketEventObjects *FastOS_SocketEventObjects::_objects = NULL; +FastOS_SocketEventObjects *FastOS_SocketEventObjects::_objects = nullptr; FastOS_Mutex FastOS_SocketEventObjects::_listMutex; int FastOS_SocketEventObjects::_objectCount = 0; bool FastOS_SocketEventObjects::_initialized = false; @@ -17,12 +17,12 @@ FastOS_SocketEvent::FastOS_SocketEvent () : _socketsInArray(0), _getEventsIndex(0), _wokeUp(false), - _objs(NULL) + _objs(nullptr) { _objs = FastOS_SocketEventObjects::ObtainObject(this); - if(_objs != NULL) { + if(_objs != nullptr) { if(_objs->_initOk) { } } @@ -57,19 +57,19 @@ FastOS_SocketEventObjects *FastOS_SocketEventObjects::ObtainObject (FastOS_Socke FastOS_SocketEventObjects *node; _listMutex.Lock(); - if(_objects == NULL) + if(_objects == nullptr) { _objectCount++; _listMutex.Unlock(); node = new FastOS_SocketEventObjects(event); - node->_next = NULL; + node->_next = nullptr; } else { node = _objects; _objects = node->_next; - node->_next = NULL; + node->_next = nullptr; _listMutex.Unlock(); } @@ -79,7 +79,7 @@ FastOS_SocketEventObjects *FastOS_SocketEventObjects::ObtainObject (FastOS_Socke void FastOS_SocketEventObjects::ReleaseObject (FastOS_SocketEventObjects *node) { - if (node != NULL) + if (node != nullptr) node->ReleasedCleanup(); _listMutex.Lock(); @@ -99,7 +99,7 @@ bool FastOS_SocketEvent::epollInit() { _epollfd = epoll_create(4093); - if (_epollfd != -1 && _objs != NULL && _objs->_initOk) { + if (_epollfd != -1 && _objs != nullptr && _objs->_initOk) { epoll_event evt; evt.events = EPOLLIN; evt.data.ptr = 0; @@ -153,7 +153,7 @@ FastOS_SocketEvent::epollWait(bool &error, int msTimeout) for (int i = 0; i < res; ++i) { const epoll_event &evt = _epollEvents[i]; FastOS_SocketInterface *sock = (FastOS_SocketInterface *) evt.data.ptr; - if (sock == NULL) { + if (sock == nullptr) { HandleWakeUp(); } else { sock->_readPossible = sock->_readEventEnabled && @@ -182,7 +182,7 @@ FastOS_SocketEvent::epollGetEvents(bool *wakeUp, int msTimeout, const epoll_event &evt = _epollEvents[i]; FastOS_IOEvent &appEvt = events[idx]; FastOS_SocketInterface *sock = (FastOS_SocketInterface *) evt.data.ptr; - if (sock == NULL) { + if (sock == nullptr) { HandleWakeUp(); // sets _wokeUp } else { appEvt._readOccurred = sock->_readEventEnabled && @@ -227,7 +227,7 @@ void FastOS_SocketEventObjects::ClassCleanup(void) { FastOS_SocketEventObjects *node = _objects; - if(node == NULL) + if(node == nullptr) break; else { @@ -241,11 +241,11 @@ void FastOS_SocketEventObjects::ClassCleanup(void) FastOS_SocketEventObjects::FastOS_SocketEventObjects(FastOS_SocketEvent *event) - : _next(NULL), + : _next(nullptr), _initOk(false), - _socketArray(NULL), + _socketArray(nullptr), _socketArrayAllocSize(0u), - _pollfds(NULL), + _pollfds(nullptr), _pollfdsAllocSize(0) { // Connect ourselves to the socketevent object. @@ -259,12 +259,12 @@ FastOS_SocketEventObjects::ReleasedCleanup(void) { if (_socketArrayAllocSize > 16) { delete [] _socketArray; - _socketArray = NULL; + _socketArray = nullptr; _socketArrayAllocSize = 0; } if (_pollfdsAllocSize > 16) { free(_pollfds); - _pollfds = NULL; + _pollfds = nullptr; _pollfdsAllocSize = 0; } } diff --git a/fastos/src/vespa/fastos/socketevent.h b/fastos/src/vespa/fastos/socketevent.h index 6ed6b73a86c..5e457908ace 100644 --- a/fastos/src/vespa/fastos/socketevent.h +++ b/fastos/src/vespa/fastos/socketevent.h @@ -87,7 +87,7 @@ public: * FastOS_SocketEvent socketEvent; * * // Walk through single-linked list of connections - * for(conn=connections; conn!=NULL; conn = conn->_next) + * for(conn=connections; conn!=nullptr; conn = conn->_next) * { * // Associate each socket with socketEvent * conn->_socket->SetSocketEvent(&socketEvent); @@ -105,7 +105,7 @@ public: * if(socketEvent.Wait(200)) * { * // Walk through list of connections - * for(conn=connections; conn!=NULL; conn = conn->_next) + * for(conn=connections; conn!=nullptr; conn = conn->_next) * { * // For each socket, check for read event * if(socketEvent.QueryReadEvent(conn->_socket)) @@ -172,7 +172,7 @@ public: if (_epollfd == -1) { return false; } - return (_objs != NULL) ? _objs->_initOk : false; + return (_objs != nullptr) ? _objs->_initOk : false; } /** diff --git a/fastos/src/vespa/fastos/thread.cpp b/fastos/src/vespa/fastos/thread.cpp index 484746a9b0d..3cd3bb4b85b 100644 --- a/fastos/src/vespa/fastos/thread.cpp +++ b/fastos/src/vespa/fastos/thread.cpp @@ -21,8 +21,8 @@ FastOS_ThreadPool::FastOS_ThreadPool(int stackSize, int maxThreads) _closeCalledFlag(false), _freeMutex(), _liveCond(), - _freeThreads(NULL), - _activeThreads(NULL), + _freeThreads(nullptr), + _activeThreads(nullptr), _numFree(0), _numActive(0), _numTerminated(0), @@ -71,9 +71,9 @@ void FastOS_ThreadPool::FreeThread (FastOS_ThreadInterface *thread) void FastOS_ThreadPool::LinkOutThread (FastOS_ThreadInterface *thread, FastOS_ThreadInterface **listHead) { - if (thread->_prev != NULL) + if (thread->_prev != nullptr) thread->_prev->_next = thread->_next; - if (thread->_next != NULL) + if (thread->_next != nullptr) thread->_next->_prev = thread->_prev; if (thread == *listHead) @@ -82,10 +82,10 @@ void FastOS_ThreadPool::LinkOutThread (FastOS_ThreadInterface *thread, FastOS_Th void FastOS_ThreadPool::LinkInThread (FastOS_ThreadInterface *thread, FastOS_ThreadInterface **listHead) { - thread->_prev = NULL; + thread->_prev = nullptr; thread->_next = *listHead; - if (*listHead != NULL) + if (*listHead != nullptr) (*listHead)->_prev = thread; *listHead = thread; @@ -108,12 +108,12 @@ void FastOS_ThreadPool::ActivateThread (FastOS_ThreadInterface *thread) // make this thread call parameter fcn when it becomes active. FastOS_ThreadInterface *FastOS_ThreadPool::NewThread (FastOS_Runnable *owner, void *arg) { - FastOS_ThreadInterface *thread=NULL; + FastOS_ThreadInterface *thread=nullptr; _freeMutex.Lock(); if (!isClosed()) { - if ((thread = _freeThreads) != NULL) { + if ((thread = _freeThreads) != nullptr) { // Reusing thread entry _freeThreads = thread->_next; _numFree--; @@ -134,7 +134,7 @@ FastOS_ThreadInterface *FastOS_ThreadPool::NewThread (FastOS_Runnable *owner, vo thread = FastOS_Thread::CreateThread(this); - if (thread == NULL) { + if (thread == nullptr) { _liveCond.Lock(); _numLive--; if (_numLive == 0) { @@ -145,14 +145,14 @@ FastOS_ThreadInterface *FastOS_ThreadPool::NewThread (FastOS_Runnable *owner, vo _freeMutex.Lock(); - if(thread != NULL) + if(thread != nullptr) ActivateThread(thread); } } } _freeMutex.Unlock(); - if(thread != NULL) { + if(thread != nullptr) { _liveCond.Lock(); thread->Dispatch(owner, arg); _liveCond.Unlock(); @@ -169,12 +169,12 @@ void FastOS_ThreadPool::BreakThreads () _freeMutex.Lock(); // Notice all active threads that they should quit - for(thread=_activeThreads; thread != NULL; thread=thread->_next) { + for(thread=_activeThreads; thread != nullptr; thread=thread->_next) { thread->SetBreakFlag(); } // Notice all free threads that they should quit - for(thread=_freeThreads; thread != NULL; thread=thread->_next) { + for(thread=_freeThreads; thread != nullptr; thread=thread->_next) { thread->SetBreakFlag(); } @@ -201,7 +201,7 @@ void FastOS_ThreadPool::DeleteThreads () assert(_numActive == 0); assert(_numLive == 0); - while((thread = _freeThreads) != NULL) { + while((thread = _freeThreads) != nullptr) { LinkOutThread(thread, &_freeThreads); _numFree--; // printf("deleting thread %p\n", thread); @@ -243,7 +243,7 @@ void *FastOS_ThreadHook (void *arg) FastOS_ThreadInterface *thread = static_cast(arg); thread->Hook(); - return NULL; + return nullptr; } }; @@ -264,7 +264,7 @@ void FastOS_ThreadInterface::Hook () _dispatched.Lock(); // BEGIN lock - while (_owner == NULL && !(finished = _pool->isClosed())) { + while (_owner == nullptr && !(finished = _pool->isClosed())) { _dispatched.Wait(); } @@ -280,8 +280,8 @@ void FastOS_ThreadInterface::Hook () if (deleteOnCompletion) { delete _owner; } - _owner = NULL; - _startArg = NULL; + _owner = nullptr; + _startArg = nullptr; _breakFlag = false; finished = _pool->isClosed(); @@ -343,7 +343,7 @@ FastOS_ThreadInterface *FastOS_ThreadInterface::CreateThread(FastOS_ThreadPool * if(!thread->Initialize(pool->GetStackSize(), pool->GetStackGuardSize())) { delete(thread); - thread = NULL; + thread = nullptr; } return thread; @@ -360,16 +360,16 @@ void FastOS_ThreadInterface::Join () // ---------------------------------------------------------------------- FastOS_Runnable::FastOS_Runnable(void) - : _thread(NULL) + : _thread(nullptr) { } FastOS_Runnable::~FastOS_Runnable(void) { - // assert(_thread == NULL); + // assert(_thread == nullptr); } void FastOS_Runnable::Detach(void) { - _thread = NULL; + _thread = nullptr; } diff --git a/fastos/src/vespa/fastos/thread.h b/fastos/src/vespa/fastos/thread.h index b84708eb050..eb43fc6b664 100644 --- a/fastos/src/vespa/fastos/thread.h +++ b/fastos/src/vespa/fastos/thread.h @@ -158,9 +158,9 @@ public: * @param owner Instance to be invoked by new thread. * @param arg Arguments to be passed to new thread. * - * @return Pointer to newly created thread or NULL on failure. + * @return Pointer to newly created thread or nullptr on failure. */ - FastOS_ThreadInterface *NewThread (FastOS_Runnable *owner, void *arg=NULL); + FastOS_ThreadInterface *NewThread (FastOS_Runnable *owner, void *arg=nullptr); /** * Get the stack size used for threads in this pool. @@ -285,7 +285,7 @@ protected: * Create an operating system thread. In most cases you would want * to create threads using @ref FastOS_ThreadPool::NewThread() instead. * @param pool The threadpool which is about to contain the new thread. - * @return A new @ref FastOS_Thread or NULL on failure. + * @return A new @ref FastOS_Thread or nullptr on failure. */ static FastOS_ThreadInterface *CreateThread(FastOS_ThreadPool *pool); @@ -325,11 +325,11 @@ public: */ FastOS_ThreadInterface (FastOS_ThreadPool *pool) : _dispatched(), - _next(NULL), - _prev(NULL), - _owner(NULL), + _next(nullptr), + _prev(nullptr), + _owner(nullptr), _pool(pool), - _startArg(NULL), + _startArg(nullptr), _breakFlag(false), _active(false), _runningCond() @@ -492,7 +492,7 @@ public: FastOS_ThreadInterface *GetThread(void) { return _thread; } const FastOS_ThreadInterface *GetThread(void) const { return _thread; } - bool HasThread(void) const { return _thread != NULL; } + bool HasThread(void) const { return _thread != nullptr; } void Detach(void); }; diff --git a/fastos/src/vespa/fastos/timestamp.cpp b/fastos/src/vespa/fastos/timestamp.cpp index da0aa6bbd01..f967ea5aade 100644 --- a/fastos/src/vespa/fastos/timestamp.cpp +++ b/fastos/src/vespa/fastos/timestamp.cpp @@ -32,7 +32,7 @@ TimeStamp::asString(double timeInSeconds) int64_t ClockSystem::now() { struct timeval timeNow; - gettimeofday(&timeNow, NULL); + gettimeofday(&timeNow, nullptr); int64_t ns = timeNow.tv_sec; ns *= TimeStamp::NANO; ns += timeNow.tv_usec*1000; diff --git a/fastos/src/vespa/fastos/unix_app.cpp b/fastos/src/vespa/fastos/unix_app.cpp index 5916017e95c..7682b2d5b8f 100644 --- a/fastos/src/vespa/fastos/unix_app.cpp +++ b/fastos/src/vespa/fastos/unix_app.cpp @@ -17,8 +17,8 @@ FastOS_UNIX_Application::FastOS_UNIX_Application () - : _processStarter(NULL), - _ipcHelper(NULL) + : _processStarter(nullptr), + _ipcHelper(nullptr) { } @@ -71,7 +71,7 @@ bool FastOS_UNIX_Application:: SendIPCMessage (FastOS_UNIX_Process *xproc, const void *buffer, int length) { - if(_ipcHelper == NULL) + if(_ipcHelper == nullptr) return false; return _ipcHelper->SendMessage(xproc, buffer, length); } @@ -80,9 +80,9 @@ SendIPCMessage (FastOS_UNIX_Process *xproc, const void *buffer, bool FastOS_UNIX_Application:: SendParentIPCMessage (const void *data, size_t length) { - if(_ipcHelper == NULL) + if(_ipcHelper == nullptr) return false; - return _ipcHelper->SendMessage(NULL, data, length); + return _ipcHelper->SendMessage(nullptr, data, length); } @@ -95,7 +95,7 @@ bool FastOS_UNIX_Application::PreThreadInit () act.sa_handler = SIG_IGN; sigemptyset(&act.sa_mask); act.sa_flags = 0; - sigaction(SIGPIPE, &act, NULL); + sigaction(SIGPIPE, &act, nullptr); if (useProcessStarter()) { _processStarter = new FastOS_UNIX_ProcessStarter(this); @@ -120,7 +120,7 @@ bool FastOS_UNIX_Application::Init () int ipcDescriptor = -1; char *env = getenv("FASTOS_IPC_PARENT"); - if(env != NULL) + if(env != nullptr) { int commaCount=0; int notDigitCount=0; @@ -158,15 +158,15 @@ bool FastOS_UNIX_Application::Init () void FastOS_UNIX_Application::Cleanup () { - if(_ipcHelper != NULL) + if(_ipcHelper != nullptr) _ipcHelper->Exit(); - if (_processStarter != NULL) { + if (_processStarter != nullptr) { if (_processListMutex) ProcessLock(); _processStarter->Stop(); if (_processListMutex) ProcessUnlock(); delete _processStarter; - _processStarter = NULL; + _processStarter = nullptr; } FastOS_ApplicationInterface::Cleanup(); @@ -181,13 +181,13 @@ FastOS_UNIX_Application::GetProcessStarter () void FastOS_UNIX_Application:: AddToIPCComm (FastOS_UNIX_Process *process) { - if(_ipcHelper != NULL) + if(_ipcHelper != nullptr) _ipcHelper->AddProcess(process); } void FastOS_UNIX_Application:: RemoveFromIPCComm (FastOS_UNIX_Process *process) { - if(_ipcHelper != NULL) + if(_ipcHelper != nullptr) _ipcHelper->RemoveProcess(process); } diff --git a/fastos/src/vespa/fastos/unix_cond.cpp b/fastos/src/vespa/fastos/unix_cond.cpp index f2e541055ff..5eb1f5b0218 100644 --- a/fastos/src/vespa/fastos/unix_cond.cpp +++ b/fastos/src/vespa/fastos/unix_cond.cpp @@ -8,7 +8,7 @@ FastOS_UNIX_Cond::FastOS_UNIX_Cond(void) : FastOS_CondInterface(), _cond() { - pthread_cond_init(&_cond, NULL); + pthread_cond_init(&_cond, nullptr); } FastOS_UNIX_Cond::~FastOS_UNIX_Cond(void) @@ -30,7 +30,7 @@ FastOS_UNIX_Cond::TimedWait(int milliseconds) struct timespec absTime; int error; - gettimeofday(¤tTime, NULL); + gettimeofday(¤tTime, nullptr); int64_t ns = (static_cast(currentTime.tv_sec) * static_cast(1000 * 1000 * 1000) + diff --git a/fastos/src/vespa/fastos/unix_dynamiclibrary.cpp b/fastos/src/vespa/fastos/unix_dynamiclibrary.cpp index 75d3ee9fb27..f3d3aa35511 100644 --- a/fastos/src/vespa/fastos/unix_dynamiclibrary.cpp +++ b/fastos/src/vespa/fastos/unix_dynamiclibrary.cpp @@ -20,7 +20,7 @@ bool hasValidSuffix(const std::string & s) void FastOS_UNIX_DynamicLibrary::SetLibName(const char *libname) { - if (libname != NULL) { + if (libname != nullptr) { _libname = libname; if ( ! hasValidSuffix(_libname)) { _libname.append(FASTOS_DYNLIB_SUFFIX); @@ -58,14 +58,14 @@ FastOS_UNIX_DynamicLibrary::Close() if (IsOpen()) { retcode = (dlclose(_handle) == 0); if (retcode) - _handle = NULL; + _handle = nullptr; } return retcode; } FastOS_UNIX_DynamicLibrary::FastOS_UNIX_DynamicLibrary(const char *libname) : - _handle(NULL), + _handle(nullptr), _libname("") { SetLibName(libname); @@ -81,13 +81,13 @@ FastOS_UNIX_DynamicLibrary::Open(const char *libname) { if (! Close()) return false; - if (libname != NULL) { + if (libname != nullptr) { SetLibName(libname); } _handle = dlopen(_libname.c_str(), RTLD_NOW); - if (_handle == NULL) { + if (_handle == nullptr) { // Prepend "lib" if neccessary... if (NormalizeLibName()) { // ...try to open again if a change was made. @@ -95,7 +95,7 @@ FastOS_UNIX_DynamicLibrary::Open(const char *libname) } } - return (_handle != NULL); + return (_handle != nullptr); } void * @@ -109,7 +109,7 @@ FastOS_UNIX_DynamicLibrary::GetLastErrorString() const { const char *errorString = dlerror(); std::string e; - if (errorString != NULL) { + if (errorString != nullptr) { e = errorString; } diff --git a/fastos/src/vespa/fastos/unix_dynamiclibrary.h b/fastos/src/vespa/fastos/unix_dynamiclibrary.h index 13e86b1c8af..1c891ee5b6d 100644 --- a/fastos/src/vespa/fastos/unix_dynamiclibrary.h +++ b/fastos/src/vespa/fastos/unix_dynamiclibrary.h @@ -24,17 +24,17 @@ private: std::string _libname; public: - FastOS_UNIX_DynamicLibrary(const char *libname = NULL); + FastOS_UNIX_DynamicLibrary(const char *libname = nullptr); ~FastOS_UNIX_DynamicLibrary(); void SetLibName(const char *libname); bool NormalizeLibName(void); bool Close() override; - bool Open(const char *libname = NULL) override; + bool Open(const char *libname = nullptr) override; void * GetSymbol(const char *symbol) const override; std::string GetLastErrorString() const; const char * GetLibName() const { return _libname.c_str(); } - bool IsOpen() const override { return (_handle != NULL); } + bool IsOpen() const override { return (_handle != nullptr); } }; diff --git a/fastos/src/vespa/fastos/unix_file.h b/fastos/src/vespa/fastos/unix_file.h index aa5ea4edb01..5702f511ca5 100644 --- a/fastos/src/vespa/fastos/unix_file.h +++ b/fastos/src/vespa/fastos/unix_file.h @@ -47,9 +47,9 @@ public: static int GetMaximumFilenameLength (const char *pathName); static int GetMaximumPathLength (const char *pathName); - FastOS_UNIX_File(const char *filename=NULL) + FastOS_UNIX_File(const char *filename=nullptr) : FastOS_FileInterface(filename), - _mmapbase(NULL), + _mmapbase(nullptr), _mmaplen(0), _filedes(-1), _mmapFlags(0), @@ -66,18 +66,18 @@ public: } void *MemoryMapPtr(int64_t position) const override { - if (_mmapbase != NULL) { + if (_mmapbase != nullptr) { if (position < int64_t(_mmaplen)) { return static_cast(static_cast(_mmapbase) + position); } else { // This is an indication that the file size has changed and a remap/reopen must be done. - return NULL; + return nullptr; } } else { - return NULL; + return nullptr; } } - bool IsMemoryMapped() const override { return _mmapbase != NULL; } + bool IsMemoryMapped() const override { return _mmapbase != nullptr; } bool SetPosition(int64_t desiredPosition) override; int64_t GetPosition() override; int64_t GetSize() override; diff --git a/fastos/src/vespa/fastos/unix_ipc.cpp b/fastos/src/vespa/fastos/unix_ipc.cpp index f8cde75bc7a..695d395674f 100644 --- a/fastos/src/vespa/fastos/unix_ipc.cpp +++ b/fastos/src/vespa/fastos/unix_ipc.cpp @@ -118,7 +118,7 @@ SetBlocking (int fileDescriptor, bool doBlock) { bool rc=false; - int flags = fcntl(fileDescriptor, F_GETFL, NULL); + int flags = fcntl(fileDescriptor, F_GETFL, nullptr); if (flags != -1) { if(doBlock) @@ -134,7 +134,7 @@ void FastOS_UNIX_IPCHelper:: BuildPollCheck(bool isRead, int filedes, FastOS_RingBuffer *buffer, bool *check) { - if(buffer == NULL || + if(buffer == nullptr || filedes < 0 || buffer->GetCloseFlag()) { *check = false; @@ -154,7 +154,7 @@ void FastOS_UNIX_IPCHelper:: PerformAsyncIO(void) { FastOS_ProcessInterface *node; - for(node = _app->GetProcessList(); node != NULL; node = node->_next) + for(node = _app->GetProcessList(); node != nullptr; node = node->_next) { FastOS_UNIX_Process *xproc = static_cast(node); @@ -187,7 +187,7 @@ void FastOS_UNIX_IPCHelper:: BuildPollChecks(void) { FastOS_ProcessInterface *node; - for(node = _app->GetProcessList(); node != NULL; node = node->_next) + for(node = _app->GetProcessList(); node != nullptr; node = node->_next) { FastOS_UNIX_Process *xproc = static_cast(node); @@ -202,11 +202,11 @@ BuildPollChecks(void) } } - if(_appParentIPCDescriptor._writeBuffer.get() != NULL) + if(_appParentIPCDescriptor._writeBuffer.get() != nullptr) BuildPollCheck(false, _appParentIPCDescriptor._fd, _appParentIPCDescriptor._writeBuffer.get(), &_appParentIPCDescriptor._wantWrite); - if(_appParentIPCDescriptor._readBuffer.get() != NULL) + if(_appParentIPCDescriptor._readBuffer.get() != nullptr) BuildPollCheck(true, _appParentIPCDescriptor._fd, _appParentIPCDescriptor._readBuffer.get(), &_appParentIPCDescriptor._wantRead); @@ -225,12 +225,12 @@ ResizePollArray(pollfd **fds, unsigned int *allocnfds) else newallocnfds = *allocnfds * 2; newfds = static_cast(malloc(newallocnfds * sizeof(pollfd))); - assert(newfds != NULL); + assert(newfds != nullptr); if (*allocnfds > 0) memcpy(newfds, *fds, sizeof(pollfd) * *allocnfds); - if (*fds != NULL) + if (*fds != nullptr) free(*fds); *fds = newfds; @@ -261,7 +261,7 @@ BuildPollArray(pollfd **fds, unsigned int *nfds, unsigned int *allocnfds) rfds->revents = 0; rfds++; pollIdx = 1; - for(node = _app->GetProcessList(); node != NULL; node = node->_next) + for(node = _app->GetProcessList(); node != nullptr; node = node->_next) { FastOS_UNIX_Process *xproc = static_cast(node); @@ -331,7 +331,7 @@ SavePollArray(pollfd *fds, unsigned int nfds) { FastOS_ProcessInterface *node; - for(node = _app->GetProcessList(); node != NULL; node = node->_next) + for(node = _app->GetProcessList(); node != nullptr; node = node->_next) { FastOS_UNIX_Process *xproc = static_cast(node); @@ -396,7 +396,7 @@ RemoveClosingProcesses(void) FastOS_ProcessInterface *node, *next; - for(node = _app->GetProcessList(); node != NULL; node = next) + for(node = _app->GetProcessList(); node != nullptr; node = next) { int type; @@ -430,7 +430,7 @@ RemoveClosingProcesses(void) if(!stillBusy) { - if(xproc->_closing != NULL) + if(xproc->_closing != nullptr) { // We already have the process lock at this point, // so modifying the list is safe. @@ -468,14 +468,14 @@ Run(FastOS_ThreadInterface *thisThread, void *arg) unsigned int nfds; unsigned int allocnfds; - fds = NULL; + fds = nullptr; nfds = 0; allocnfds = 0; for(;;) { // Deliver messages to from child processes and parent. _app->ProcessLock(); - for(node = _app->GetProcessList(); node != NULL; node = node->_next) + for(node = _app->GetProcessList(); node != nullptr; node = node->_next) { FastOS_UNIX_Process *xproc = static_cast(node); FastOS_UNIX_Process::DescriptorHandle &desc = @@ -578,12 +578,12 @@ SendMessage (FastOS_UNIX_Process *xproc, const void *buffer, FastOS_RingBuffer *ipcBuffer; FastOS_UNIX_Process::DescriptorHandle &desc = - xproc != NULL ? + xproc != nullptr ? xproc->GetDescriptorHandle(FastOS_UNIX_Process::TYPE_IPC) : _appParentIPCDescriptor; ipcBuffer = desc._writeBuffer.get(); - if(ipcBuffer != NULL) { + if(ipcBuffer != nullptr) { ipcBuffer->Lock(); if(ipcBuffer->GetWriteSpace() >= int((length + sizeof(int)))) { @@ -653,7 +653,7 @@ void FastOS_UNIX_IPCHelper::RemoveProcess (FastOS_UNIX_Process *xproc) void FastOS_UNIX_IPCHelper::DeliverMessages (FastOS_RingBuffer *buffer) { - if(buffer == NULL) + if(buffer == nullptr) return; buffer->Lock(); @@ -683,11 +683,11 @@ PipeData (FastOS_UNIX_Process *process, { FastOS_UNIX_Process::DescriptorHandle &desc = process->GetDescriptorHandle(type); FastOS_RingBuffer *buffer = desc._readBuffer.get(); - if(buffer == NULL) + if(buffer == nullptr) return; FastOS_ProcessRedirectListener *listener = process->GetListener(type); - if(listener == NULL) + if(listener == nullptr) return; buffer->Lock(); diff --git a/fastos/src/vespa/fastos/unix_mutex.cpp b/fastos/src/vespa/fastos/unix_mutex.cpp index 4d802f691ec..535a39ce592 100644 --- a/fastos/src/vespa/fastos/unix_mutex.cpp +++ b/fastos/src/vespa/fastos/unix_mutex.cpp @@ -7,7 +7,7 @@ FastOS_UNIX_Mutex::FastOS_UNIX_Mutex(void) : FastOS_MutexInterface(), _mutex() { - int error = pthread_mutex_init(&_mutex, NULL); + int error = pthread_mutex_init(&_mutex, nullptr); assert(error == 0); (void) error; } diff --git a/fastos/src/vespa/fastos/unix_process.cpp b/fastos/src/vespa/fastos/unix_process.cpp index 70e441c64db..df32cb935ff 100644 --- a/fastos/src/vespa/fastos/unix_process.cpp +++ b/fastos/src/vespa/fastos/unix_process.cpp @@ -172,7 +172,7 @@ public: static const char * NextArgument (const char *p, const char **endArg, - int *length = NULL); + int *length = nullptr); static int CountArguments (const char *commandLine); @@ -264,10 +264,10 @@ FastOS_UNIX_RealProcess::FastOS_UNIX_RealProcess(int streamMask) _runDir(), _stdoutRedirName(), _stderrRedirName(), - _path(NULL), + _path(nullptr), _pathProgBuf(), - _prev(NULL), - _next(NULL) + _prev(nullptr), + _next(nullptr) { _stdinDes[0] = _stdinDes[1] = -1; _stdoutDes[0] = _stdoutDes[1] = -1; @@ -286,15 +286,15 @@ FastOS_UNIX_RealProcess::~FastOS_UNIX_RealProcess(void) void FastOS_UNIX_RealProcess::PrepareExecVPE(const char *prog) { - const char *path = NULL; + const char *path = nullptr; char defaultPath[] = ":/usr/ucb:/bin:/usr/bin"; - if (strchr(prog, '/') != NULL) { + if (strchr(prog, '/') != nullptr) { path = ""; } else { path = getenv("PATH"); - if (path == NULL) path = defaultPath; + if (path == nullptr) path = defaultPath; } _path = path; _pathProgBuf.resize(strlen(prog) + 1 + strlen(path) + 1); @@ -362,14 +362,14 @@ FastOS_UNIX_RealProcess::NextArgument (const char *p, for(;;) { if (*p == '\0') { - if (length != NULL) + if (length != nullptr) *length = p - nextArg; break; } if (quoteChar != '\0') { if (*p == quoteChar) { - if (length != NULL) + if (length != nullptr) *length = p - nextArg; p++; break; @@ -378,7 +378,7 @@ FastOS_UNIX_RealProcess::NextArgument (const char *p, else { if (IsWhiteSpace(*p)) { - if (length != NULL) + if (length != nullptr) *length = p - nextArg; break; } @@ -391,7 +391,7 @@ FastOS_UNIX_RealProcess::NextArgument (const char *p, } p++; } - return NULL; + return nullptr; } @@ -470,7 +470,7 @@ ForkAndExec(const char *command, int numArguments = 0; - char **execArgs = NULL; + char **execArgs = nullptr; if (!IsUsingShell()) { numArguments = CountArguments(command); @@ -483,9 +483,9 @@ ForkAndExec(const char *command, const char *arg = NextArgument(nextArg, &nextArg, &length); - if (arg == NULL) { - // printf("ARG NULL\n"); - execArgs[i] = NULL; + if (arg == nullptr) { + // printf("ARG nullptr\n"); + execArgs[i] = nullptr; break; } // printf("argLen = %d\n", length); @@ -497,7 +497,7 @@ ForkAndExec(const char *command, PrepareExecVPE(execArgs[0]); } } - if (process == NULL) { + if (process == nullptr) { processStarter->CloseProxyDescs(IsStdinPiped() ? _stdinDes[0] : -1, IsStdoutPiped() ? _stdoutDes[1] : -1, IsStderrPiped() ? _stderrDes[1] : -1, @@ -542,7 +542,7 @@ ForkAndExec(const char *command, CloseDescriptor(_handshakeDes[0]); _handshakeDes[0] = -1; - if (process != NULL) { + if (process != nullptr) { if (!process->GetKeepOpenFilesIfDirectChild()) { int fdlimit = sysconf(_SC_OPEN_MAX); // Close everything else @@ -571,7 +571,7 @@ ForkAndExec(const char *command, shExecArgs[0] = "sh"; shExecArgs[1] = "-c"; shExecArgs[2] = command; - shExecArgs[3] = NULL; + shExecArgs[3] = nullptr; execve("/bin/sh", const_cast (reinterpret_cast @@ -702,9 +702,9 @@ ForkAndExec(const char *command, rc = true; } } - if (execArgs != NULL) { + if (execArgs != nullptr) { char **arg = execArgs; - while (*arg != NULL) { + while (*arg != nullptr) { delete [] *arg; arg++; } @@ -795,14 +795,14 @@ FastOS_UNIX_Process (const char *cmdLine, bool pipeStdin, _stdoutRedirName(), _stderrRedirName(), _killed(false), - _closing(NULL) + _closing(nullptr) { _descriptor[TYPE_IPC]._readBuffer.reset(new FastOS_RingBuffer(bufferSize)); _descriptor[TYPE_IPC]._writeBuffer.reset(new FastOS_RingBuffer(bufferSize)); - if (stdoutListener != NULL) + if (stdoutListener != nullptr) _descriptor[TYPE_STDOUT]._readBuffer.reset(new FastOS_RingBuffer(bufferSize)); - if (stderrListener != NULL) + if (stderrListener != nullptr) _descriptor[TYPE_STDERR]._readBuffer.reset(new FastOS_RingBuffer(bufferSize)); _app->ProcessLock(); @@ -865,8 +865,8 @@ bool FastOS_UNIX_Process::CreateInternal (bool useShell) { return GetProcessStarter()->CreateProcess(this, useShell, _pipeStdin, - _stdoutListener != NULL, - _stderrListener != NULL); + _stdoutListener != nullptr, + _stderrListener != nullptr); } bool FastOS_UNIX_Process::WriteStdin (const void *data, size_t length) @@ -875,7 +875,7 @@ bool FastOS_UNIX_Process::WriteStdin (const void *data, size_t length) DescriptorHandle &desc = GetDescriptorHandle(TYPE_STDIN); if (desc._fd != -1) { - if (data == NULL) { + if (data == nullptr) { CloseDescriptor(TYPE_STDIN); rc = true; } @@ -940,7 +940,7 @@ bool FastOS_UNIX_Process::InternalWait (int *returnCode, bool FastOS_UNIX_Process::Wait (int *returnCode, int timeOutSeconds) { - return InternalWait(returnCode, timeOutSeconds, NULL); + return InternalWait(returnCode, timeOutSeconds, nullptr); } bool FastOS_UNIX_Process::PollWait (int *returnCode, bool *stillRunning) @@ -1054,10 +1054,10 @@ void FastOS_UNIX_ProcessStarter::WriteInt (int fd, int integer, void FastOS_UNIX_ProcessStarter:: AddChildProcess (FastOS_UNIX_RealProcess *node) { - node->_prev = NULL; + node->_prev = nullptr; node->_next = _processList; - if (_processList != NULL) + if (_processList != nullptr) _processList->_prev = node; _processList = node; } @@ -1072,11 +1072,11 @@ RemoveChildProcess (FastOS_UNIX_RealProcess *node) if (node->_next) { node->_next->_prev = node->_prev; - node->_next = NULL; + node->_next = nullptr; } - if (node->_prev != NULL) - node->_prev = NULL; + if (node->_prev != nullptr) + node->_prev = nullptr; } bool FastOS_UNIX_ProcessStarter::SendFileDescriptor (int fd) @@ -1112,7 +1112,7 @@ bool FastOS_UNIX_ProcessStarter::SendFileDescriptor (int fd) msg.msg_accrightslen = sizeof(int); #endif - msg.msg_name = NULL; + msg.msg_name = nullptr; msg.msg_namelen = 0; char dummyData = '\0'; @@ -1149,7 +1149,7 @@ void FastOS_UNIX_ProcessStarter::StarterDoWait () FastOS_UNIX_RealProcess *process, *next; for(process = FastOS_UNIX_ProcessStarter::_processList; - process != NULL; process = next) + process != nullptr; process = next) { // Need to do this here since we are deleting entries @@ -1204,7 +1204,7 @@ void FastOS_UNIX_ProcessStarter::StarterDoDetachProcess () FastOS_UNIX_RealProcess *process, *next; for(process = FastOS_UNIX_ProcessStarter::_processList; - process != NULL; process = next) { + process != nullptr; process = next) { // Need to do this here since we are deleting entries next = process->_next; @@ -1342,7 +1342,7 @@ void FastOS_UNIX_ProcessStarter::StarterDoCreateProcess () pid_t processId = -1; if (process->ForkAndExec(cmdLine, environmentVariables, - NULL, + nullptr, this)) { processId = process->GetProcessID(); @@ -1359,7 +1359,7 @@ void FastOS_UNIX_ProcessStarter::StarterDoCreateProcess () if (!rc) delete process; char **pe = environmentVariables; - while(*pe != NULL) { + while(*pe != nullptr) { delete [] *pe++; } delete [] environmentVariables; @@ -1415,7 +1415,7 @@ bool FastOS_UNIX_ProcessStarter::CreateSocketPairs () FastOS_UNIX_ProcessStarter::FastOS_UNIX_ProcessStarter (FastOS_ApplicationInterface *app) : _app(app), - _processList(NULL), + _processList(nullptr), _pid(-1), _starterSocket(-1), _mainSocket(-1), @@ -1503,7 +1503,7 @@ int FastOS_UNIX_ProcessStarter::ReadFileDescriptor () msg.msg_accrightslen = sizeof(int); #endif - msg.msg_name = NULL; + msg.msg_name = nullptr; msg.msg_namelen = 0; char dummyData = '\0'; @@ -1521,7 +1521,7 @@ int FastOS_UNIX_ProcessStarter::ReadFileDescriptor () // printf("recvmsgrc = %d\n", recvmsgrc); #ifndef FASTOS_HAVE_ACCRIGHTSLEN - if ((cmptr = CMSG_FIRSTHDR(&msg)) != NULL && + if ((cmptr = CMSG_FIRSTHDR(&msg)) != nullptr && cmptr->cmsg_len == CMSG_LEN(sizeof(int))) { if (cmptr->cmsg_level != SOL_SOCKET) @@ -1594,7 +1594,7 @@ char ** FastOS_UNIX_ProcessStarter::ReceiveEnvironmentVariables () else fillIndex++; } - myEnvironment[fillIndex] = NULL; + myEnvironment[fillIndex] = nullptr; return myEnvironment; } @@ -1605,7 +1605,7 @@ void FastOS_UNIX_ProcessStarter::SendEnvironmentVariables () int numEnvVars = 0; char **pe = environ; - while(*pe++ != NULL) + while(*pe++ != nullptr) numEnvVars++; WriteInt(_mainSocket, numEnvVars); @@ -1619,7 +1619,7 @@ void FastOS_UNIX_ProcessStarter::SendEnvironmentVariables () const char *envString = ""; if (!gotNull) { envString = *pe++; - if (envString == NULL) { + if (envString == nullptr) { envString = ""; gotNull = true; } @@ -1674,7 +1674,7 @@ FastOS_UNIX_ProcessStarter:: CopyEnvironmentVariables(void) { char **env = environ; - while (*env != NULL) + while (*env != nullptr) env++; int numEnvVars = env - environ; char **newEnv = new char *[numEnvVars + 2]; @@ -1682,7 +1682,7 @@ CopyEnvironmentVariables(void) int fillIdx = 1; env = environ; - while (*env != NULL) { + while (*env != nullptr) { size_t len = strlen(*env); if (len > 0 && strncmp(*env, "FASTOS_IPC_PARENT=", 18) != 0) { @@ -1692,7 +1692,7 @@ CopyEnvironmentVariables(void) } env++; } - newEnv[fillIdx] = NULL; + newEnv[fillIdx] = nullptr; return newEnv; } @@ -1702,7 +1702,7 @@ FastOS_UNIX_ProcessStarter:: FreeEnvironmentVariables(char **env) { char **p = env; - while (*p != NULL) { + while (*p != nullptr) { delete [] *p; p++; } @@ -1729,15 +1729,15 @@ CreateProcess (FastOS_UNIX_Process *process, FastOS_UNIX_RealProcess *rprocess = new FastOS_UNIX_RealProcess(process->BuildStreamMask(useShell)); const char *runDir = process->GetRunDir(); - if (runDir != NULL) { + if (runDir != nullptr) { rprocess->SetRunDir(runDir); // Handover } const char *stdoutRedirName = process->GetStdoutRedirName(); - if (stdoutRedirName != NULL) { + if (stdoutRedirName != nullptr) { rprocess->SetStdoutRedirName(stdoutRedirName); } const char *stderrRedirName = process->GetStderrRedirName(); - if (stderrRedirName != NULL) { + if (stderrRedirName != nullptr) { rprocess->SetStderrRedirName(stderrRedirName); } char **env = CopyEnvironmentVariables(); @@ -1786,7 +1786,7 @@ CreateProcess (FastOS_UNIX_Process *process, SendEnvironmentVariables(); const char *runDir = process->GetRunDir(); - if (runDir != NULL) { + if (runDir != nullptr) { int runDirLength = strlen(runDir) + 1; WriteInt(_mainSocket, runDirLength); WriteBytes(_mainSocket, runDir, runDirLength); @@ -1794,7 +1794,7 @@ CreateProcess (FastOS_UNIX_Process *process, WriteInt(_mainSocket, 0); const char *stdoutRedirName = process->GetStdoutRedirName(); - if (stdoutRedirName != NULL) { + if (stdoutRedirName != nullptr) { int stdoutRedirNameLength = strlen(stdoutRedirName) + 1; WriteInt(_mainSocket, stdoutRedirNameLength); WriteBytes(_mainSocket, stdoutRedirName, stdoutRedirNameLength); @@ -1802,7 +1802,7 @@ CreateProcess (FastOS_UNIX_Process *process, WriteInt(_mainSocket, 0); const char *stderrRedirName = process->GetStderrRedirName(); - if (stderrRedirName != NULL) { + if (stderrRedirName != nullptr) { int stderrRedirNameLength = strlen(stderrRedirName) + 1; WriteInt(_mainSocket, stderrRedirNameLength); WriteBytes(_mainSocket, stderrRedirName, stderrRedirNameLength); @@ -1866,7 +1866,7 @@ FastOS_UNIX_ProcessStarter::PollReapDirectChildren(void) FastOS_ProcessInterface *node; for(node = _app->GetProcessList(); - node != NULL; node = node->_next) + node != nullptr; node = node->_next) { FastOS_UNIX_Process *xproc = static_cast(node); @@ -1896,7 +1896,7 @@ FastOS_UNIX_ProcessStarter::PollReapProxiedChildren(void) ReadBytes(_mainSocket, &returnCode, sizeof(int)); FastOS_ProcessInterface *node; - for(node = _app->GetProcessList(); node != NULL; node = node->_next) + for(node = _app->GetProcessList(); node != nullptr; node = node->_next) { FastOS_UNIX_Process *xproc = static_cast(node); @@ -1922,7 +1922,7 @@ FastOS_UNIX_ProcessStarter::Wait(FastOS_UNIX_Process *process, FastOS_Time startTime; startTime.SetNow(); - if (pollStillRunning != NULL) + if (pollStillRunning != nullptr) *pollStillRunning = true; for (;;) { @@ -1935,7 +1935,7 @@ FastOS_UNIX_ProcessStarter::Wait(FastOS_UNIX_Process *process, process->_app->ProcessUnlock(); if (process->GetDeathFlag()) { - if (pollStillRunning != NULL) + if (pollStillRunning != nullptr) *pollStillRunning = false; break; } @@ -1943,7 +1943,7 @@ FastOS_UNIX_ProcessStarter::Wait(FastOS_UNIX_Process *process, // printf("wasn't dead yet (%d), sleeping\n", // process->GetProcessId()); - if (pollStillRunning != NULL) + if (pollStillRunning != nullptr) break; if ((timeOutSeconds != -1) && !timeOutKillAttempted) { @@ -2032,9 +2032,9 @@ FastOS_UNIX_Process::DescriptorHandle::CloseHandle() close(_fd); _fd = -1; } - if (_readBuffer.get() != NULL) + if (_readBuffer.get() != nullptr) _readBuffer->Close(); - if (_writeBuffer.get() != NULL) + if (_writeBuffer.get() != nullptr) _writeBuffer->Close(); } void diff --git a/fastos/src/vespa/fastos/unix_process.h b/fastos/src/vespa/fastos/unix_process.h index ff034b0e581..16614deb1a2 100644 --- a/fastos/src/vespa/fastos/unix_process.h +++ b/fastos/src/vespa/fastos/unix_process.h @@ -86,32 +86,32 @@ public: else if(type == TYPE_STDERR) return _stderrListener; - return NULL; + return nullptr; } void CloseListener (DescriptorType type) { if(type == TYPE_STDOUT) { - if(_stdoutListener != NULL) + if(_stdoutListener != nullptr) { - _stdoutListener->OnReceiveData(NULL, 0); - _stdoutListener = NULL; + _stdoutListener->OnReceiveData(nullptr, 0); + _stdoutListener = nullptr; } } else if(type == TYPE_STDERR) { - if(_stderrListener != NULL) + if(_stderrListener != nullptr) { - _stderrListener->OnReceiveData(NULL, 0); - _stderrListener = NULL; + _stderrListener->OnReceiveData(nullptr, 0); + _stderrListener = nullptr; } } } FastOS_UNIX_Process (const char *cmdLine, bool pipeStdin = false, - FastOS_ProcessRedirectListener *stdoutListener = NULL, - FastOS_ProcessRedirectListener *stderrListener = NULL, + FastOS_ProcessRedirectListener *stdoutListener = nullptr, + FastOS_ProcessRedirectListener *stderrListener = nullptr, int bufferSize = 65535); ~FastOS_UNIX_Process (); bool CreateInternal (bool useShell); diff --git a/fastos/src/vespa/fastos/unix_socket.cpp b/fastos/src/vespa/fastos/unix_socket.cpp index 2bdda49c982..ba1d2f50417 100644 --- a/fastos/src/vespa/fastos/unix_socket.cpp +++ b/fastos/src/vespa/fastos/unix_socket.cpp @@ -29,7 +29,7 @@ bool FastOS_UNIX_Socket::Shutdown() bool rc=true; if (ValidHandle()) { - if(_socketEvent != NULL) { + if(_socketEvent != nullptr) { EnableWriteEvent(false); } rc = (0 == shutdown(_socketHandle, SHUT_WR)); @@ -43,7 +43,7 @@ bool FastOS_UNIX_Socket::SetSoBlocking (bool blockingEnabled) bool rc=false; if (CreateIfNoSocketYet()) { - int flags = fcntl(_socketHandle, F_GETFL, NULL); + int flags = fcntl(_socketHandle, F_GETFL, nullptr); if (flags >= 0) { if (blockingEnabled) { diff --git a/fastos/src/vespa/fastos/unix_thread.cpp b/fastos/src/vespa/fastos/unix_thread.cpp index eca7a472c6d..8ff1913b246 100644 --- a/fastos/src/vespa/fastos/unix_thread.cpp +++ b/fastos/src/vespa/fastos/unix_thread.cpp @@ -11,11 +11,11 @@ namespace { bool FastOS_UNIX_Thread::InitializeClass () { - if (getenv("VESPA_PIN_THREAD_TO_CORE") != NULL) { + if (getenv("VESPA_PIN_THREAD_TO_CORE") != nullptr) { _G_maxNumCpus = std::thread::hardware_concurrency(); fprintf(stderr, "Will pin threads to CPU. Using %ld cores\n", _G_maxNumCpus); - if (getenv("VESPA_MAX_CORES") != NULL) { - size_t maxCores = strtoul(getenv("VESPA_MAX_CORES"), NULL, 0); + if (getenv("VESPA_MAX_CORES") != nullptr) { + size_t maxCores = strtoul(getenv("VESPA_MAX_CORES"), nullptr, 0); fprintf(stderr, "Will limit to %ld", maxCores); if (maxCores < _G_maxNumCpus) { _G_maxNumCpus = maxCores; @@ -76,7 +76,7 @@ FastOS_UNIX_Thread::~FastOS_UNIX_Thread() // Wait for thread library cleanup to complete. if (_handleValid) { - value = NULL; + value = nullptr; pthread_join(_handle, &value); } } diff --git a/fastos/src/vespa/fastos/unix_time.cpp b/fastos/src/vespa/fastos/unix_time.cpp index 4b83dcd60f5..c6251f60d03 100644 --- a/fastos/src/vespa/fastos/unix_time.cpp +++ b/fastos/src/vespa/fastos/unix_time.cpp @@ -99,6 +99,6 @@ FastOS_UNIX_Time::SetSecs(double secs) } void FastOS_UNIX_Time::SetNow() { - gettimeofday(&_time, NULL); + gettimeofday(&_time, nullptr); } -- cgit v1.2.3 From bde6dfaaad25579e202577b7ad9b4fba7685e51e Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 18 Aug 2017 14:46:07 +0200 Subject: Fix up @vekterli's comments. --- fastos/src/vespa/fastos/file.cpp | 5 ----- staging_vespalib/src/vespa/vespalib/util/shutdownguard.cpp | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/fastos/src/vespa/fastos/file.cpp b/fastos/src/vespa/fastos/file.cpp index 42ca432329d..b7da72db420 100644 --- a/fastos/src/vespa/fastos/file.cpp +++ b/fastos/src/vespa/fastos/file.cpp @@ -502,11 +502,6 @@ FastOS_DirectoryScanInterface::FastOS_DirectoryScanInterface(const char *path) { } -/** - * Destructor. - * - * Frees operating system resources related to the directory scan. - */ FastOS_DirectoryScanInterface::~FastOS_DirectoryScanInterface() { free(_searchPath); diff --git a/staging_vespalib/src/vespa/vespalib/util/shutdownguard.cpp b/staging_vespalib/src/vespa/vespalib/util/shutdownguard.cpp index 5d8ec190d59..645ffea380d 100644 --- a/staging_vespalib/src/vespa/vespalib/util/shutdownguard.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/shutdownguard.cpp @@ -11,7 +11,7 @@ namespace vespalib { namespace { enum { STACK_SIZE = (1u << 16) }; -static uint64_t getTimeInMillis() { +uint64_t getTimeInMillis() { struct timeval mytime; gettimeofday(&mytime, 0); uint64_t mult = 1000; -- cgit v1.2.3 From 8721bdaf57d42e397e895c3ee929eb3afda6e0da Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 18 Aug 2017 14:59:54 +0200 Subject: Remove some includes not needed. --- fastos/src/tests/typetest.cpp | 1 + fastos/src/vespa/fastos/file.cpp | 7 ------- fastos/src/vespa/fastos/file.h | 11 +---------- fastos/src/vespa/fastos/linux_file.cpp | 1 - fastos/src/vespa/fastos/linux_file.h | 3 +-- fastos/src/vespa/fastos/unix_file.cpp | 4 ---- 6 files changed, 3 insertions(+), 24 deletions(-) diff --git a/fastos/src/tests/typetest.cpp b/fastos/src/tests/typetest.cpp index 51bda7e5dbc..209af305501 100644 --- a/fastos/src/tests/typetest.cpp +++ b/fastos/src/tests/typetest.cpp @@ -2,6 +2,7 @@ #include "tests.h" #include +#include #include #include diff --git a/fastos/src/vespa/fastos/file.cpp b/fastos/src/vespa/fastos/file.cpp index b7da72db420..5c4d7ce9445 100644 --- a/fastos/src/vespa/fastos/file.cpp +++ b/fastos/src/vespa/fastos/file.cpp @@ -462,13 +462,6 @@ FastOS_FileInterface::OpenWriteOnly(const char *filename) return Open(FASTOS_FILE_OPEN_WRITE, filename); } - -bool -FastOS_FileInterface::OpenStdin() -{ - return Open(FASTOS_FILE_OPEN_STDIN); -} - FastOS_File::Error FastOS_FileInterface::GetLastError() { diff --git a/fastos/src/vespa/fastos/file.h b/fastos/src/vespa/fastos/file.h index 43e10fcd120..a9be683d395 100644 --- a/fastos/src/vespa/fastos/file.h +++ b/fastos/src/vespa/fastos/file.h @@ -10,12 +10,7 @@ #pragma once -#include -#include -#include - -#include - +#include "types.h" #include const int FASTOS_FILE_OPEN_READ = (1<<0); @@ -23,12 +18,10 @@ const int FASTOS_FILE_OPEN_WRITE = (1<<1); const int FASTOS_FILE_OPEN_EXISTING = (1<<2); const int FASTOS_FILE_OPEN_CREATE = (1<<3); const int FASTOS_FILE_OPEN_TRUNCATE = (1<<4); -const int FASTOS_FILE_OPEN_STDIN = (1<<5); // Use 2 bits here const int FASTOS_FILE_OPEN_STDOUT = (2<<5); const int FASTOS_FILE_OPEN_STDERR = (3<<5); const int FASTOS_FILE_OPEN_STDFLAGS = (3<<5); const int FASTOS_FILE_OPEN_DIRECTIO = (1<<7); -const int FASTOS_FILE_OPEN_SHAREREAD = (1<<8); const int FASTOS_FILE_OPEN_SYNCWRITES = (1<<9); // synchronous writes /** @@ -329,8 +322,6 @@ public: */ bool OpenWriteOnly(const char *filename=nullptr); - bool OpenStdin(); - /** * Close the file. The call will successfully do nothing if the file * already is closed. diff --git a/fastos/src/vespa/fastos/linux_file.cpp b/fastos/src/vespa/fastos/linux_file.cpp index 08dc78585ec..6af3bd207a0 100644 --- a/fastos/src/vespa/fastos/linux_file.cpp +++ b/fastos/src/vespa/fastos/linux_file.cpp @@ -14,7 +14,6 @@ const size_t FastOS_Linux_File::_directIOFileAlign = 4096; const size_t FastOS_Linux_File::_directIOMemAlign = 4096; -const size_t FastOS_Linux_File::_pageSize = 4096; FastOS_Linux_File::FastOS_Linux_File(const char *filename) : FastOS_UNIX_File(filename), diff --git a/fastos/src/vespa/fastos/linux_file.h b/fastos/src/vespa/fastos/linux_file.h index d33884c872a..e304b6f0ce8 100644 --- a/fastos/src/vespa/fastos/linux_file.h +++ b/fastos/src/vespa/fastos/linux_file.h @@ -9,7 +9,7 @@ #pragma once -#include +#include "unix_file.h" /** * This is the Linux implementation of @ref FastOS_File. Most @@ -57,5 +57,4 @@ private: static const size_t _directIOFileAlign; static const size_t _directIOMemAlign; - static const size_t _pageSize; }; diff --git a/fastos/src/vespa/fastos/unix_file.cpp b/fastos/src/vespa/fastos/unix_file.cpp index fb3bcab6b53..8b01a5255de 100644 --- a/fastos/src/vespa/fastos/unix_file.cpp +++ b/fastos/src/vespa/fastos/unix_file.cpp @@ -173,10 +173,6 @@ FastOS_UNIX_File::Open(unsigned int openFlags, const char *filename) FILE *file; switch(openFlags & FASTOS_FILE_OPEN_STDFLAGS) { - case FASTOS_FILE_OPEN_STDIN: - file = stdin; - SetFileName("stdin"); - break; case FASTOS_FILE_OPEN_STDOUT: file = stdout; -- cgit v1.2.3 From 2e5456028b6a489cbcd2b07641bb2d171469cf73 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 18 Aug 2017 15:06:42 +0200 Subject: Include what you need. --- searchlib/src/tests/postinglistbm/andstress.cpp | 9 +++++---- searchlib/src/tests/postinglistbm/andstress.h | 19 ++++++------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/searchlib/src/tests/postinglistbm/andstress.cpp b/searchlib/src/tests/postinglistbm/andstress.cpp index 183cec6bbf1..bdf90fb7732 100644 --- a/searchlib/src/tests/postinglistbm/andstress.cpp +++ b/searchlib/src/tests/postinglistbm/andstress.cpp @@ -1,7 +1,5 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -LOG_SETUP(".andstress"); #include "andstress.h" #include @@ -14,14 +12,17 @@ LOG_SETUP(".andstress"); #include #include #include +#include + +#include +LOG_SETUP(".andstress"); using search::fef::TermFieldMatchData; using search::fef::TermFieldMatchDataArray; using search::queryeval::SearchIterator; using namespace search::fakedata; -namespace postinglistbm -{ +namespace postinglistbm { class AndStressWorker; diff --git a/searchlib/src/tests/postinglistbm/andstress.h b/searchlib/src/tests/postinglistbm/andstress.h index b752e602f5d..07e344f3549 100644 --- a/searchlib/src/tests/postinglistbm/andstress.h +++ b/searchlib/src/tests/postinglistbm/andstress.h @@ -1,23 +1,17 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once - #include -namespace search -{ -class Rand48; - -namespace fakedata -{ +#include -class FakeWordSet; +namespace search { +class Rand48; -} +namespace fakedata { class FakeWordSet; } } -namespace postinglistbm -{ +namespace postinglistbm { class AndStress { @@ -39,5 +33,4 @@ public: bool unpack); }; -} // namespace postinglistbm - +} -- cgit v1.2.3 From ed2c63f77550376ffcd062b429d0b180adfc8135 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 18 Aug 2017 15:34:14 +0200 Subject: Use std::this_thread::sleep_for instead of FastOS_Thread::Sleep --- searchcore/src/tests/proton/attribute/attributeflush_test.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp index a37306a3d60..ecb39af61bc 100644 --- a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp +++ b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp @@ -30,6 +30,7 @@ typedef search::attribute::BasicType AVBasicType; typedef search::attribute::CollectionType AVCollectionType; using searchcorespi::IFlushTarget; using searchcorespi::FlushStats; +using namespace std::literals; typedef std::shared_ptr GateSP; @@ -165,7 +166,7 @@ UpdaterTask::run() slowedDown = false; } if (needFlushToken > flushedToken + slowdownUpdateLim) { - FastOS_Thread::Sleep(100); + std::this_thread::sleep_for(100ms); if (!slowedDown) { LOG(warning, "Slowing down updates due to slow flushing (slow disk ?)"); @@ -511,7 +512,7 @@ Test::requireThatLastFlushTimeIsReported() IFlushTarget::SP ft = am.getFlushable("a9"); EXPECT_EQUAL(stat._modifiedTime, ft->getLastFlushTime().time()); { // updated flush time after nothing to flush - FastOS_Thread::Sleep(8000); + std::this_thread::sleep_for(8000ms); fastos::TimeStamp now = fastos::ClockSystem::now(); Executor::Task::UP task = ft->initFlush(200); EXPECT_TRUE(task.get() == NULL); -- cgit v1.2.3 From be621ff4d3124c54fe86577a672f73522fd3323c Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 18 Aug 2017 23:09:43 +0200 Subject: Include what you need. --- configutil/src/lib/modelinspect.cpp | 1 + document/src/tests/bucketselectortest.cpp | 2 +- document/src/tests/fieldsettest.cpp | 6 +- document/src/tests/primitivefieldvaluetest.cpp | 1 + .../serialization/annotationserializer_test.cpp | 1 + document/src/vespa/document/base/idstring.cpp | 1 + document/src/vespa/document/bucket/bucketid.cpp | 1 + .../src/vespa/document/bucket/bucketidfactory.cpp | 6 +- .../src/vespa/document/bucket/bucketselector.cpp | 1 + .../src/vespa/document/fieldvalue/document.cpp | 1 + .../vespa/document/fieldvalue/mapfieldvalue.cpp | 1 + .../document/fieldvalue/serializablearray.cpp | 1 + .../vespa/document/fieldvalue/structfieldvalue.cpp | 1 + documentapi/src/tests/messages/testbase.cpp | 3 +- documentapi/src/tests/priority/priority.cpp | 1 + .../documentapi/messagebus/routablerepository.cpp | 1 + eval/src/vespa/eval/eval/basic_nodes.h | 104 ++++++++++++++++++--- eval/src/vespa/eval/eval/test/eval_spec.cpp | 9 +- eval/src/vespa/eval/eval/value_type.cpp | 7 +- .../eval/tensor/dense/dense_tensor_builder.cpp | 10 +- .../eval/tensor/dense/dense_tensor_reduce.hpp | 9 +- .../src/vespa/eval/tensor/sparse/sparse_tensor.cpp | 8 +- .../sparse_tensor_unsorted_address_builder.cpp | 8 +- eval/src/vespa/eval/tensor/tensor_mapper.cpp | 12 +-- .../src/vespa/memfilepersistence/device/device.cpp | 9 +- .../mapper/locationreadplanner.cpp | 7 +- .../mapper/memfile_v1_verifier.cpp | 1 + .../memfilepersistence/mapper/memfilemapper.cpp | 2 +- .../memfile/memfilecompactor.cpp | 13 +-- metrics/src/vespa/metrics/metric.cpp | 1 + metrics/src/vespa/metrics/metricmanager.cpp | 1 + metrics/src/vespa/metrics/metricset.cpp | 1 + metrics/src/vespa/metrics/summetric.hpp | 4 +- metrics/src/vespa/metrics/valuemetricvalues.h | 1 + .../conformancetest/conformancetest.cpp | 9 +- .../persistence/dummyimpl/dummypersistence.cpp | 1 + .../attribute/persistent_predicate_params.h | 8 +- .../tests/proton/index/diskindexcleaner_test.cpp | 3 +- .../searchcore/fdispatch/search/search_path.h | 1 + .../vespa/searchcore/proton/bucketdb/bucketdb.cpp | 1 + .../documentmetastore/lid_gid_key_comparator.cpp | 1 + .../proton/flushengine/flush_all_strategy.cpp | 1 + .../flushengine/prepare_restart_flush_strategy.cpp | 1 + .../searchcore/proton/matching/handlerecorder.cpp | 8 +- .../proton/persistenceengine/document_iterator.cpp | 1 + .../proton/server/bootstrapconfigmanager.cpp | 4 +- .../searchcore/proton/server/fileconfigmanager.cpp | 9 +- .../searchcore/proton/server/frozenbuckets.cpp | 4 +- .../vespa/searchcore/proton/server/memoryflush.cpp | 1 + .../vespa/searchcore/proton/test/bucketdocuments.h | 11 +-- .../bitcompression/expgolomb/expgolomb_test.cpp | 6 +- .../document_remover/document_remover_test.cpp | 7 +- searchlib/src/vespa/searchlib/btree/btreetraits.h | 12 +-- .../src/vespa/searchlib/common/bitvectorcache.cpp | 1 + .../src/vespa/searchlib/common/indexmetainfo.cpp | 1 + searchlib/src/vespa/searchlib/common/location.cpp | 1 + searchlib/src/vespa/searchlib/common/rankedhit.h | 4 +- .../src/vespa/searchlib/common/tunefileinfo.cpp | 2 +- .../src/vespa/searchlib/common/tunefileinfo.h | 24 +---- .../src/vespa/searchlib/common/tunefileinfo.hpp | 35 +++++++ .../src/vespa/searchlib/datastore/array_store.hpp | 1 + .../src/vespa/searchlib/datastore/buffer_type.cpp | 6 ++ .../src/vespa/searchlib/datastore/buffer_type.h | 8 +- .../vespa/searchlib/datastore/datastorebase.cpp | 1 + .../src/vespa/searchlib/diskindex/wordnummapper.h | 1 + .../src/vespa/searchlib/docstore/storebybucket.cpp | 5 +- .../src/vespa/searchlib/docstore/visitcache.cpp | 1 + .../src/vespa/searchlib/features/array_parser.h | 6 +- .../src/vespa/searchlib/features/array_parser.hpp | 7 +- searchlib/src/vespa/searchlib/features/utils.h | 1 + .../src/vespa/searchlib/fef/indexproperties.cpp | 1 + searchlib/src/vespa/searchlib/fef/rank_program.cpp | 1 + .../src/vespa/searchlib/fef/termfieldmatchdata.cpp | 1 + .../vespa/searchlib/fef/termmatchdatamerger.cpp | 7 +- .../src/vespa/searchlib/index/dictionaryfile.h | 1 + searchlib/src/vespa/searchlib/query/queryterm.cpp | 2 + .../vespa/searchlib/queryeval/predicate_search.cpp | 1 + .../src/vespa/searchlib/queryeval/unpackinfo.cpp | 7 +- searchlib/src/vespa/searchlib/test/initrange.cpp | 5 +- .../src/tests/array/sort_benchmark.cpp | 1 + .../src/tests/distributor/bucketdatabasetest.cpp | 5 +- .../distributor/simplemaintenancescannertest.cpp | 6 +- .../src/tests/persistence/splitbitdetectortest.cpp | 1 + storage/src/vespa/storage/bucketdb/bucketinfo.cpp | 1 + .../operations/idealstate/mergelimiter.cpp | 3 +- .../distributor/operationtargetresolverimpl.h | 7 +- .../frameworkimpl/memory/memorystatusviewer.cpp | 2 +- .../filestorage/modifiedbucketchecker.cpp | 1 + .../src/vespa/storage/persistence/mergehandler.cpp | 3 +- .../storage/persistence/persistencethread.cpp | 1 + .../vespa/storage/storageserver/mergethrottler.cpp | 2 +- .../storage/tools/generatedistributionbits.cpp | 1 + storageapi/src/vespa/storageapi/message/batch.cpp | 1 + .../vespa/storageapi/message/bucketsplitting.cpp | 8 +- .../src/vespa/searchvisitor/hitcollector.cpp | 1 + vdslib/src/vespa/vdslib/container/documentlist.cpp | 1 + .../src/vespa/vdslib/container/documentsummary.cpp | 1 + vdslib/src/vespa/vdslib/container/searchresult.cpp | 1 + vdslib/src/vespa/vdslib/distribution/group.cpp | 1 + vespalib/src/tests/stllike/hash_test.cpp | 1 + vespalib/src/tests/stllike/string_test.cpp | 1 + vespalib/src/vespa/vespalib/util/alloc.h | 8 +- vespalib/src/vespa/vespalib/util/array.h | 7 +- vespalib/src/vespa/vespalib/util/array.hpp | 5 +- vespalib/src/vespa/vespalib/util/compress.h | 11 +-- vespalib/src/vespa/vespalib/websocket/request.cpp | 7 +- 106 files changed, 315 insertions(+), 229 deletions(-) create mode 100644 searchlib/src/vespa/searchlib/common/tunefileinfo.hpp diff --git a/configutil/src/lib/modelinspect.cpp b/configutil/src/lib/modelinspect.cpp index de21a0f4388..bf0536a9d4c 100644 --- a/configutil/src/lib/modelinspect.cpp +++ b/configutil/src/lib/modelinspect.cpp @@ -5,6 +5,7 @@ #include #include #include +#include using configdefinitions::tagsContain; using configdefinitions::upcase; diff --git a/document/src/tests/bucketselectortest.cpp b/document/src/tests/bucketselectortest.cpp index d2a66737d19..0f8520745f1 100644 --- a/document/src/tests/bucketselectortest.cpp +++ b/document/src/tests/bucketselectortest.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include using document::select::Node; using document::select::Parser; diff --git a/document/src/tests/fieldsettest.cpp b/document/src/tests/fieldsettest.cpp index 0599ce723a6..3711ff05535 100644 --- a/document/src/tests/fieldsettest.cpp +++ b/document/src/tests/fieldsettest.cpp @@ -2,17 +2,13 @@ #include #include -#include #include #include -#include -#include #include #include -#include #include -#include +#include using vespalib::nbostream; diff --git a/document/src/tests/primitivefieldvaluetest.cpp b/document/src/tests/primitivefieldvaluetest.cpp index 39abba58e6f..3d74c9e539b 100644 --- a/document/src/tests/primitivefieldvaluetest.cpp +++ b/document/src/tests/primitivefieldvaluetest.cpp @@ -5,6 +5,7 @@ #include #include #include +#include using vespalib::nbostream; diff --git a/document/src/tests/serialization/annotationserializer_test.cpp b/document/src/tests/serialization/annotationserializer_test.cpp index 9f045980f92..317b090c671 100644 --- a/document/src/tests/serialization/annotationserializer_test.cpp +++ b/document/src/tests/serialization/annotationserializer_test.cpp @@ -13,6 +13,7 @@ #include #include #include +#include using document::DocumenttypesConfig; diff --git a/document/src/vespa/document/base/idstring.cpp b/document/src/vespa/document/base/idstring.cpp index 4118ccb88af..9c64ac6a648 100644 --- a/document/src/vespa/document/base/idstring.cpp +++ b/document/src/vespa/document/base/idstring.cpp @@ -5,6 +5,7 @@ #include #include #include +#include using vespalib::string; using vespalib::stringref; diff --git a/document/src/vespa/document/bucket/bucketid.cpp b/document/src/vespa/document/bucket/bucketid.cpp index c9572e43eb4..ddea0d4ba85 100644 --- a/document/src/vespa/document/bucket/bucketid.cpp +++ b/document/src/vespa/document/bucket/bucketid.cpp @@ -7,6 +7,7 @@ #include #include #include +#include using vespalib::nbostream; using vespalib::asciistream; diff --git a/document/src/vespa/document/bucket/bucketidfactory.cpp b/document/src/vespa/document/bucket/bucketidfactory.cpp index fe8acf24e18..0d7ad9da71e 100644 --- a/document/src/vespa/document/bucket/bucketidfactory.cpp +++ b/document/src/vespa/document/bucket/bucketidfactory.cpp @@ -1,11 +1,11 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include - -#include +#include "bucketidfactory.h" +#include "bucketid.h" #include #include #include +#include namespace document { diff --git a/document/src/vespa/document/bucket/bucketselector.cpp b/document/src/vespa/document/bucket/bucketselector.cpp index 5589efa1a5f..5ded691269a 100644 --- a/document/src/vespa/document/bucket/bucketselector.cpp +++ b/document/src/vespa/document/bucket/bucketselector.cpp @@ -9,6 +9,7 @@ #include #include #include +#include namespace document { diff --git a/document/src/vespa/document/fieldvalue/document.cpp b/document/src/vespa/document/fieldvalue/document.cpp index ddb3e66af23..acbb2e800cb 100644 --- a/document/src/vespa/document/fieldvalue/document.cpp +++ b/document/src/vespa/document/fieldvalue/document.cpp @@ -12,6 +12,7 @@ #include #include #include +#include using vespalib::nbostream; using vespalib::make_string; diff --git a/document/src/vespa/document/fieldvalue/mapfieldvalue.cpp b/document/src/vespa/document/fieldvalue/mapfieldvalue.cpp index 081d0325a6e..8e5a641ab6e 100644 --- a/document/src/vespa/document/fieldvalue/mapfieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/mapfieldvalue.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include LOG_SETUP(".document.fieldvalue.map"); diff --git a/document/src/vespa/document/fieldvalue/serializablearray.cpp b/document/src/vespa/document/fieldvalue/serializablearray.cpp index ac1cabc82c0..76216d75f1b 100644 --- a/document/src/vespa/document/fieldvalue/serializablearray.cpp +++ b/document/src/vespa/document/fieldvalue/serializablearray.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include LOG_SETUP(".document.serializable-array"); diff --git a/document/src/vespa/document/fieldvalue/structfieldvalue.cpp b/document/src/vespa/document/fieldvalue/structfieldvalue.cpp index adb6fb9fa4e..c0ae342fd34 100644 --- a/document/src/vespa/document/fieldvalue/structfieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/structfieldvalue.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include LOG_SETUP(".document.structfieldvalue"); diff --git a/documentapi/src/tests/messages/testbase.cpp b/documentapi/src/tests/messages/testbase.cpp index 995fde4aa69..8f2729964a6 100644 --- a/documentapi/src/tests/messages/testbase.cpp +++ b/documentapi/src/tests/messages/testbase.cpp @@ -3,10 +3,11 @@ #include "testbase.h" #include #include -#include #include #include +#include +#include LOG_SETUP(".testbase"); using document::DocumentTypeRepo; diff --git a/documentapi/src/tests/priority/priority.cpp b/documentapi/src/tests/priority/priority.cpp index 1a363dfff31..bc255215813 100644 --- a/documentapi/src/tests/priority/priority.cpp +++ b/documentapi/src/tests/priority/priority.cpp @@ -3,6 +3,7 @@ #include #include #include +#include using namespace documentapi; diff --git a/documentapi/src/vespa/documentapi/messagebus/routablerepository.cpp b/documentapi/src/vespa/documentapi/messagebus/routablerepository.cpp index 03562553fc0..ce83a2cd638 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routablerepository.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/routablerepository.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include LOG_SETUP(".routablerepository"); diff --git a/eval/src/vespa/eval/eval/basic_nodes.h b/eval/src/vespa/eval/eval/basic_nodes.h index 027d6c28d78..c76a43468db 100644 --- a/eval/src/vespa/eval/eval/basic_nodes.h +++ b/eval/src/vespa/eval/eval/basic_nodes.h @@ -9,9 +9,9 @@ #include #include #include +#include -namespace vespalib { -namespace eval { +namespace vespalib::eval { namespace nodes { class Node; } @@ -24,6 +24,7 @@ struct NodeVisitor; **/ struct NodeHandler { virtual void handle(std::unique_ptr node) = 0; + virtual ~NodeHandler() {} }; @@ -35,9 +36,10 @@ namespace nodes { **/ struct DumpContext { const std::vector ¶m_names; - std::vector let_names; + std::vector let_names; + DumpContext(const std::vector ¶m_names_in) - : param_names(param_names_in), let_names() {} + : param_names(param_names_in), let_names() {} }; /** @@ -46,19 +48,32 @@ struct DumpContext { **/ struct Node { virtual bool is_forest() const { return false; } + virtual bool is_tree() const { return false; } + virtual bool is_const() const { return false; } + virtual bool is_param() const { return false; } + virtual double get_const_value() const; + void traverse(NodeTraverser &traverser) const; + virtual vespalib::string dump(DumpContext &ctx) const = 0; + virtual void accept(NodeVisitor &visitor) const = 0; + virtual size_t num_children() const = 0; + virtual const Node &get_child(size_t idx) const = 0; + virtual void detach_children(NodeHandler &handler) = 0; + bool is_leaf() const { return (num_children() == 0); } + virtual ~Node() {} }; + typedef std::unique_ptr Node_UP; /** @@ -70,7 +85,7 @@ typedef std::unique_ptr Node_UP; * } * **/ -template +template const T *as(const Node &node) { return dynamic_cast(&node); } /** @@ -79,9 +94,11 @@ const T *as(const Node &node) { return dynamic_cast(&node); } **/ struct Leaf : public Node { size_t num_children() const override { return 0; } + const Node &get_child(size_t) const override { abort(); } + void detach_children(NodeHandler &) override {} }; @@ -91,7 +108,9 @@ struct Leaf : public Node { **/ struct CommaTracker { bool first; + CommaTracker() : first(true) {} + void maybe_comma(vespalib::string &dst) { if (first) { first = false; @@ -106,12 +125,17 @@ private: double _value; public: Number(double value_in) : _value(value_in) {} + virtual bool is_const() const override { return true; } + virtual double get_const_value() const override { return value(); } + double value() const { return _value; } + vespalib::string dump(DumpContext &) const override { return make_string("%g", _value); } + void accept(NodeVisitor &visitor) const override; }; @@ -120,11 +144,15 @@ private: int _id; public: static const int UNDEF = std::numeric_limits::max(); + explicit Symbol(int id_in) : _id(id_in) {} + int id() const { return _id; } + bool is_param() const override { return (_id >= 0); } + vespalib::string dump(DumpContext &ctx) const override { if (_id >= 0) { // param value assert(size_t(_id) < ctx.param_names.size()); @@ -135,6 +163,7 @@ public: return ctx.let_names[let_offset]; } } + void accept(NodeVisitor &visitor) const override; }; @@ -143,11 +172,17 @@ private: vespalib::string _value; public: String(const vespalib::string &value_in) : _value(value_in) {} + bool is_const() const override { return true; } + double get_const_value() const override { return hash(); } + const vespalib::string value() const { return _value; } + uint32_t hash() const { return hash_code(_value.data(), _value.size()); } + vespalib::string dump(DumpContext &ctx) const override; + void accept(NodeVisitor &visitor) const override; }; @@ -157,17 +192,24 @@ private: bool _is_const; public: Array() : _nodes(), _is_const(false) {} + bool is_const() const override { return _is_const; } + size_t size() const { return _nodes.size(); } + const Node &get(size_t i) const { return *_nodes[i]; } + size_t num_children() const override { return size(); } + const Node &get_child(size_t idx) const override { return get(idx); } + void detach_children(NodeHandler &handler) override { for (size_t i = 0; i < _nodes.size(); ++i) { handler.handle(std::move(_nodes[i])); } _nodes.clear(); } + void add(Node_UP node) { if (_nodes.empty()) { _is_const = node->is_const(); @@ -176,6 +218,7 @@ public: } _nodes.push_back(std::move(node)); } + vespalib::string dump(DumpContext &ctx) const override { vespalib::string str; str += "["; @@ -187,6 +230,7 @@ public: str += "]"; return str; } + void accept(NodeVisitor &visitor) const override; }; @@ -196,17 +240,23 @@ private: bool _is_const; public: Neg(Node_UP child_in) : _child(std::move(child_in)), _is_const(_child->is_const()) {} + bool is_const() const override { return _is_const; } + const Node &child() const { return *_child; } + size_t num_children() const override { return _child ? 1 : 0; } + const Node &get_child(size_t idx) const override { (void) idx; assert(idx == 0); return child(); } + void detach_children(NodeHandler &handler) override { handler.handle(std::move(_child)); } + vespalib::string dump(DumpContext &ctx) const override { vespalib::string str; str += "(-"; @@ -214,6 +264,7 @@ public: str += ")"; return str; } + void accept(NodeVisitor &visitor) const override; }; @@ -223,17 +274,23 @@ private: bool _is_const; public: Not(Node_UP child_in) : _child(std::move(child_in)), _is_const(_child->is_const()) {} + bool is_const() const override { return _is_const; } + const Node &child() const { return *_child; } + size_t num_children() const override { return _child ? 1 : 0; } + const Node &get_child(size_t idx) const override { (void) idx; assert(idx == 0); return child(); } + void detach_children(NodeHandler &handler) override { handler.handle(std::move(_child)); } + vespalib::string dump(DumpContext &ctx) const override { vespalib::string str; str += "(!"; @@ -241,6 +298,7 @@ public: str += ")"; return str; } + void accept(NodeVisitor &visitor) const override; }; @@ -249,18 +307,25 @@ private: Node_UP _cond; Node_UP _true_expr; Node_UP _false_expr; - double _p_true; - bool _is_tree; + double _p_true; + bool _is_tree; public: If(Node_UP cond_in, Node_UP true_expr_in, Node_UP false_expr_in, double p_true_in); + const Node &cond() const { return *_cond; } + const Node &true_expr() const { return *_true_expr; } + const Node &false_expr() const { return *_false_expr; } + double p_true() const { return _p_true; } + bool is_tree() const override { return _is_tree; } + size_t num_children() const override { return (_cond && _true_expr && _false_expr) ? 3 : 0; } + const Node &get_child(size_t idx) const override { assert(idx < 3); if (idx == 0) { @@ -271,11 +336,13 @@ public: return false_expr(); } } + void detach_children(NodeHandler &handler) override { handler.handle(std::move(_cond)); handler.handle(std::move(_true_expr)); handler.handle(std::move(_false_expr)); } + vespalib::string dump(DumpContext &ctx) const override { vespalib::string str; str += "if("; @@ -290,29 +357,37 @@ public: str += ")"; return str; } + void accept(NodeVisitor &visitor) const override; }; class Let : public Node { private: vespalib::string _name; - Node_UP _value; - Node_UP _expr; + Node_UP _value; + Node_UP _expr; public: Let(const vespalib::string &name_in, Node_UP value_in, Node_UP expr_in) - : _name(name_in), _value(std::move(value_in)), _expr(std::move(expr_in)) {} + : _name(name_in), _value(std::move(value_in)), _expr(std::move(expr_in)) {} + const vespalib::string &name() const { return _name; } + const Node &value() const { return *_value; } + const Node &expr() const { return *_expr; } + size_t num_children() const override { return (_value && _expr) ? 2 : 0; } + const Node &get_child(size_t idx) const override { assert(idx < 2); return (idx == 0) ? value() : expr(); } + void detach_children(NodeHandler &handler) override { handler.handle(std::move(_value)); handler.handle(std::move(_expr)); } + vespalib::string dump(DumpContext &ctx) const override { vespalib::string str; str += "let("; @@ -326,6 +401,7 @@ public: str += ")"; return str; } + void accept(NodeVisitor &visitor) const override; }; @@ -334,11 +410,13 @@ private: vespalib::string _message; public: Error(const vespalib::string &message_in) : _message(message_in) {} + const vespalib::string &message() const { return _message; } + vespalib::string dump(DumpContext &) const override { return _message; } + void accept(NodeVisitor &visitor) const override; }; -} // namespace vespalib::eval::nodes -} // namespace vespalib::eval -} // namespace vespalib +} +} diff --git a/eval/src/vespa/eval/eval/test/eval_spec.cpp b/eval/src/vespa/eval/eval/test/eval_spec.cpp index c4f349c614e..f9c36c9eb93 100644 --- a/eval/src/vespa/eval/eval/test/eval_spec.cpp +++ b/eval/src/vespa/eval/eval/test/eval_spec.cpp @@ -4,10 +4,9 @@ #include #include #include +#include -namespace vespalib { -namespace eval { -namespace test { +namespace vespalib::eval::test { constexpr double my_nan = std::numeric_limits::quiet_NaN(); constexpr double my_inf = std::numeric_limits::infinity(); @@ -414,6 +413,4 @@ EvalSpec::add_complex_cases() { [](double a)->double{ return -double(!bool(a)); }); } -} // namespace vespalib::eval::test -} // namespace vespalib::eval -} // namespace vespalib +} diff --git a/eval/src/vespa/eval/eval/value_type.cpp b/eval/src/vespa/eval/eval/value_type.cpp index 1553c6e064e..03e6d2bbcdf 100644 --- a/eval/src/vespa/eval/eval/value_type.cpp +++ b/eval/src/vespa/eval/eval/value_type.cpp @@ -2,9 +2,9 @@ #include "value_type.h" #include "value_type_spec.h" +#include -namespace vespalib { -namespace eval { +namespace vespalib::eval { namespace { @@ -270,5 +270,4 @@ operator<<(std::ostream &os, const ValueType &type) { return os << type.to_spec(); } -} // namespace vespalib::eval -} // namespace vespalib +} diff --git a/eval/src/vespa/eval/tensor/dense/dense_tensor_builder.cpp b/eval/src/vespa/eval/tensor/dense/dense_tensor_builder.cpp index caf42c9ae60..0b66dd51206 100644 --- a/eval/src/vespa/eval/tensor/dense/dense_tensor_builder.cpp +++ b/eval/src/vespa/eval/tensor/dense/dense_tensor_builder.cpp @@ -2,14 +2,15 @@ #include "dense_tensor_builder.h" #include -#include #include +#include +#include + using vespalib::IllegalArgumentException; using vespalib::make_string; -namespace vespalib { -namespace tensor { +namespace vespalib::tensor { namespace { @@ -169,5 +170,4 @@ DenseTensorBuilder::build() return result; } -} // namespace vespalib::tensor -} // namespace vespalib +} diff --git a/eval/src/vespa/eval/tensor/dense/dense_tensor_reduce.hpp b/eval/src/vespa/eval/tensor/dense/dense_tensor_reduce.hpp index 24e12f83b24..c6fc04bb27b 100644 --- a/eval/src/vespa/eval/tensor/dense/dense_tensor_reduce.hpp +++ b/eval/src/vespa/eval/tensor/dense/dense_tensor_reduce.hpp @@ -2,10 +2,9 @@ #include "dense_tensor_reduce.h" #include +#include -namespace vespalib { -namespace tensor { -namespace dense { +namespace vespalib::tensor::dense { using Cells = DenseTensorView::Cells; using CellsRef = DenseTensorView::CellsRef; @@ -120,6 +119,4 @@ reduce(const DenseTensorView &tensor, const std::vector &dimen } } -} // namespace dense -} // namespace tensor -} // namespace vespalib +} diff --git a/eval/src/vespa/eval/tensor/sparse/sparse_tensor.cpp b/eval/src/vespa/eval/tensor/sparse/sparse_tensor.cpp index 4a6cb4dedd5..92f0b40e259 100644 --- a/eval/src/vespa/eval/tensor/sparse/sparse_tensor.cpp +++ b/eval/src/vespa/eval/tensor/sparse/sparse_tensor.cpp @@ -13,11 +13,11 @@ #include #include #include +#include using vespalib::eval::TensorSpec; -namespace vespalib { -namespace tensor { +namespace vespalib::tensor { namespace { @@ -307,8 +307,6 @@ SparseTensor::reduce(const eval::BinaryOperation &op, { return op.eval(lhsValue, rhsValue); }); } -} // namespace vespalib::tensor - -} // namespace vespalib +} VESPALIB_HASH_MAP_INSTANTIATE(vespalib::tensor::SparseTensorAddressRef, double); diff --git a/eval/src/vespa/eval/tensor/sparse/sparse_tensor_unsorted_address_builder.cpp b/eval/src/vespa/eval/tensor/sparse/sparse_tensor_unsorted_address_builder.cpp index 1ca32aad6be..1e112cbaa6e 100644 --- a/eval/src/vespa/eval/tensor/sparse/sparse_tensor_unsorted_address_builder.cpp +++ b/eval/src/vespa/eval/tensor/sparse/sparse_tensor_unsorted_address_builder.cpp @@ -4,9 +4,9 @@ #include "sparse_tensor_address_builder.h" #include #include +#include -namespace vespalib { -namespace tensor { +namespace vespalib::tensor { SparseTensorUnsortedAddressBuilder::SparseTensorUnsortedAddressBuilder() : _elementStrings(), @@ -46,6 +46,4 @@ SparseTensorUnsortedAddressBuilder::buildTo(SparseTensorAddressBuilder & } } - -} // namespace vespalib::tensor -} // namespace vespalib +} diff --git a/eval/src/vespa/eval/tensor/tensor_mapper.cpp b/eval/src/vespa/eval/tensor/tensor_mapper.cpp index c15494ed7fe..7c2c72abd46 100644 --- a/eval/src/vespa/eval/tensor/tensor_mapper.cpp +++ b/eval/src/vespa/eval/tensor/tensor_mapper.cpp @@ -3,18 +3,17 @@ #include "tensor_mapper.h" #include "tensor.h" #include "tensor_visitor.h" -#include -#include -#include #include "tensor_address_element_iterator.h" #include "default_tensor.h" #include "wrapped_simple_tensor.h" +#include +#include +#include using vespalib::eval::ValueType; using vespalib::eval::TensorSpec; -namespace vespalib { -namespace tensor { +namespace vespalib::tensor { namespace { @@ -422,5 +421,4 @@ std::unique_ptr TensorMapper::mapToSparse(const Tensor &tensor, const ValueType &type); -} // namespace vespalib::tensor -} // namespace vespalib +} diff --git a/memfilepersistence/src/vespa/memfilepersistence/device/device.cpp b/memfilepersistence/src/vespa/memfilepersistence/device/device.cpp index 50286b4c033..cd1fcafb52c 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/device/device.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/device/device.cpp @@ -2,10 +2,9 @@ #include "device.h" #include "ioevent.h" #include +#include -namespace storage { - -namespace memfile { +namespace storage::memfile { Device::Device(DeviceManager& manager) : _manager(manager) @@ -54,6 +53,4 @@ Device::clearEvents() _events.clear(); } -} // memfile - -} // storage +} diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/locationreadplanner.cpp b/memfilepersistence/src/vespa/memfilepersistence/mapper/locationreadplanner.cpp index 46964d9058d..381e5d17766 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/locationreadplanner.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/locationreadplanner.cpp @@ -2,9 +2,9 @@ #include "locationreadplanner.h" #include +#include -namespace storage { -namespace memfile { +namespace storage::memfile { LocationDiskIoPlanner::LocationDiskIoPlanner( const MemFileIOInterface& io, @@ -97,5 +97,4 @@ LocationDiskIoPlanner::print(std::ostream& out, bool verbose, } } -} // memfile -} // storage +} diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_verifier.cpp b/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_verifier.cpp index be1793ca355..39eb68315d2 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_verifier.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_verifier.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include LOG_SETUP(".persistence.memfilev1.verifier"); diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/memfilemapper.cpp b/memfilepersistence/src/vespa/memfilepersistence/mapper/memfilemapper.cpp index 6bf2821d7a9..71d6a6b6fcf 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/memfilemapper.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/memfilemapper.cpp @@ -1,6 +1,5 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - #include "memfilemapper.h" #include "memfile_v1_serializer.h" #include @@ -8,6 +7,7 @@ #include #include #include +#include #include LOG_SETUP(".persistence.memfile.mapper"); diff --git a/memfilepersistence/src/vespa/memfilepersistence/memfile/memfilecompactor.cpp b/memfilepersistence/src/vespa/memfilepersistence/memfile/memfilecompactor.cpp index 3ee3b5fca09..7d84fd3dde5 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/memfile/memfilecompactor.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/memfile/memfilecompactor.cpp @@ -3,12 +3,12 @@ #include "memfilecompactor.h" #include "memfile.h" #include -#include +#include +#include LOG_SETUP(".persistence.memfile.compactor"); -namespace storage { -namespace memfile { +namespace storage::memfile { struct DocumentVersionInfo { document::DocumentId _id; @@ -71,8 +71,7 @@ struct CompactSlotInfo : private Types { auto matchesId = [&](const DocumentVersionInfo& doc) { return (id == doc._id); }; - auto existing = std::find_if( - gidDocs.begin(), gidDocs.end(), matchesId); + auto existing = std::find_if(gidDocs.begin(), gidDocs.end(), matchesId); if (existing == gidDocs.end()) { // (Very) common case gidDocs.emplace_back(id, isTombstone(slot)); @@ -202,6 +201,4 @@ MemFileCompactor::alwaysCompact(const MemSlot& slot, slotsToRemove.push_back(&slot); } - -} // memfile -} // storage +} diff --git a/metrics/src/vespa/metrics/metric.cpp b/metrics/src/vespa/metrics/metric.cpp index 5f39fccab07..f6be5f79357 100644 --- a/metrics/src/vespa/metrics/metric.cpp +++ b/metrics/src/vespa/metrics/metric.cpp @@ -11,6 +11,7 @@ #include #include #include +#include namespace metrics { diff --git a/metrics/src/vespa/metrics/metricmanager.cpp b/metrics/src/vespa/metrics/metricmanager.cpp index c1bcc126623..5530e468007 100644 --- a/metrics/src/vespa/metrics/metricmanager.cpp +++ b/metrics/src/vespa/metrics/metricmanager.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include LOG_SETUP(".metrics.manager"); diff --git a/metrics/src/vespa/metrics/metricset.cpp b/metrics/src/vespa/metrics/metricset.cpp index af6d9c43d08..6ac27ba38c9 100644 --- a/metrics/src/vespa/metrics/metricset.cpp +++ b/metrics/src/vespa/metrics/metricset.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include LOG_SETUP(".metrics.metricsset"); diff --git a/metrics/src/vespa/metrics/summetric.hpp b/metrics/src/vespa/metrics/summetric.hpp index 01e4f5c5dfe..761b369fb57 100644 --- a/metrics/src/vespa/metrics/summetric.hpp +++ b/metrics/src/vespa/metrics/summetric.hpp @@ -8,6 +8,7 @@ #include #include #include +#include namespace metrics { @@ -217,8 +218,7 @@ template void SumMetric::removeMetricFromSum(const AddendMetric &metric) { - _metricsToSum.erase(remove(_metricsToSum.begin(), _metricsToSum.end(), - &metric)); + _metricsToSum.erase(std::remove(_metricsToSum.begin(), _metricsToSum.end(), &metric)); } template diff --git a/metrics/src/vespa/metrics/valuemetricvalues.h b/metrics/src/vespa/metrics/valuemetricvalues.h index 6422ab1b263..391b9c9d588 100644 --- a/metrics/src/vespa/metrics/valuemetricvalues.h +++ b/metrics/src/vespa/metrics/valuemetricvalues.h @@ -14,6 +14,7 @@ #pragma once #include "metricvalueset.h" +#include namespace metrics { diff --git a/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp b/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp index e6d21a83c01..a0176fe88f2 100644 --- a/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp +++ b/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp @@ -12,11 +12,12 @@ #include #include #include +#include +#include using document::BucketId; -namespace storage { -namespace spi { +namespace storage::spi { namespace { @@ -2306,6 +2307,4 @@ void ConformanceTest::detectAndTestOptionalBehavior() { } -} // spi -} // storage - +} diff --git a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp index 8977b505740..489af79d595 100644 --- a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp +++ b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp @@ -10,6 +10,7 @@ #include #include #include +#include using std::binary_search; using std::lower_bound; diff --git a/searchcommon/src/vespa/searchcommon/attribute/persistent_predicate_params.h b/searchcommon/src/vespa/searchcommon/attribute/persistent_predicate_params.h index 96a4e0aa62e..baa341e8d15 100644 --- a/searchcommon/src/vespa/searchcommon/attribute/persistent_predicate_params.h +++ b/searchcommon/src/vespa/searchcommon/attribute/persistent_predicate_params.h @@ -2,8 +2,9 @@ #pragma once -namespace search { -namespace attribute { +#include + +namespace search::attribute { /* * Persistent parameters for predicate attributes. @@ -33,5 +34,4 @@ public: } }; -} // namespace attribute -} // namespace search +} diff --git a/searchcore/src/tests/proton/index/diskindexcleaner_test.cpp b/searchcore/src/tests/proton/index/diskindexcleaner_test.cpp index 707b37eb3de..86f120aa403 100644 --- a/searchcore/src/tests/proton/index/diskindexcleaner_test.cpp +++ b/searchcore/src/tests/proton/index/diskindexcleaner_test.cpp @@ -5,8 +5,7 @@ #include #include #include -#include -#include +#include #include LOG_SETUP("diskindexcleaner_test"); diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/search_path.h b/searchcore/src/vespa/searchcore/fdispatch/search/search_path.h index 5984827459f..847fb525b95 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/search/search_path.h +++ b/searchcore/src/vespa/searchcore/fdispatch/search/search_path.h @@ -5,6 +5,7 @@ #include #include #include +#include namespace vespalib { class asciistream; diff --git a/searchcore/src/vespa/searchcore/proton/bucketdb/bucketdb.cpp b/searchcore/src/vespa/searchcore/proton/bucketdb/bucketdb.cpp index 73eefe620c2..06aca3381f7 100644 --- a/searchcore/src/vespa/searchcore/proton/bucketdb/bucketdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/bucketdb/bucketdb.cpp @@ -2,6 +2,7 @@ #include "bucketdb.h" #include +#include using document::GlobalId; using storage::spi::BucketChecksum; diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_gid_key_comparator.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_gid_key_comparator.cpp index 3b0ff6d5616..0dae1818e02 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_gid_key_comparator.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_gid_key_comparator.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "lid_gid_key_comparator.h" +#include namespace proton::documentmetastore { diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flush_all_strategy.cpp b/searchcore/src/vespa/searchcore/proton/flushengine/flush_all_strategy.cpp index 39c0c2bd0e0..914b301b7e2 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flush_all_strategy.cpp +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flush_all_strategy.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "flush_all_strategy.h" +#include using search::SerialNum; using searchcorespi::IFlushTarget; diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/prepare_restart_flush_strategy.cpp b/searchcore/src/vespa/searchcore/proton/flushengine/prepare_restart_flush_strategy.cpp index 2fd2b74eaa2..e9df78dbf4f 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/prepare_restart_flush_strategy.cpp +++ b/searchcore/src/vespa/searchcore/proton/flushengine/prepare_restart_flush_strategy.cpp @@ -4,6 +4,7 @@ #include "flush_target_candidates.h" #include "tls_stats_map.h" #include +#include #include LOG_SETUP(".proton.flushengine.prepare_restart_flush_strategy"); diff --git a/searchcore/src/vespa/searchcore/proton/matching/handlerecorder.cpp b/searchcore/src/vespa/searchcore/proton/matching/handlerecorder.cpp index 69da8d5bfed..3573c7ec7b8 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/handlerecorder.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/handlerecorder.cpp @@ -3,12 +3,11 @@ #include "handlerecorder.h" #include #include - +#include using search::fef::TermFieldHandle; -namespace proton { -namespace matching { +namespace proton::matching { #ifdef __PIC__ #define TLS_LINKAGE __attribute__((visibility("hidden"), tls_model("initial-exec"))) @@ -79,5 +78,4 @@ void HandleRecorder::registerHandle(TermFieldHandle handle) } } -} // namespace matching -} // namespace proton +} diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/document_iterator.cpp b/searchcore/src/vespa/searchcore/proton/persistenceengine/document_iterator.cpp index 8260c0209a9..0ef3b0e2aab 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/document_iterator.cpp +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/document_iterator.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include LOG_SETUP(".proton.persistenceengine.document_iterator"); diff --git a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp index 28fee79005a..cc399727460 100644 --- a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp @@ -2,6 +2,7 @@ #include "bootstrapconfigmanager.h" #include "bootstrapconfig.h" +#include #include LOG_SETUP(".proton.server.bootstrapconfigmanager"); @@ -14,8 +15,7 @@ using vespa::config::search::core::ProtonConfig; using cloud::config::filedistribution::FiledistributorrpcConfig; using document::DocumenttypesConfig; -namespace proton -{ +namespace proton { BootstrapConfigManager::BootstrapConfigManager(const vespalib::string & configId) : _pendingConfigSnapshot(), diff --git a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp index 17b41295a89..2bd2cb1eda1 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include LOG_SETUP(".proton.server.fileconfigmanager"); @@ -60,15 +61,11 @@ fsyncFile(const vespalib::string &fileName) FastOS_File f; f.OpenReadWrite(fileName.c_str()); if (!f.IsOpened()) { - LOG(error, - "Could not open file '%s' for fsync", - fileName.c_str()); + LOG(error, "Could not open file '%s' for fsync", fileName.c_str()); return; } if (!f.Sync()) { - LOG(error, - "Could not fsync file '%s'", - fileName.c_str()); + LOG(error, "Could not fsync file '%s'", fileName.c_str()); } f.Close(); } diff --git a/searchcore/src/vespa/searchcore/proton/server/frozenbuckets.cpp b/searchcore/src/vespa/searchcore/proton/server/frozenbuckets.cpp index ada3dd92656..c021d786216 100644 --- a/searchcore/src/vespa/searchcore/proton/server/frozenbuckets.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/frozenbuckets.cpp @@ -4,14 +4,14 @@ #include "ibucketfreezelistener.h" #include #include +#include using document::BucketId; using vespalib::makeClosure; using vespalib::makeTask; using vespalib::MonitorGuard; -namespace proton -{ +namespace proton { FrozenBucketsMap::FrozenBucketsMap() : _lock(), diff --git a/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp b/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp index 4dd44a7b2e2..2d56c7e37e9 100644 --- a/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include LOG_SETUP(".proton.server.memoryflush"); diff --git a/searchcore/src/vespa/searchcore/proton/test/bucketdocuments.h b/searchcore/src/vespa/searchcore/proton/test/bucketdocuments.h index 021d0f631d4..ce27cc7673b 100644 --- a/searchcore/src/vespa/searchcore/proton/test/bucketdocuments.h +++ b/searchcore/src/vespa/searchcore/proton/test/bucketdocuments.h @@ -3,10 +3,9 @@ #include "document.h" #include +#include -namespace proton { - -namespace test { +namespace proton::test { /** * Collection of documents contained in the same bucket. @@ -40,8 +39,4 @@ public: } }; - -} // namespace test - -} // namespace proton - +} diff --git a/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp b/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp index c6045208a1f..185b36ec414 100644 --- a/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp +++ b/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp @@ -1,10 +1,12 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -LOG_SETUP("expglomb_test"); #include #include #include +#include + +#include +LOG_SETUP("expglomb_test"); using search::bitcompression::DecodeContext64; using search::bitcompression::DecodeContext64Base; diff --git a/searchlib/src/tests/memoryindex/document_remover/document_remover_test.cpp b/searchlib/src/tests/memoryindex/document_remover/document_remover_test.cpp index 4938d40a21f..6f09dd5c924 100644 --- a/searchlib/src/tests/memoryindex/document_remover/document_remover_test.cpp +++ b/searchlib/src/tests/memoryindex/document_remover/document_remover_test.cpp @@ -1,14 +1,15 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -LOG_SETUP("document_remover_test"); #include #include #include #include #include -#include +#include + +#include +LOG_SETUP("document_remover_test"); using namespace search; using namespace search::memoryindex; diff --git a/searchlib/src/vespa/searchlib/btree/btreetraits.h b/searchlib/src/vespa/searchlib/btree/btreetraits.h index aaeb2b28021..efa7cb4de34 100644 --- a/searchlib/src/vespa/searchlib/btree/btreetraits.h +++ b/searchlib/src/vespa/searchlib/btree/btreetraits.h @@ -2,13 +2,9 @@ #pragma once -#include +#include -namespace search -{ - -namespace btree -{ +namespace search::btree { template struct BTreeTraits { @@ -20,6 +16,4 @@ struct BTreeTraits { typedef BTreeTraits<16, 16, 10, true> BTreeDefaultTraits; -} // namespace search::btree -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/common/bitvectorcache.cpp b/searchlib/src/vespa/searchlib/common/bitvectorcache.cpp index 7d5aa8beeae..04909da8ea7 100644 --- a/searchlib/src/vespa/searchlib/common/bitvectorcache.cpp +++ b/searchlib/src/vespa/searchlib/common/bitvectorcache.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "bitvectorcache.h" #include +#include #include LOG_SETUP(".searchlib.common.bitvectorcache"); diff --git a/searchlib/src/vespa/searchlib/common/indexmetainfo.cpp b/searchlib/src/vespa/searchlib/common/indexmetainfo.cpp index f3697086147..10015bb658a 100644 --- a/searchlib/src/vespa/searchlib/common/indexmetainfo.cpp +++ b/searchlib/src/vespa/searchlib/common/indexmetainfo.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include LOG_SETUP(".indexmetainfo"); diff --git a/searchlib/src/vespa/searchlib/common/location.cpp b/searchlib/src/vespa/searchlib/common/location.cpp index 31af111b2bf..cda3973b311 100644 --- a/searchlib/src/vespa/searchlib/common/location.cpp +++ b/searchlib/src/vespa/searchlib/common/location.cpp @@ -3,6 +3,7 @@ // Copyright (C) 2003 Overture Services Norway AS #include "location.h" +#include namespace search::common { diff --git a/searchlib/src/vespa/searchlib/common/rankedhit.h b/searchlib/src/vespa/searchlib/common/rankedhit.h index d1feb5e3282..bd66f884a08 100644 --- a/searchlib/src/vespa/searchlib/common/rankedhit.h +++ b/searchlib/src/vespa/searchlib/common/rankedhit.h @@ -5,8 +5,8 @@ #pragma once #include "hitrank.h" -#include -#include +#include +#include namespace search { diff --git a/searchlib/src/vespa/searchlib/common/tunefileinfo.cpp b/searchlib/src/vespa/searchlib/common/tunefileinfo.cpp index 2bf2fc751d3..f8325c3cd7d 100644 --- a/searchlib/src/vespa/searchlib/common/tunefileinfo.cpp +++ b/searchlib/src/vespa/searchlib/common/tunefileinfo.cpp @@ -1,6 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include "tunefileinfo.h" +#include "tunefileinfo.hpp" namespace search { diff --git a/searchlib/src/vespa/searchlib/common/tunefileinfo.h b/searchlib/src/vespa/searchlib/common/tunefileinfo.h index 2dd27142dc6..223dcdbc7f1 100644 --- a/searchlib/src/vespa/searchlib/common/tunefileinfo.h +++ b/searchlib/src/vespa/searchlib/common/tunefileinfo.h @@ -2,9 +2,6 @@ #pragma once -#include -#include -#include #include namespace search { @@ -123,26 +120,7 @@ public: template void - setFromConfig(const enum TuneControlConfig::Io & tuneControlConfig, const MMapConfig & mmapFlags) { - switch ( tuneControlConfig) { - case TuneControlConfig::NORMAL: _tuneControl = NORMAL; break; - case TuneControlConfig::DIRECTIO: _tuneControl = DIRECTIO; break; - case TuneControlConfig::MMAP: _tuneControl = MMAP; break; - default: _tuneControl = NORMAL; break; - } - for (size_t i(0), m(mmapFlags.options.size()); i < m; i++) { - switch (mmapFlags.options[i]) { - case MMapConfig::MLOCK: _mmapFlags |= MAP_LOCKED; break; - case MMapConfig::POPULATE: _mmapFlags |= MAP_POPULATE; break; - case MMapConfig::HUGETLB: _mmapFlags |= MAP_HUGETLB; break; - } - } - switch (mmapFlags.advise) { - case MMapConfig::NORMAL: setAdvise(POSIX_FADV_NORMAL); break; - case MMapConfig::RANDOM: setAdvise(POSIX_FADV_RANDOM); break; - case MMapConfig::SEQUENTIAL: setAdvise(POSIX_FADV_SEQUENTIAL); break; - } - } + setFromConfig(const enum TuneControlConfig::Io & tuneControlConfig, const MMapConfig & mmapFlags); bool operator==(const TuneFileRandRead &rhs) const { return (_tuneControl == rhs._tuneControl) && (_mmapFlags == rhs._mmapFlags); diff --git a/searchlib/src/vespa/searchlib/common/tunefileinfo.hpp b/searchlib/src/vespa/searchlib/common/tunefileinfo.hpp new file mode 100644 index 00000000000..22d89d904d2 --- /dev/null +++ b/searchlib/src/vespa/searchlib/common/tunefileinfo.hpp @@ -0,0 +1,35 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +#include "tunefileinfo.h" +#include +#include + +namespace search { + +template +void +TuneFileRandRead::setFromConfig(const enum TuneControlConfig::Io & tuneControlConfig, const MMapConfig & mmapFlags) { + switch ( tuneControlConfig) { + case TuneControlConfig::NORMAL: _tuneControl = NORMAL; break; + case TuneControlConfig::DIRECTIO: _tuneControl = DIRECTIO; break; + case TuneControlConfig::MMAP: _tuneControl = MMAP; break; + default: _tuneControl = NORMAL; break; + } + for (size_t i(0), m(mmapFlags.options.size()); i < m; i++) { + switch (mmapFlags.options[i]) { + case MMapConfig::MLOCK: _mmapFlags |= MAP_LOCKED; break; + case MMapConfig::POPULATE: _mmapFlags |= MAP_POPULATE; break; + case MMapConfig::HUGETLB: _mmapFlags |= MAP_HUGETLB; break; + } + } + switch (mmapFlags.advise) { + case MMapConfig::NORMAL: setAdvise(POSIX_FADV_NORMAL); break; + case MMapConfig::RANDOM: setAdvise(POSIX_FADV_RANDOM); break; + case MMapConfig::SEQUENTIAL: setAdvise(POSIX_FADV_SEQUENTIAL); break; + } +} + +} + diff --git a/searchlib/src/vespa/searchlib/datastore/array_store.hpp b/searchlib/src/vespa/searchlib/datastore/array_store.hpp index 8478c22903f..cd45df90899 100644 --- a/searchlib/src/vespa/searchlib/datastore/array_store.hpp +++ b/searchlib/src/vespa/searchlib/datastore/array_store.hpp @@ -5,6 +5,7 @@ #include "array_store.h" #include "datastore.hpp" #include +#include namespace search::datastore { diff --git a/searchlib/src/vespa/searchlib/datastore/buffer_type.cpp b/searchlib/src/vespa/searchlib/datastore/buffer_type.cpp index 5eca3719002..6e77b267818 100644 --- a/searchlib/src/vespa/searchlib/datastore/buffer_type.cpp +++ b/searchlib/src/vespa/searchlib/datastore/buffer_type.cpp @@ -2,9 +2,15 @@ #include "buffer_type.h" #include +#include namespace search::datastore { +void +BufferTypeBase::CleanContext::extraBytesCleaned(uint64_t value) { + assert(_extraBytes >= value); + _extraBytes -= value; +} BufferTypeBase::BufferTypeBase(uint32_t clusterSize, uint32_t minClusters, uint32_t maxClusters, diff --git a/searchlib/src/vespa/searchlib/datastore/buffer_type.h b/searchlib/src/vespa/searchlib/datastore/buffer_type.h index 92dcbcc9e8d..6fc5c4ab288 100644 --- a/searchlib/src/vespa/searchlib/datastore/buffer_type.h +++ b/searchlib/src/vespa/searchlib/datastore/buffer_type.h @@ -2,9 +2,8 @@ #pragma once -#include #include -#include +#include namespace search::datastore { @@ -33,10 +32,7 @@ public: uint64_t &_extraBytes; public: CleanContext(uint64_t &extraBytes) : _extraBytes(extraBytes) {} - void extraBytesCleaned(uint64_t value) { - assert(_extraBytes >= value); - _extraBytes -= value; - } + void extraBytesCleaned(uint64_t value); }; BufferTypeBase(const BufferTypeBase &rhs) = delete; diff --git a/searchlib/src/vespa/searchlib/datastore/datastorebase.cpp b/searchlib/src/vespa/searchlib/datastore/datastorebase.cpp index d344c79d50e..ba0c8e05d77 100644 --- a/searchlib/src/vespa/searchlib/datastore/datastorebase.cpp +++ b/searchlib/src/vespa/searchlib/datastore/datastorebase.cpp @@ -2,6 +2,7 @@ #include "datastore.h" #include +#include using vespalib::GenerationHeldBase; diff --git a/searchlib/src/vespa/searchlib/diskindex/wordnummapper.h b/searchlib/src/vespa/searchlib/diskindex/wordnummapper.h index 1d47d3c0b5a..8141a16c137 100644 --- a/searchlib/src/vespa/searchlib/diskindex/wordnummapper.h +++ b/searchlib/src/vespa/searchlib/diskindex/wordnummapper.h @@ -4,6 +4,7 @@ #include #include #include +#include namespace search::diskindex { diff --git a/searchlib/src/vespa/searchlib/docstore/storebybucket.cpp b/searchlib/src/vespa/searchlib/docstore/storebybucket.cpp index 2b7b49aa955..3bb1481969a 100644 --- a/searchlib/src/vespa/searchlib/docstore/storebybucket.cpp +++ b/searchlib/src/vespa/searchlib/docstore/storebybucket.cpp @@ -4,9 +4,9 @@ #include #include #include +#include -namespace search { -namespace docstore { +namespace search::docstore { using document::BucketId; using vespalib::makeTask; @@ -85,4 +85,3 @@ StoreByBucket::drain(IWrite & drainer) } } -} diff --git a/searchlib/src/vespa/searchlib/docstore/visitcache.cpp b/searchlib/src/vespa/searchlib/docstore/visitcache.cpp index c68aa00994f..22a16947b67 100644 --- a/searchlib/src/vespa/searchlib/docstore/visitcache.cpp +++ b/searchlib/src/vespa/searchlib/docstore/visitcache.cpp @@ -6,6 +6,7 @@ #include #include #include +#include namespace search::docstore { diff --git a/searchlib/src/vespa/searchlib/features/array_parser.h b/searchlib/src/vespa/searchlib/features/array_parser.h index 406138c2a18..53247eabe2c 100644 --- a/searchlib/src/vespa/searchlib/features/array_parser.h +++ b/searchlib/src/vespa/searchlib/features/array_parser.h @@ -4,8 +4,7 @@ #include -namespace search { -namespace features { +namespace search::features { /** * Utility for parsing a string representation of an array with values (numeric or string) @@ -45,5 +44,4 @@ public: static void parsePartial(const vespalib::string &input, OutputType &output); }; -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/array_parser.hpp b/searchlib/src/vespa/searchlib/features/array_parser.hpp index 7462427cf74..613fa9ec13e 100644 --- a/searchlib/src/vespa/searchlib/features/array_parser.hpp +++ b/searchlib/src/vespa/searchlib/features/array_parser.hpp @@ -7,9 +7,9 @@ #include #include #include +#include -namespace search { -namespace features { +namespace search::features { template void @@ -92,5 +92,4 @@ ArrayParser::parsePartial(const vespalib::string &input, OutputType &output) template void ArrayParser::parse(const vespalib::string &input, std::vector &); -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/utils.h b/searchlib/src/vespa/searchlib/features/utils.h index 501dff17b41..57f4c83f6a9 100644 --- a/searchlib/src/vespa/searchlib/features/utils.h +++ b/searchlib/src/vespa/searchlib/features/utils.h @@ -9,6 +9,7 @@ #include #include #include +#include namespace search::features::util { diff --git a/searchlib/src/vespa/searchlib/fef/indexproperties.cpp b/searchlib/src/vespa/searchlib/fef/indexproperties.cpp index 4e971bcc484..493b49be0b0 100644 --- a/searchlib/src/vespa/searchlib/fef/indexproperties.cpp +++ b/searchlib/src/vespa/searchlib/fef/indexproperties.cpp @@ -3,6 +3,7 @@ #include "indexproperties.h" #include "properties.h" #include +#include namespace search::fef::indexproperties { diff --git a/searchlib/src/vespa/searchlib/fef/rank_program.cpp b/searchlib/src/vespa/searchlib/fef/rank_program.cpp index 431ff798c83..fa4582d46b7 100644 --- a/searchlib/src/vespa/searchlib/fef/rank_program.cpp +++ b/searchlib/src/vespa/searchlib/fef/rank_program.cpp @@ -3,6 +3,7 @@ #include "rank_program.h" #include "featureoverrider.h" #include +#include using vespalib::Stash; diff --git a/searchlib/src/vespa/searchlib/fef/termfieldmatchdata.cpp b/searchlib/src/vespa/searchlib/fef/termfieldmatchdata.cpp index 7cfc6afa72d..7ff5dcf8b6c 100644 --- a/searchlib/src/vespa/searchlib/fef/termfieldmatchdata.cpp +++ b/searchlib/src/vespa/searchlib/fef/termfieldmatchdata.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "termfieldmatchdata.h" +#include namespace search::fef { diff --git a/searchlib/src/vespa/searchlib/fef/termmatchdatamerger.cpp b/searchlib/src/vespa/searchlib/fef/termmatchdatamerger.cpp index a382a2cd6ee..97cb829e30c 100644 --- a/searchlib/src/vespa/searchlib/fef/termmatchdatamerger.cpp +++ b/searchlib/src/vespa/searchlib/fef/termmatchdatamerger.cpp @@ -1,9 +1,9 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "termmatchdatamerger.h" +#include -namespace search { -namespace fef { +namespace search::fef { TermMatchDataMerger::TermMatchDataMerger(const Inputs &allinputs, const TermFieldMatchDataArray &outputs) @@ -70,5 +70,4 @@ TermMatchDataMerger::merge(uint32_t docid, } } -} // namespace fef -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/index/dictionaryfile.h b/searchlib/src/vespa/searchlib/index/dictionaryfile.h index 574f5bcf56b..2f673c258f3 100644 --- a/searchlib/src/vespa/searchlib/index/dictionaryfile.h +++ b/searchlib/src/vespa/searchlib/index/dictionaryfile.h @@ -5,6 +5,7 @@ #include "postinglisthandle.h" #include "postinglistcountfile.h" #include +#include class FastOS_FileInterface; diff --git a/searchlib/src/vespa/searchlib/query/queryterm.cpp b/searchlib/src/vespa/searchlib/query/queryterm.cpp index 70cbcd37ee0..d47d942dc10 100644 --- a/searchlib/src/vespa/searchlib/query/queryterm.cpp +++ b/searchlib/src/vespa/searchlib/query/queryterm.cpp @@ -1,4 +1,5 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + #include "queryterm.h" #include "base.h" #include @@ -6,6 +7,7 @@ #include #include #include +#include namespace { diff --git a/searchlib/src/vespa/searchlib/queryeval/predicate_search.cpp b/searchlib/src/vespa/searchlib/queryeval/predicate_search.cpp index 0a520034e7f..c9ab167868a 100644 --- a/searchlib/src/vespa/searchlib/queryeval/predicate_search.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/predicate_search.cpp @@ -3,6 +3,7 @@ #include "predicate_search.h" #include #include +#include using search::fef::TermFieldMatchData; using search::fef::TermFieldMatchDataArray; diff --git a/searchlib/src/vespa/searchlib/queryeval/unpackinfo.cpp b/searchlib/src/vespa/searchlib/queryeval/unpackinfo.cpp index 3a92169d43e..f8af7700640 100644 --- a/searchlib/src/vespa/searchlib/queryeval/unpackinfo.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/unpackinfo.cpp @@ -3,9 +3,9 @@ #include "unpackinfo.h" #include #include +#include -namespace search { -namespace queryeval { +namespace search::queryeval { UnpackInfo::UnpackInfo() : _size(0) @@ -101,5 +101,4 @@ UnpackInfo::toString() const return os.str(); } -} // namespace queryeval -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/test/initrange.cpp b/searchlib/src/vespa/searchlib/test/initrange.cpp index 7d125ea5cdd..2292a8e775e 100644 --- a/searchlib/src/vespa/searchlib/test/initrange.cpp +++ b/searchlib/src/vespa/searchlib/test/initrange.cpp @@ -3,9 +3,9 @@ #include #include #include +#include -namespace search { -namespace test { +namespace search::test { using namespace search::queryeval; using std::make_unique; @@ -184,4 +184,3 @@ InitRangeVerifier::searchStrict(SearchIterator & it, Range range) } } -} diff --git a/staging_vespalib/src/tests/array/sort_benchmark.cpp b/staging_vespalib/src/tests/array/sort_benchmark.cpp index a7629084094..1914e3ead9e 100644 --- a/staging_vespalib/src/tests/array/sort_benchmark.cpp +++ b/staging_vespalib/src/tests/array/sort_benchmark.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include LOG_SETUP("sort_benchmark"); diff --git a/storage/src/tests/distributor/bucketdatabasetest.cpp b/storage/src/tests/distributor/bucketdatabasetest.cpp index ecfdc127fc2..c269389dd04 100644 --- a/storage/src/tests/distributor/bucketdatabasetest.cpp +++ b/storage/src/tests/distributor/bucketdatabasetest.cpp @@ -2,9 +2,9 @@ #include "bucketdatabasetest.h" #include #include +#include -namespace storage { -namespace distributor { +namespace storage::distributor { using document::BucketId; @@ -544,4 +544,3 @@ BucketDatabaseTest::testChildCount() } } -} // storage diff --git a/storage/src/tests/distributor/simplemaintenancescannertest.cpp b/storage/src/tests/distributor/simplemaintenancescannertest.cpp index 6846774872e..17f25e4532a 100644 --- a/storage/src/tests/distributor/simplemaintenancescannertest.cpp +++ b/storage/src/tests/distributor/simplemaintenancescannertest.cpp @@ -6,10 +6,9 @@ #include #include #include +#include -namespace storage { - -namespace distributor { +namespace storage::distributor { using document::BucketId; typedef MaintenancePriority Priority; @@ -211,4 +210,3 @@ SimpleMaintenanceScannerTest::perNodeMaintenanceStatsAreTracked() } } -} diff --git a/storage/src/tests/persistence/splitbitdetectortest.cpp b/storage/src/tests/persistence/splitbitdetectortest.cpp index a4c6425f290..60f76c2df60 100644 --- a/storage/src/tests/persistence/splitbitdetectortest.cpp +++ b/storage/src/tests/persistence/splitbitdetectortest.cpp @@ -7,6 +7,7 @@ #include #include #include +#include namespace storage { diff --git a/storage/src/vespa/storage/bucketdb/bucketinfo.cpp b/storage/src/vespa/storage/bucketdb/bucketinfo.cpp index ba39b7062c0..bbc59de410a 100644 --- a/storage/src/vespa/storage/bucketdb/bucketinfo.cpp +++ b/storage/src/vespa/storage/bucketdb/bucketinfo.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "bucketinfo.h" #include +#include namespace storage { diff --git a/storage/src/vespa/storage/distributor/operations/idealstate/mergelimiter.cpp b/storage/src/vespa/storage/distributor/operations/idealstate/mergelimiter.cpp index e7d4d32e0e4..13931c73e3c 100644 --- a/storage/src/vespa/storage/distributor/operations/idealstate/mergelimiter.cpp +++ b/storage/src/vespa/storage/distributor/operations/idealstate/mergelimiter.cpp @@ -1,7 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include +#include "mergelimiter.h" #include +#include #include LOG_SETUP(".distributor.operations.merge.limiter"); diff --git a/storage/src/vespa/storage/distributor/operationtargetresolverimpl.h b/storage/src/vespa/storage/distributor/operationtargetresolverimpl.h index eb13fe3ac8d..2f4a3e0117a 100644 --- a/storage/src/vespa/storage/distributor/operationtargetresolverimpl.h +++ b/storage/src/vespa/storage/distributor/operationtargetresolverimpl.h @@ -5,9 +5,9 @@ #include "operationtargetresolver.h" #include #include +#include -namespace storage { -namespace distributor { +namespace storage::distributor { struct BucketInstance : public vespalib::AsciiPrintable { document::BucketId _bucket; @@ -106,5 +106,4 @@ public: } }; -} // distributor -} // storage +} diff --git a/storage/src/vespa/storage/frameworkimpl/memory/memorystatusviewer.cpp b/storage/src/vespa/storage/frameworkimpl/memory/memorystatusviewer.cpp index 4143082623f..dd07a61f27b 100644 --- a/storage/src/vespa/storage/frameworkimpl/memory/memorystatusviewer.cpp +++ b/storage/src/vespa/storage/frameworkimpl/memory/memorystatusviewer.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include LOG_SETUP(".memory.status.viewer"); diff --git a/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.cpp b/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.cpp index 24cf7059ff7..7735204c92b 100644 --- a/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.cpp +++ b/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.cpp @@ -3,6 +3,7 @@ #include "modifiedbucketchecker.h" #include "filestormanager.h" #include +#include #include LOG_SETUP(".persistence.filestor.modifiedbucketchecker"); diff --git a/storage/src/vespa/storage/persistence/mergehandler.cpp b/storage/src/vespa/storage/persistence/mergehandler.cpp index d84dc59bf95..37fc36c820a 100644 --- a/storage/src/vespa/storage/persistence/mergehandler.cpp +++ b/storage/src/vespa/storage/persistence/mergehandler.cpp @@ -8,8 +8,9 @@ #include #include #include -#include +#include +#include LOG_SETUP(".persistence.mergehandler"); namespace storage { diff --git a/storage/src/vespa/storage/persistence/persistencethread.cpp b/storage/src/vespa/storage/persistence/persistencethread.cpp index 7dc717cabed..fa8231d5353 100644 --- a/storage/src/vespa/storage/persistence/persistencethread.cpp +++ b/storage/src/vespa/storage/persistence/persistencethread.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include LOG_SETUP(".persistence.thread"); diff --git a/storage/src/vespa/storage/storageserver/mergethrottler.cpp b/storage/src/vespa/storage/storageserver/mergethrottler.cpp index 85eb71f419e..d9a14fc7bb0 100644 --- a/storage/src/vespa/storage/storageserver/mergethrottler.cpp +++ b/storage/src/vespa/storage/storageserver/mergethrottler.cpp @@ -7,9 +7,9 @@ #include #include #include +#include #include - LOG_SETUP(".mergethrottler"); namespace storage { diff --git a/storage/src/vespa/storage/tools/generatedistributionbits.cpp b/storage/src/vespa/storage/tools/generatedistributionbits.cpp index 7939f261a5c..73f11b39e67 100644 --- a/storage/src/vespa/storage/tools/generatedistributionbits.cpp +++ b/storage/src/vespa/storage/tools/generatedistributionbits.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include namespace storage { diff --git a/storageapi/src/vespa/storageapi/message/batch.cpp b/storageapi/src/vespa/storageapi/message/batch.cpp index cd757ac38e9..7de0ec098ac 100644 --- a/storageapi/src/vespa/storageapi/message/batch.cpp +++ b/storageapi/src/vespa/storageapi/message/batch.cpp @@ -3,6 +3,7 @@ #include "batch.h" #include #include +#include using namespace storage::api; diff --git a/storageapi/src/vespa/storageapi/message/bucketsplitting.cpp b/storageapi/src/vespa/storageapi/message/bucketsplitting.cpp index 5c82e737bb9..3cbc0a3ab03 100644 --- a/storageapi/src/vespa/storageapi/message/bucketsplitting.cpp +++ b/storageapi/src/vespa/storageapi/message/bucketsplitting.cpp @@ -2,9 +2,9 @@ #include "bucketsplitting.h" #include +#include -namespace storage { -namespace api { +namespace storage::api { IMPLEMENT_COMMAND(SplitBucketCommand, SplitBucketReply) IMPLEMENT_REPLY(SplitBucketReply) @@ -131,6 +131,4 @@ JoinBucketsReply::print(std::ostream& out, bool verbose, } } -} // api -} // storage - +} diff --git a/streamingvisitors/src/vespa/searchvisitor/hitcollector.cpp b/streamingvisitors/src/vespa/searchvisitor/hitcollector.cpp index dd09ed45b8b..a9b09cd7089 100644 --- a/streamingvisitors/src/vespa/searchvisitor/hitcollector.cpp +++ b/streamingvisitors/src/vespa/searchvisitor/hitcollector.cpp @@ -3,6 +3,7 @@ #include "hitcollector.h" #include #include +#include #include LOG_SETUP(".searchvisitor.hitcollector"); diff --git a/vdslib/src/vespa/vdslib/container/documentlist.cpp b/vdslib/src/vespa/vdslib/container/documentlist.cpp index 477148f89c4..18f7e138260 100644 --- a/vdslib/src/vespa/vdslib/container/documentlist.cpp +++ b/vdslib/src/vespa/vdslib/container/documentlist.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include LOG_SETUP(".vdslib.container.documentlist"); diff --git a/vdslib/src/vespa/vdslib/container/documentsummary.cpp b/vdslib/src/vespa/vdslib/container/documentsummary.cpp index 7fb75e8ca26..bc8a0473ab3 100644 --- a/vdslib/src/vespa/vdslib/container/documentsummary.cpp +++ b/vdslib/src/vespa/vdslib/container/documentsummary.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "documentsummary.h" +#include namespace vdslib { diff --git a/vdslib/src/vespa/vdslib/container/searchresult.cpp b/vdslib/src/vespa/vdslib/container/searchresult.cpp index 0e2e0256547..73b19a2f8a2 100644 --- a/vdslib/src/vespa/vdslib/container/searchresult.cpp +++ b/vdslib/src/vespa/vdslib/container/searchresult.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "searchresult.h" +#include namespace vdslib { diff --git a/vdslib/src/vespa/vdslib/distribution/group.cpp b/vdslib/src/vespa/vdslib/distribution/group.cpp index de2ca83b0aa..91e27715911 100644 --- a/vdslib/src/vespa/vdslib/distribution/group.cpp +++ b/vdslib/src/vespa/vdslib/distribution/group.cpp @@ -7,6 +7,7 @@ #include #include #include +#include namespace storage::lib { diff --git a/vespalib/src/tests/stllike/hash_test.cpp b/vespalib/src/tests/stllike/hash_test.cpp index 0159a9c50ab..b405ac84797 100644 --- a/vespalib/src/tests/stllike/hash_test.cpp +++ b/vespalib/src/tests/stllike/hash_test.cpp @@ -5,6 +5,7 @@ #include #include #include +#include using namespace vespalib; using std::make_pair; diff --git a/vespalib/src/tests/stllike/string_test.cpp b/vespalib/src/tests/stllike/string_test.cpp index c3a0dc9cfd7..2973ffd1ef1 100644 --- a/vespalib/src/tests/stllike/string_test.cpp +++ b/vespalib/src/tests/stllike/string_test.cpp @@ -2,6 +2,7 @@ #include #include +#include using namespace vespalib; diff --git a/vespalib/src/vespa/vespalib/util/alloc.h b/vespalib/src/vespa/vespalib/util/alloc.h index 7b078025e82..2c3de92c58e 100644 --- a/vespalib/src/vespa/vespalib/util/alloc.h +++ b/vespalib/src/vespa/vespalib/util/alloc.h @@ -1,14 +1,10 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include #include #include -namespace vespalib { - -namespace alloc { +namespace vespalib::alloc { class MemoryAllocator { public: @@ -116,6 +112,8 @@ private: } +namespace vespalib { + inline size_t roundUp2inN(size_t minimum) { return 2ul << Optimized::msbIdx(minimum - 1); } diff --git a/vespalib/src/vespa/vespalib/util/array.h b/vespalib/src/vespa/vespalib/util/array.h index b766ed56844..23ce250642b 100644 --- a/vespalib/src/vespa/vespalib/util/array.h +++ b/vespalib/src/vespa/vespalib/util/array.h @@ -1,12 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include -#include -#include -#include -#include +#include "alloc.h" namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/array.hpp b/vespalib/src/vespa/vespalib/util/array.hpp index 86626f15b7c..771251f1675 100644 --- a/vespalib/src/vespa/vespalib/util/array.hpp +++ b/vespalib/src/vespa/vespalib/util/array.hpp @@ -2,8 +2,9 @@ #pragma once #include "array.h" -#include -#include +#include +#include +#include namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/compress.h b/vespalib/src/vespa/vespalib/util/compress.h index 7480d4a8f89..f4190c999c3 100644 --- a/vespalib/src/vespa/vespalib/util/compress.h +++ b/vespalib/src/vespa/vespalib/util/compress.h @@ -2,12 +2,10 @@ #pragma once -#include -#include +#include +#include -namespace vespalib { - -namespace compress { +namespace vespalib::compress { class Integer { public: @@ -87,6 +85,3 @@ public: }; } - -} // namespace vespalib - diff --git a/vespalib/src/vespa/vespalib/websocket/request.cpp b/vespalib/src/vespa/vespalib/websocket/request.cpp index 733a8978ba6..98a6631bfcb 100644 --- a/vespalib/src/vespa/vespalib/websocket/request.cpp +++ b/vespalib/src/vespa/vespalib/websocket/request.cpp @@ -2,9 +2,9 @@ #include "request.h" #include +#include -namespace vespalib { -namespace ws { +namespace vespalib::ws { namespace { @@ -139,5 +139,4 @@ Request::is_ws_upgrade() const has_connection_token("upgrade")); } -} // namespace vespalib::ws -} // namespace vespalib +} -- cgit v1.2.3