summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2019-04-01 19:21:30 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2019-04-01 19:21:30 +0100
commite9dd0b8bb6a411698d850af0a50d9aeaa0187e95 (patch)
tree99f514118e5448869d8d31fdc582c090f6d28037
parentEnable hicpp tidy checks (diff)
downloadnetfs-e9dd0b8bb6a411698d850af0a50d9aeaa0187e95.tar.bz2
netfs-e9dd0b8bb6a411698d850af0a50d9aeaa0187e95.tar.xz
netfs-e9dd0b8bb6a411698d850af0a50d9aeaa0187e95.zip
Enable performance tidy checks
-rw-r--r--Jamroot.jam1
-rw-r--r--netfs/daemon/daemon.cpp1
-rw-r--r--netfs/daemon/daemonService.cpp2
-rw-r--r--netfs/daemon/daemonVolume.cpp2
-rw-r--r--netfs/unittests/mockDaemon.cpp2
-rw-r--r--netfs/unittests/mockFuse.cpp2
-rw-r--r--netfs/unittests/testEdgeCases.cpp1
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
<toolset>tidy:<checkxx>hicpp-*
<toolset>tidy:<xcheckxx>hicpp-vararg
<toolset>tidy:<xcheckxx>hicpp-signed-bitwise
+ <toolset>tidy:<checkxx>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<NetFS::ExportNotFound>(config->Exports, share);
+ const auto & ex = AdHoc::safeMapLookup<NetFS::ExportNotFound>(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<NetFS::Daemon::Host>(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<std::thread> ths;
+ ths.reserve(20);
std::atomic_uint success = 0;
for (int x = 0; x < 20; x++) {
ths.emplace_back([&] {