summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Jamroot.jam9
-rw-r--r--icetray/dryice/dryice.cpp3
-rw-r--r--icetray/icetray/Jamfile.jam12
-rw-r--r--icetray/icetray/icetrayService.cpp4
-rw-r--r--icetray/icetray/logger.cpp17
-rw-r--r--icetray/icetray/logger.h4
-rw-r--r--icetray/tool/icetraySql.cpp1
-rw-r--r--icetray/unittests/Jamfile.jam13
-rw-r--r--icetray/unittests/testIceTrayLogger.cpp5
-rw-r--r--icetray/unittests/testIceTrayOptions.cpp2
-rw-r--r--icetray/unittests/testIceTrayReplace.cpp2
-rw-r--r--icetray/unittests/testOptions.cpp8
-rw-r--r--icetray/unittests/testService.cpp4
-rw-r--r--icetray/unittests/testService.h2
14 files changed, 56 insertions, 30 deletions
diff --git a/Jamroot.jam b/Jamroot.jam
index 704caf4..909ef13 100644
--- a/Jamroot.jam
+++ b/Jamroot.jam
@@ -15,7 +15,14 @@ project
<variant>debug:<cxxflags>"-W -Wall -Werror -Wextra"
<variant>coverage:<cxxflags>"--coverage"
<variant>coverage:<linkflags>"--coverage"
- ;
+ <toolset>tidy:<checkxx>boost-*
+ <toolset>tidy:<checkxx>bugprone-*
+ <toolset>tidy:<checkxx>clang-*
+ <toolset>tidy:<checkxx>misc-*
+#<toolset>tidy:<checkxx>modernize-*
+ <toolset>tidy:<checkxx>hicpp-*
+#<toolset>tidy:<checkxx>performance-*
+ ;
build-project icetray ;
diff --git a/icetray/dryice/dryice.cpp b/icetray/dryice/dryice.cpp
index 7cf5c35..4021b9b 100644
--- a/icetray/dryice/dryice.cpp
+++ b/icetray/dryice/dryice.cpp
@@ -9,6 +9,7 @@ namespace IceTray {
DryIce::DryIce(const Ice::StringSeq & cmdline)
{
+ // NOLINTNEXTLINE(hicpp-no-array-decay)
BOOST_ASSERT(!currentDryIce);
Ice::StringSeq args;
Ice::InitializationData id;
@@ -59,7 +60,9 @@ namespace IceTray {
ServicePtr
DryIceClient::getService() const
{
+ // NOLINTNEXTLINE(hicpp-no-array-decay)
BOOST_ASSERT(DryIce::currentDryIce);
+ // NOLINTNEXTLINE(hicpp-no-array-decay)
BOOST_ASSERT(DryIce::currentDryIce->s);
return DryIce::currentDryIce->s;
}
diff --git a/icetray/icetray/Jamfile.jam b/icetray/icetray/Jamfile.jam
index 3796fa8..bacda4e 100644
--- a/icetray/icetray/Jamfile.jam
+++ b/icetray/icetray/Jamfile.jam
@@ -2,8 +2,14 @@ import package ;
lib boost_program_options ;
+obj logWriter : logWriter.ice :
+ <slicer>no
+ <include>.
+ <toolset>tidy:<checker>none
+ ;
lib icetray :
- [ glob-tree *.cpp *.ice : bin ]
+ [ glob *.cpp *.ice ]
+ logWriter
:
<library>..//adhocutil
<library>..//dbppcore
@@ -14,7 +20,8 @@ lib icetray :
<library>..//slicer-db
<library>../..//glibmm
<library>boost_program_options
- <slicer>yes
+ <implicit-dependency>logWriter
+ <slicer>pure
<include>.
: :
<include>.
@@ -22,6 +29,7 @@ lib icetray :
<library>..//adhocutil
<library>..//slicer
<library>..//slicer-db
+ <implicit-dependency>logWriter
;
explicit install ;
diff --git a/icetray/icetray/icetrayService.cpp b/icetray/icetray/icetrayService.cpp
index d53930e..77e5ba6 100644
--- a/icetray/icetray/icetrayService.cpp
+++ b/icetray/icetray/icetrayService.cpp
@@ -9,12 +9,14 @@ namespace IceTray {
Service::Service()
{
+ // NOLINTNEXTLINE(hicpp-no-array-decay)
BOOST_ASSERT(!current);
current = this;
}
Service::~Service()
{
+ // NOLINTNEXTLINE(hicpp-no-array-decay)
BOOST_ASSERT(current);
current = nullptr;
}
@@ -22,6 +24,7 @@ namespace IceTray {
Service *
Service::getCurrent()
{
+ // NOLINTNEXTLINE(hicpp-no-array-decay)
BOOST_ASSERT(current);
return current;
}
@@ -30,6 +33,7 @@ namespace IceTray {
Service::create(Ice::CommunicatorPtr)
{
auto serviceFactories = AdHoc::PluginManager::getDefault()->getAll<IceTray::ServiceFactory>();
+ // NOLINTNEXTLINE(hicpp-no-array-decay)
BOOST_ASSERT(serviceFactories.size() == 1);
return serviceFactories.begin()->get()->implementation()->create();
}
diff --git a/icetray/icetray/logger.cpp b/icetray/icetray/logger.cpp
index 5143ea0..a6e61b4 100644
--- a/icetray/icetray/logger.cpp
+++ b/icetray/icetray/logger.cpp
@@ -19,9 +19,7 @@ namespace IceTray {
{
}
- LoggerBase::~LoggerBase()
- {
- }
+ LoggerBase::~LoggerBase() = default;
const Domain &
LoggerBase::getDomain() const
@@ -64,8 +62,11 @@ namespace IceTray {
const auto fl = firstFor(priority);
if (fl != logs.end()) {
va_list v;
+ // NOLINTNEXTLINE(hicpp-vararg,hicpp-no-array-decay)
va_start(v, msgfmt);
+ // NOLINTNEXTLINE(hicpp-no-array-decay)
vmessagef(fl, priority, msgfmt, v);
+ // NOLINTNEXTLINE(hicpp-no-array-decay)
va_end(v);
}
}
@@ -78,6 +79,7 @@ namespace IceTray {
if (len > 0) {
message(fl, priority, msg);
}
+ // NOLINTNEXTLINE(hicpp-no-malloc)
free(msg);
}
@@ -102,6 +104,7 @@ namespace IceTray {
std::unique_ptr<char, void(*)(void*)> res {
abi::__cxa_demangle(type.name(), NULL, NULL, NULL), std::free
};
+ // NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks)
return getLogger(res.get());
}
@@ -164,10 +167,6 @@ namespace IceTray {
return ::AdHoc::GlobalStatic<::IceTray::Logging::LogManager>::get();
}
- AbstractLogWriter::AbstractLogWriter()
- {
- }
-
AbstractLogWriter::AbstractLogWriter(LogLevel level)
{
logDomains.insert({ { }, level });
@@ -220,7 +219,9 @@ namespace IceTray {
Ice::StringSeq
AbstractLogWriter::splitDomain(const std::string & domain)
{
- if (domain.empty()) return Ice::StringSeq();
+ if (domain.empty()) {
+ return Ice::StringSeq();
+ }
Ice::StringSeq domainTokens;
boost::algorithm::split(domainTokens, domain, boost::algorithm::is_any_of(".:"), boost::algorithm::token_compress_on);
diff --git a/icetray/icetray/logger.h b/icetray/icetray/logger.h
index 32b57db..00e948d 100644
--- a/icetray/icetray/logger.h
+++ b/icetray/icetray/logger.h
@@ -23,7 +23,7 @@ namespace IceTray {
class DLL_PUBLIC LoggerBase {
public:
LoggerBase(const Domain & domain);
- ~LoggerBase();
+ virtual ~LoggerBase() = 0;
const Domain & getDomain() const;
@@ -97,7 +97,7 @@ namespace IceTray {
IceUtil::Optional<LogLevel> level(Domain, const Ice::Current &) override;
protected:
- AbstractLogWriter();
+ AbstractLogWriter() = default;
AbstractLogWriter(LogLevel level);
AbstractLogWriter(const std::string & prefix, Ice::PropertiesPtr p);
diff --git a/icetray/tool/icetraySql.cpp b/icetray/tool/icetraySql.cpp
index 3b3d1d9..2b9a5ff 100644
--- a/icetray/tool/icetraySql.cpp
+++ b/icetray/tool/icetraySql.cpp
@@ -46,6 +46,7 @@ main(int argc, char ** argv)
("sql", po::value(&sql)->required(), "Path of SQL script")
("cpp", po::value(&cpp)->required(), "Path of C++ file to write")
("h", po::value(&h)->required(), "Path of header file to write")
+ // NOLINTNEXTLINE(clang-analyzer-optin.cplusplus.VirtualCall)
("basedir,d", po::value(&base)->default_value(fs::current_path()), "Base directory of SQL scripts (namespaces are created relative to here)")
("namespace", po::value(&sqlns), "Namespace to create SqlSource in")
("connector,c", po::value(&connector), "Specifiy a default connector name")
diff --git a/icetray/unittests/Jamfile.jam b/icetray/unittests/Jamfile.jam
index 7ca8e2f..67ffc0a 100644
--- a/icetray/unittests/Jamfile.jam
+++ b/icetray/unittests/Jamfile.jam
@@ -20,10 +20,12 @@ alias testCommon : : : :
<library>..//pthread
<library>boost_utf
<define>BOOST_TEST_DYN_LINK
- <icetray.sql.tool>../tool//icetray-sql
- <dependency>../tool//icetray-sql
+ <icetray.sql.tool>../tool//icetray-sql/<toolset>gcc
+ <dependency>../tool//icetray-sql/<toolset>gcc
<icetray.sql.basedir>$(me)
<implicit-dependency>../icetray//icetray
+ <toolset>tidy:<xcheckxx>hicpp-vararg
+ <toolset>tidy:<xcheckxx>hicpp-no-array-decay
;
generators.register-standard $(__name__).icetray.c++.sql : SQL : CPP(%.sql) H(%.sql) ;
@@ -40,15 +42,17 @@ actions icetray.c++.sql bind ICETRAYSQLBIN
$(ICETRAYSQLBIN) --basedir="$(BASEDIR)" --namespace="$(NAMESPACE)" "$(2[1])" "$(1[1])" "$(1[2])"
}
+obj testIceTrayService : testIceTrayService.ice : <toolset>tidy:<checker>none ;
run
testIceTray.cpp
- testIceTrayService.ice
+ testIceTrayService
testIceTrayServiceI.cpp
testIceTrayServiceTestSql.sql
subdir/some.sql
subdir/a/more.sql
: : :
<icetray.sql.namespace>TestIceTray::sql
+ <implicit-dependency>testIceTrayService
<library>testCommon
<library>stdc++fs
<library>dbpp-postgresql
@@ -65,13 +69,14 @@ run
run
testIceTrayReplace.cpp
- testIceTrayService.ice
+ testIceTrayService
testIceTrayServiceI.cpp
testIceTrayServiceTestSql.sql
subdir/some.sql
subdir/a/more.sql
: : :
<icetray.sql.namespace>TestIceTray::sql
+ <implicit-dependency>testIceTrayService
<library>testCommon
<library>stdc++fs
<library>dbpp-postgresql
diff --git a/icetray/unittests/testIceTrayLogger.cpp b/icetray/unittests/testIceTrayLogger.cpp
index b8c9d5c..3eabf0d 100644
--- a/icetray/unittests/testIceTrayLogger.cpp
+++ b/icetray/unittests/testIceTrayLogger.cpp
@@ -24,12 +24,12 @@ struct LogEntry {
class TestLogWriter : public AbstractLogWriter {
public:
template <typename ... T>
- TestLogWriter(const T & ... t) :
+ explicit TestLogWriter(const T & ... t) :
AbstractLogWriter(t...)
{
}
- TestLogWriter(const Ice::PropertiesPtr & p) :
+ explicit TestLogWriter(const Ice::PropertiesPtr & p) :
AbstractLogWriter("TestLogWriter", p)
{
}
@@ -76,6 +76,7 @@ BOOST_AUTO_TEST_CASE( staticLogInit )
BOOST_REQUIRE_EQUAL(expected, staticLog->getDomain());
}
+// NOLINTNEXTLINE(hicpp-special-member-functions)
class TestLogImpl {
public:
TestLogImpl() :
diff --git a/icetray/unittests/testIceTrayOptions.cpp b/icetray/unittests/testIceTrayOptions.cpp
index 62f921a..3101052 100644
--- a/icetray/unittests/testIceTrayOptions.cpp
+++ b/icetray/unittests/testIceTrayOptions.cpp
@@ -14,7 +14,7 @@
class DI : public IceTray::DryIce {
public:
- DI(const Ice::StringSeq & opts) : IceTray::DryIce(opts) { }
+ explicit DI(const Ice::StringSeq & opts) : IceTray::DryIce(opts) { }
};
BOOST_AUTO_TEST_CASE( testOptions )
diff --git a/icetray/unittests/testIceTrayReplace.cpp b/icetray/unittests/testIceTrayReplace.cpp
index 346e0a1..1558326 100644
--- a/icetray/unittests/testIceTrayReplace.cpp
+++ b/icetray/unittests/testIceTrayReplace.cpp
@@ -11,8 +11,6 @@
namespace TestIceTray {
class DummyTestIceTrayServiceI : public TestIceTrayService {
public:
- DummyTestIceTrayServiceI() { }
-
void method1(const Ice::Current &) override { }
void method2(Ice::Int, std::string, const Ice::Current &) override { }
};
diff --git a/icetray/unittests/testOptions.cpp b/icetray/unittests/testOptions.cpp
index af5151c..b47e8a4 100644
--- a/icetray/unittests/testOptions.cpp
+++ b/icetray/unittests/testOptions.cpp
@@ -1,6 +1,8 @@
#include "testOptions.h"
-TestOptions::TestOptions() : IceTray::Options("Test options")
+TestOptions::TestOptions() :
+ IceTray::Options("Test options"),
+ testInt(0)
{
}
@@ -12,7 +14,9 @@ ICETRAY_OPTIONS(TestOptions,
class TestOptionsInline : public IceTray::Options {
public:
- TestOptionsInline() : IceTray::Options("Test options inline")
+ TestOptionsInline() :
+ IceTray::Options("Test options inline"),
+ testInt(0)
{
}
diff --git a/icetray/unittests/testService.cpp b/icetray/unittests/testService.cpp
index 0e8cc2d..8f678b0 100644
--- a/icetray/unittests/testService.cpp
+++ b/icetray/unittests/testService.cpp
@@ -1,10 +1,6 @@
#include "testService.h"
#include "testOptions.h"
-TestService::~TestService()
-{
-}
-
void
TestService::addObjects(const std::string &, const Ice::CommunicatorPtr &, const Ice::StringSeq &, const Ice::ObjectAdapterPtr &)
{
diff --git a/icetray/unittests/testService.h b/icetray/unittests/testService.h
index 42af919..7c5a0ae 100644
--- a/icetray/unittests/testService.h
+++ b/icetray/unittests/testService.h
@@ -2,8 +2,6 @@
class DLL_PUBLIC TestService : public IceTray::Service {
public:
- virtual ~TestService();
-
void addObjects(const std::string &, const Ice::CommunicatorPtr &, const Ice::StringSeq &, const Ice::ObjectAdapterPtr &) override;
};