From e9dd0b8bb6a411698d850af0a50d9aeaa0187e95 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 1 Apr 2019 19:21:30 +0100 Subject: Enable performance tidy checks --- Jamroot.jam | 1 + netfs/daemon/daemon.cpp | 1 + netfs/daemon/daemonService.cpp | 2 +- netfs/daemon/daemonVolume.cpp | 2 +- netfs/unittests/mockDaemon.cpp | 2 +- netfs/unittests/mockFuse.cpp | 2 +- netfs/unittests/testEdgeCases.cpp | 1 + 7 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Jamroot.jam b/Jamroot.jam index a513dc4..5858c4e 100644 --- a/Jamroot.jam +++ b/Jamroot.jam @@ -24,6 +24,7 @@ project tidy:hicpp-* tidy:hicpp-vararg tidy:hicpp-signed-bitwise + tidy:performance-* ; build-project netfs ; diff --git a/netfs/daemon/daemon.cpp b/netfs/daemon/daemon.cpp index 2962ede..a773716 100644 --- a/netfs/daemon/daemon.cpp +++ b/netfs/daemon/daemon.cpp @@ -65,6 +65,7 @@ NetFSDaemon::stop() extern "C" { DLL_PUBLIC IceBox::Service * + // NOLINTNEXTLINE(performance-unnecessary-value-param) createNetFSDaemon(Ice::CommunicatorPtr) { return new NetFSDaemon(); diff --git a/netfs/daemon/daemonService.cpp b/netfs/daemon/daemonService.cpp index 30dac0a..fd5a0fd 100644 --- a/netfs/daemon/daemonService.cpp +++ b/netfs/daemon/daemonService.cpp @@ -11,7 +11,7 @@ ServiceServer::ServiceServer(NetFS::Daemon::ConfigurationPtr c) : NetFS::VolumePrxPtr ServiceServer::connect(const std::string share, const std::string authtoken, const Ice::Current & ice) { - auto ex = AdHoc::safeMapLookup(config->Exports, share); + const auto & ex = AdHoc::safeMapLookup(config->Exports, share); if (!ex->AuthToken.empty() && ex->AuthToken != authtoken) { throw NetFS::AuthError(); } diff --git a/netfs/daemon/daemonVolume.cpp b/netfs/daemon/daemonVolume.cpp index 074580c..dc16011 100644 --- a/netfs/daemon/daemonVolume.cpp +++ b/netfs/daemon/daemonVolume.cpp @@ -303,7 +303,7 @@ std::filesystem::path normalizedAppend(std::filesystem::path out, const std::filesystem::path && in) { unsigned int depth = 0; - for(auto e : in) { + for(const auto & e : in) { if (e.empty() || e == "." || e == "/") { continue; } diff --git a/netfs/unittests/mockDaemon.cpp b/netfs/unittests/mockDaemon.cpp index 50a313a..4e8bd9a 100644 --- a/netfs/unittests/mockDaemon.cpp +++ b/netfs/unittests/mockDaemon.cpp @@ -15,7 +15,7 @@ NetFS::Daemon::ConfigurationPtr MockDaemon::ReadConfiguration(const std::filesystem::path & path) const { auto c = NetFSDaemon::ReadConfiguration(path); - for(auto e : c->Exports) { + for(const auto & e : c->Exports) { e.second->RootPath = TestExportRoot.string(); } c->Hosts.insert({ "unittest", std::make_shared(testEndpoint) }); diff --git a/netfs/unittests/mockFuse.cpp b/netfs/unittests/mockFuse.cpp index 8558b4c..da6b07f 100644 --- a/netfs/unittests/mockFuse.cpp +++ b/netfs/unittests/mockFuse.cpp @@ -41,7 +41,7 @@ NetFS::Client::ConfigurationPtr FuseMock::ReadConfiguration(const std::filesystem::path & path) const { auto c = FuseApp::ReadConfiguration(path); - for(auto r : c->Resources) { + for(const auto & r : c->Resources) { for(auto & e : r.second->Endpoints) { e = testEndpoint; } diff --git a/netfs/unittests/testEdgeCases.cpp b/netfs/unittests/testEdgeCases.cpp index 4fd65ab..37a40b6 100644 --- a/netfs/unittests/testEdgeCases.cpp +++ b/netfs/unittests/testEdgeCases.cpp @@ -108,6 +108,7 @@ BOOST_AUTO_TEST_CASE( manyThreads ) bool running = true; std::vector ths; + ths.reserve(20); std::atomic_uint success = 0; for (int x = 0; x < 20; x++) { ths.emplace_back([&] { -- cgit v1.2.3