summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-09-25 11:53:38 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-09-25 11:53:38 +0100
commit22d21fcd58c8cd872c90caed84f62bd9798e7427 (patch)
tree2c39e1deefd73dbf913d5fe4812de11a2c6059f9
parentFix tidy exclusion path to cxxstd-20-iso, not 17 (diff)
downloadslicer-22d21fcd58c8cd872c90caed84f62bd9798e7427.tar.bz2
slicer-22d21fcd58c8cd872c90caed84f62bd9798e7427.tar.xz
slicer-22d21fcd58c8cd872c90caed84f62bd9798e7427.zip
Pass nearly all the tidy checks
clang-tidy and cppcheck for everything, everything but generated code for IWYU
-rw-r--r--Jamroot.jam2
-rw-r--r--iwyu.json8
-rw-r--r--slicer/db/sqlBinder.cpp1
-rw-r--r--slicer/db/sqlBinder.h9
-rw-r--r--slicer/db/sqlCommon.cpp3
-rw-r--r--slicer/db/sqlCommon.h5
-rw-r--r--slicer/db/sqlInsertSerializer.cpp11
-rw-r--r--slicer/db/sqlInsertSerializer.h8
-rw-r--r--slicer/db/sqlSelectDeserializer.cpp8
-rw-r--r--slicer/db/sqlSelectDeserializer.h9
-rw-r--r--slicer/db/sqlSource.cpp3
-rw-r--r--slicer/db/sqlSource.h14
-rw-r--r--slicer/db/sqlTablePatchSerializer.cpp8
-rw-r--r--slicer/db/sqlTablePatchSerializer.h8
-rw-r--r--slicer/db/sqlUpdateSerializer.cpp5
-rw-r--r--slicer/db/sqlUpdateSerializer.h8
-rw-r--r--slicer/db/testConversions.cpp5
-rw-r--r--slicer/db/testInsert.cpp22
-rw-r--r--slicer/db/testMockCommon.cpp5
-rw-r--r--slicer/db/testMockCommon.h5
-rw-r--r--slicer/db/testPatch.cpp21
-rw-r--r--slicer/db/testSelect.cpp27
-rw-r--r--slicer/db/testUpdate.cpp24
-rw-r--r--slicer/ice/serializer.cpp10
-rw-r--r--slicer/ice/serializer.h2
-rw-r--r--slicer/ice/testSpecifics.cpp55
-rw-r--r--slicer/json/serializer.cpp14
-rw-r--r--slicer/json/serializer.h6
-rw-r--r--slicer/json/testSpecifics.cpp3
-rw-r--r--slicer/slicer/enum-test.cpp2
-rw-r--r--slicer/slicer/hook-test.cpp6
-rw-r--r--slicer/slicer/metadata-test.cpp5
-rw-r--r--slicer/slicer/modelParts.h6
-rw-r--r--slicer/slicer/modelPartsTypes.h3
-rw-r--r--slicer/slicer/modelPartsTypes.impl.h3
-rw-r--r--slicer/test/compilation.cpp25
-rw-r--r--slicer/test/conversions.cpp11
-rw-r--r--slicer/test/conversions.h9
-rw-r--r--slicer/test/helpers.cpp6
-rw-r--r--slicer/test/helpers.h1
-rw-r--r--slicer/test/preprocessor.cpp18
-rw-r--r--slicer/test/serializers.cpp31
-rw-r--r--slicer/test/streams.cpp8
-rw-r--r--slicer/test/streams.h1
-rw-r--r--slicer/xml/serializer.cpp15
-rw-r--r--slicer/xml/serializer.h14
-rw-r--r--slicer/xml/testSpecifics.cpp5
47 files changed, 365 insertions, 113 deletions
diff --git a/Jamroot.jam b/Jamroot.jam
index fad5a82..64e9bc7 100644
--- a/Jamroot.jam
+++ b/Jamroot.jam
@@ -67,7 +67,7 @@ project
<toolset>tidy:<exclude>db/bin/tidy/debug/checker-none/cxxstd-20-iso/visibility-hidden/testModels.h
<toolset>tidy:<exclude>ice/cpp/*
<toolset>tidy:<define>ICE_IGNORE_VERSION
- <toolset>tidy:<define>ICE_MEMBER
+ <toolset>tidy:<define>ICE_MEMBER_IMPORT_EXPORT
<toolset>tidy:<define>__x86_64
<toolset>tidy:<librarydef>boost
<toolset>tidy:<librarydef>std
diff --git a/iwyu.json b/iwyu.json
index 81b7e04..ddb8514 100644
--- a/iwyu.json
+++ b/iwyu.json
@@ -17,6 +17,14 @@
},
{
"symbol": [
+ "tm",
+ "private",
+ "<ctime>",
+ "public"
+ ]
+ },
+ {
+ "symbol": [
"boost::posix_time::time_duration",
"private",
"<boost/date_time/posix_time/posix_time.hpp>",
diff --git a/slicer/db/sqlBinder.cpp b/slicer/db/sqlBinder.cpp
index 8245217..beaeef0 100644
--- a/slicer/db/sqlBinder.cpp
+++ b/slicer/db/sqlBinder.cpp
@@ -1,4 +1,5 @@
#include "sqlBinder.h"
+#include <command.h>
namespace Slicer {
SqlBinder::SqlBinder(DB::Command & c, unsigned int i) : command(c), idx(i) { }
diff --git a/slicer/db/sqlBinder.h b/slicer/db/sqlBinder.h
index 8c1ce80..4f5437c 100644
--- a/slicer/db/sqlBinder.h
+++ b/slicer/db/sqlBinder.h
@@ -1,9 +1,14 @@
#ifndef SLICER_DB_SQLBINDER_H
#define SLICER_DB_SQLBINDER_H
-#include <boost/date_time/posix_time/ptime.hpp>
-#include <command.h>
+#include <Ice/Config.h>
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <memory>
#include <slicer/modelParts.h>
+#include <string>
+namespace DB {
+ class Command;
+}
namespace Slicer {
class SqlBinder :
diff --git a/slicer/db/sqlCommon.cpp b/slicer/db/sqlCommon.cpp
index 7ef0046..f60d33f 100644
--- a/slicer/db/sqlCommon.cpp
+++ b/slicer/db/sqlCommon.cpp
@@ -1,7 +1,8 @@
#include "sqlCommon.h"
#include <compileTimeFormatter.h>
-#include <metadata.h>
+#include <modelParts.h>
#include <sqlExceptions.h>
+#include <string_view>
namespace Slicer {
constexpr std::string_view md_pkey {"db:pkey"};
diff --git a/slicer/db/sqlCommon.h b/slicer/db/sqlCommon.h
index 32afd87..acabc51 100644
--- a/slicer/db/sqlCommon.h
+++ b/slicer/db/sqlCommon.h
@@ -1,10 +1,9 @@
#ifndef SLICER_DB_SQLCOMMON_H
#define SLICER_DB_SQLCOMMON_H
-#include <modelParts.h>
-#include <string>
-
namespace Slicer {
+ class HookCommon;
+
bool isPKey(const HookCommon *);
bool isAuto(const HookCommon *);
bool isNotAuto(const HookCommon *);
diff --git a/slicer/db/sqlInsertSerializer.cpp b/slicer/db/sqlInsertSerializer.cpp
index f18df73..96ba457 100644
--- a/slicer/db/sqlInsertSerializer.cpp
+++ b/slicer/db/sqlInsertSerializer.cpp
@@ -1,14 +1,17 @@
#include "sqlInsertSerializer.h"
+#include "common.h"
#include "sqlBinder.h"
#include "sqlCommon.h"
+#include "sqlExceptions.h"
+#include <Ice/Config.h>
#include <boost/numeric/conversion/cast.hpp>
-#include <common.h>
+#include <command_fwd.h>
#include <compileTimeFormatter.h>
+#include <connection.h>
#include <functional>
+#include <memory>
#include <modifycommand.h>
-#include <slicer/metadata.h>
-#include <sqlExceptions.h>
-#include <type_traits>
+#include <utility>
namespace Slicer {
using namespace std::placeholders;
diff --git a/slicer/db/sqlInsertSerializer.h b/slicer/db/sqlInsertSerializer.h
index 8a72b68..6bcfae3 100644
--- a/slicer/db/sqlInsertSerializer.h
+++ b/slicer/db/sqlInsertSerializer.h
@@ -1,10 +1,16 @@
#ifndef SLICER_DB_SQLINSERTSERIALIZER_H
#define SLICER_DB_SQLINSERTSERIALIZER_H
-#include <connection.h>
+#include "modelParts.h"
+#include <command_fwd.h>
#include <ostream>
#include <slicer/serializer.h>
+#include <string>
#include <visibility.h>
+namespace DB {
+ class Connection;
+ class ModifyCommand;
+}
namespace Slicer {
class DLL_PUBLIC SqlInsertSerializer : public Slicer::Serializer {
diff --git a/slicer/db/sqlSelectDeserializer.cpp b/slicer/db/sqlSelectDeserializer.cpp
index 4ecf410..eaf09ac 100644
--- a/slicer/db/sqlSelectDeserializer.cpp
+++ b/slicer/db/sqlSelectDeserializer.cpp
@@ -1,7 +1,11 @@
#include "sqlSelectDeserializer.h"
+#include "common.h"
+#include "sqlExceptions.h"
#include "sqlSource.h"
-#include <common.h>
-#include <sqlExceptions.h>
+#include <column.h>
+#include <memory>
+#include <selectcommand.h>
+#include <utility>
namespace Slicer {
SqlSelectDeserializer::SqlSelectDeserializer(DB::SelectCommand * c, std::optional<std::string> tc) :
diff --git a/slicer/db/sqlSelectDeserializer.h b/slicer/db/sqlSelectDeserializer.h
index 05f1c06..b681817 100644
--- a/slicer/db/sqlSelectDeserializer.h
+++ b/slicer/db/sqlSelectDeserializer.h
@@ -1,9 +1,14 @@
#ifndef SLICER_DB_SQLSELECTDESERIALIZER_H
#define SLICER_DB_SQLSELECTDESERIALIZER_H
-#include <selectcommand.h>
-#include <slicer/serializer.h>
+#include "modelParts.h"
+#include "slicer/serializer.h"
+#include <optional>
+#include <string>
#include <visibility.h>
+namespace DB {
+ class SelectCommand;
+}
namespace Slicer {
class DLL_PUBLIC SqlSelectDeserializer : public Slicer::Deserializer {
diff --git a/slicer/db/sqlSource.cpp b/slicer/db/sqlSource.cpp
index 84964f2..41b9c1c 100644
--- a/slicer/db/sqlSource.cpp
+++ b/slicer/db/sqlSource.cpp
@@ -1,5 +1,8 @@
#include "sqlSource.h"
+#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/numeric/conversion/cast.hpp>
+#include <column.h>
+#include <cstdint>
namespace Slicer {
SqlSource::SqlSource(const DB::Column & c) : column(c) { }
diff --git a/slicer/db/sqlSource.h b/slicer/db/sqlSource.h
index c48fb4d..4b76974 100644
--- a/slicer/db/sqlSource.h
+++ b/slicer/db/sqlSource.h
@@ -1,9 +1,17 @@
#ifndef SLICER_DB_SQLSOURCE_H
#define SLICER_DB_SQLSOURCE_H
-#include <boost/date_time/posix_time/ptime.hpp>
-#include <column.h>
-#include <slicer/modelParts.h>
+#include "slicer/modelParts.h"
+#include <Ice/Config.h>
+#include <memory>
+#include <string>
+namespace DB {
+ class Column;
+}
+namespace boost::posix_time {
+ class ptime;
+ class time_duration;
+}
namespace Slicer {
class SqlSource :
diff --git a/slicer/db/sqlTablePatchSerializer.cpp b/slicer/db/sqlTablePatchSerializer.cpp
index 7c29be5..b136b15 100644
--- a/slicer/db/sqlTablePatchSerializer.cpp
+++ b/slicer/db/sqlTablePatchSerializer.cpp
@@ -1,10 +1,12 @@
+#include "sqlTablePatchSerializer.h"
#include "sqlCommon.h"
#include "sqlInsertSerializer.h"
-#include "sqlTablePatchSerializer.h"
#include <compileTimeFormatter.h>
-#include <functional>
+#include <connection.h>
+#include <memory>
#include <scopeExit.h>
-#include <slicer/metadata.h>
+#include <string>
+#include <tablepatch.h>
namespace Slicer {
AdHocFormatter(ttname, "slicer_tmp_%?");
diff --git a/slicer/db/sqlTablePatchSerializer.h b/slicer/db/sqlTablePatchSerializer.h
index 025e122..8973072 100644
--- a/slicer/db/sqlTablePatchSerializer.h
+++ b/slicer/db/sqlTablePatchSerializer.h
@@ -1,9 +1,13 @@
#ifndef SLICER_DB_SQLTABLEPATCHSERIALIZER_H
#define SLICER_DB_SQLTABLEPATCHSERIALIZER_H
-#include <connection.h>
+#include "modelParts.h"
#include <slicer/serializer.h>
-#include <tablepatch.h>
+#include <visibility.h>
+namespace DB {
+ class Connection;
+ class TablePatch;
+}
namespace Slicer {
class DLL_PUBLIC SqlTablePatchSerializer : public Slicer::Serializer {
diff --git a/slicer/db/sqlUpdateSerializer.cpp b/slicer/db/sqlUpdateSerializer.cpp
index a2de6a7..9e0e85a 100644
--- a/slicer/db/sqlUpdateSerializer.cpp
+++ b/slicer/db/sqlUpdateSerializer.cpp
@@ -1,12 +1,15 @@
#include "sqlUpdateSerializer.h"
#include "sqlBinder.h"
#include "sqlCommon.h"
+#include <command_fwd.h>
#include <common.h>
#include <compileTimeFormatter.h>
+#include <connection.h>
#include <functional>
+#include <memory>
#include <modifycommand.h>
-#include <slicer/metadata.h>
#include <sqlExceptions.h>
+#include <utility>
namespace Slicer {
using namespace std::placeholders;
diff --git a/slicer/db/sqlUpdateSerializer.h b/slicer/db/sqlUpdateSerializer.h
index e82015b..4204b86 100644
--- a/slicer/db/sqlUpdateSerializer.h
+++ b/slicer/db/sqlUpdateSerializer.h
@@ -1,9 +1,15 @@
#ifndef SLICER_DB_SQLUPDATESERIALIZER_H
#define SLICER_DB_SQLUPDATESERIALIZER_H
-#include <connection.h>
+#include "modelParts.h"
+#include <command_fwd.h>
#include <slicer/serializer.h>
+#include <string>
#include <visibility.h>
+namespace DB {
+ class Connection;
+ class ModifyCommand;
+}
namespace Slicer {
class DLL_PUBLIC SqlUpdateSerializer : public Slicer::Serializer {
diff --git a/slicer/db/testConversions.cpp b/slicer/db/testConversions.cpp
index 68de17a..2c1e482 100644
--- a/slicer/db/testConversions.cpp
+++ b/slicer/db/testConversions.cpp
@@ -1,5 +1,8 @@
-#include <boost/date_time/posix_time/posix_time_types.hpp>
+#include <Ice/Config.h>
+#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/numeric/conversion/cast.hpp>
+#include <cstdint>
+#include <memory>
#include <testModels.h>
#include <visibility.h>
diff --git a/slicer/db/testInsert.cpp b/slicer/db/testInsert.cpp
index 1919a85..37196b1 100644
--- a/slicer/db/testInsert.cpp
+++ b/slicer/db/testInsert.cpp
@@ -1,13 +1,23 @@
#define BOOST_TEST_MODULE db_insert
+#include <boost/test/unit_test.hpp>
+
+#include "classes.h"
+#include "collections.h"
+#include "common.h"
+#include "slicer/slicer.h"
#include "sqlInsertSerializer.h"
#include "sqlSelectDeserializer.h"
+#include "structs.h"
#include "testMockCommon.h"
-#include <boost/date_time/posix_time/posix_time_io.hpp>
-#include <boost/test/unit_test.hpp>
-#include <common.h>
-#include <slicer/slicer.h>
-#include <testModels.h>
-#include <types.h>
+#include "testModels.h"
+#include <Ice/Optional.h>
+#include <connection.h>
+#include <iosfwd>
+#include <memory>
+#include <string>
+#include <string_view>
+#include <vector>
+// IWYU pragma: no_forward_declare Slicer::UnsupportedModelType
using namespace std::literals;
diff --git a/slicer/db/testMockCommon.cpp b/slicer/db/testMockCommon.cpp
index 0d8c2c9..181a970 100644
--- a/slicer/db/testMockCommon.cpp
+++ b/slicer/db/testMockCommon.cpp
@@ -1,5 +1,10 @@
#include "testMockCommon.h"
+#include <connection_fwd.h>
#include <definedDirs.h>
+#include <filesystem>
+#include <memory>
+#include <mockDatabase.h>
+#include <pq-mock.h>
StandardMockDatabase::StandardMockDatabase() :
DB::PluginMock<PQ::Mock>("pqmock", {rootDir.parent_path() / "db" / "slicer.sql"}, "user=postgres dbname=postgres")
diff --git a/slicer/db/testMockCommon.h b/slicer/db/testMockCommon.h
index c775ae0..e12d2c6 100644
--- a/slicer/db/testMockCommon.h
+++ b/slicer/db/testMockCommon.h
@@ -1,9 +1,14 @@
#ifndef SLICER_DB_MOCKDB_H
#define SLICER_DB_MOCKDB_H
+#include <connection_fwd.h>
#include <mockDatabase.h>
#include <pq-mock.h>
#include <visibility.h>
+// IWYU pragma: no_forward_declare PQ::Mock
+namespace DB {
+ class Connection;
+}
class DLL_PUBLIC StandardMockDatabase : public DB::PluginMock<PQ::Mock> {
public:
diff --git a/slicer/db/testPatch.cpp b/slicer/db/testPatch.cpp
index 5dc5991..6db440a 100644
--- a/slicer/db/testPatch.cpp
+++ b/slicer/db/testPatch.cpp
@@ -1,14 +1,23 @@
#define BOOST_TEST_MODULE db_patch
+#include <boost/test/unit_test.hpp>
+
+#include "classes.h"
+#include "collections.h"
+#include "slicer/slicer.h"
#include "sqlSelectDeserializer.h"
#include "sqlTablePatchSerializer.h"
#include "testMockCommon.h"
-#include <boost/date_time/posix_time/posix_time_io.hpp>
-#include <boost/test/unit_test.hpp>
-#include <common.h>
#include <connection.h>
-#include <slicer/slicer.h>
-#include <testModels.h>
-#include <types.h>
+#include <memory>
+#include <string>
+#include <tablepatch.h>
+namespace TestDatabase {
+ class Timespan;
+}
+namespace TestModule {
+ struct DateTime;
+ struct IsoDate;
+}
// LCOV_EXCL_START
BOOST_TEST_DONT_PRINT_LOG_VALUE(TestModule::DateTime)
diff --git a/slicer/db/testSelect.cpp b/slicer/db/testSelect.cpp
index cbceb02..9759233 100644
--- a/slicer/db/testSelect.cpp
+++ b/slicer/db/testSelect.cpp
@@ -1,14 +1,27 @@
#define BOOST_TEST_MODULE db_select
+#include <boost/test/unit_test.hpp>
+
+#include "classes.h"
+#include "collections.h"
+#include "common.h"
+#include "inheritance.h"
+#include "optionals.h"
+#include "slicer/slicer.h"
+#include "sqlExceptions.h"
#include "sqlSelectDeserializer.h"
+#include "structs.h"
#include "testMockCommon.h"
-#include <boost/date_time/posix_time/posix_time_io.hpp>
-#include <boost/test/unit_test.hpp>
-#include <common.h>
+#include "testModels.h"
+#include <Ice/Config.h>
+#include <Ice/Optional.h>
#include <connection.h>
-#include <slicer/slicer.h>
-#include <sqlExceptions.h>
-#include <testModels.h>
-#include <types.h>
+#include <memory>
+#include <string>
+#include <string_view>
+#include <vector>
+// IWYU pragma: no_forward_declare Slicer::NoRowsReturned
+// IWYU pragma: no_forward_declare Slicer::TooManyRowsReturned
+// IWYU pragma: no_forward_declare Slicer::UnsupportedModelType
using namespace std::literals;
diff --git a/slicer/db/testUpdate.cpp b/slicer/db/testUpdate.cpp
index 04fbdaf..e6368e4 100644
--- a/slicer/db/testUpdate.cpp
+++ b/slicer/db/testUpdate.cpp
@@ -1,15 +1,24 @@
#define BOOST_TEST_MODULE db_update
+#include "classes.h"
+#include "collections.h"
+#include "common.h"
+#include "slicer/slicer.h"
+#include "sqlExceptions.h"
#include "sqlInsertSerializer.h"
#include "sqlSelectDeserializer.h"
#include "sqlUpdateSerializer.h"
#include "testMockCommon.h"
-#include <boost/date_time/posix_time/posix_time_io.hpp>
+#include "testModels.h"
+#include <Ice/Config.h>
+#include <Ice/Optional.h>
#include <boost/test/unit_test.hpp>
-#include <common.h>
-#include <slicer/slicer.h>
-#include <sqlExceptions.h>
-#include <testModels.h>
-#include <types.h>
+#include <connection.h>
+#include <memory>
+#include <string>
+#include <string_view>
+#include <vector>
+// IWYU pragma: no_forward_declare Slicer::NoRowsFound
+// IWYU pragma: no_forward_declare Slicer::UnsupportedModelType
using namespace std::literals;
@@ -94,8 +103,7 @@ BOOST_AUTO_TEST_CASE(update_withNulls)
bis[1]->mbyte = Ice::optional<Ice::Byte>();
bis[0]->mshort = Ice::optional<Ice::Short>();
bis[1]->mdouble = Ice::optional<Ice::Double>();
- BOOST_TEST_CHECKPOINT("Do update");
- Slicer::SerializeAny<Slicer::SqlUpdateSerializer>(bis, db, "builtins");
+ BOOST_REQUIRE_NO_THROW(Slicer::SerializeAny<Slicer::SqlUpdateSerializer>(bis, db, "builtins"));
auto bis2 = Slicer::DeserializeAny<Slicer::SqlSelectDeserializer, TestDatabase::BuiltInSeq>(sel.get());
BOOST_REQUIRE(bis2[0]->mstring);
BOOST_REQUIRE(!bis2[1]->mstring);
diff --git a/slicer/ice/serializer.cpp b/slicer/ice/serializer.cpp
index 523b977..102e958 100644
--- a/slicer/ice/serializer.cpp
+++ b/slicer/ice/serializer.cpp
@@ -1,6 +1,12 @@
#include "serializer.h"
-#include "Ice/Communicator.h"
-#include "Ice/Initialize.h"
+#include <Ice/Communicator.h>
+#include <Ice/Initialize.h>
+#include <Ice/InputStream.h>
+#include <Ice/OutputStream.h>
+#include <factory.h>
+#include <istream>
+#include <iterator>
+#include <memory>
NAMEDFACTORY("application/ice", Slicer::IceStreamSerializer, Slicer::StreamSerializerFactory)
NAMEDFACTORY("application/ice", Slicer::IceStreamDeserializer, Slicer::StreamDeserializerFactory)
diff --git a/slicer/ice/serializer.h b/slicer/ice/serializer.h
index cbead6f..f507c58 100644
--- a/slicer/ice/serializer.h
+++ b/slicer/ice/serializer.h
@@ -1,8 +1,10 @@
#ifndef SLICER_ICE_H
#define SLICER_ICE_H
+#include "modelParts.h"
#include <Ice/BuiltinSequences.h>
#include <Ice/CommunicatorF.h>
+#include <iosfwd>
#include <slicer/serializer.h>
#include <visibility.h>
diff --git a/slicer/ice/testSpecifics.cpp b/slicer/ice/testSpecifics.cpp
index 3786112..715ccbd 100644
--- a/slicer/ice/testSpecifics.cpp
+++ b/slicer/ice/testSpecifics.cpp
@@ -1,9 +1,19 @@
#define BOOST_TEST_MODULE ice_specifics
#include <boost/test/unit_test.hpp>
+#include "classes.h"
#include "serializer.h"
+#include "structs.h"
+#include <Ice/Comparable.h>
+#include <Ice/Config.h>
+#include <Ice/Optional.h>
+#include <functional>
+#include <iosfwd>
+#include <memory>
#include <slicer.h>
-#include <types.h>
+#include <string>
+#include <typeinfo>
+// IWYU pragma: no_forward_declare Slicer::IceStreamDeserializer
// LCOV_EXCL_START
// cppcheck-suppress unknownMacro
@@ -14,22 +24,24 @@ template<typename X>
void
testCompare(const X & x)
{
- BOOST_TEST_CHECKPOINT(typeid(X).name());
- std::stringstream strm;
- Slicer::SerializeAny<Slicer::IceStreamSerializer>(x, strm);
- auto x2 = Slicer::DeserializeAny<Slicer::IceStreamDeserializer, X>(strm);
- BOOST_REQUIRE_EQUAL(x, x2);
+ BOOST_TEST_CONTEXT(typeid(X).name()) {
+ std::stringstream strm;
+ Slicer::SerializeAny<Slicer::IceStreamSerializer>(x, strm);
+ auto x2 = Slicer::DeserializeAny<Slicer::IceStreamDeserializer, X>(strm);
+ BOOST_REQUIRE_EQUAL(x, x2);
+ }
}
template<typename X>
void
testCompare(const X & x, const std::function<bool(const X &, const X &)> & cmp)
{
- BOOST_TEST_CHECKPOINT(typeid(X).name());
- std::stringstream strm;
- Slicer::SerializeAny<Slicer::IceStreamSerializer>(x, strm);
- auto x2 = Slicer::DeserializeAny<Slicer::IceStreamDeserializer, X>(strm);
- BOOST_REQUIRE(cmp(x, x2));
+ BOOST_TEST_CONTEXT(typeid(X).name()) {
+ std::stringstream strm;
+ Slicer::SerializeAny<Slicer::IceStreamSerializer>(x, strm);
+ auto x2 = Slicer::DeserializeAny<Slicer::IceStreamDeserializer, X>(strm);
+ BOOST_REQUIRE(cmp(x, x2));
+ }
}
BOOST_AUTO_TEST_CASE(builtins)
@@ -55,16 +67,17 @@ template<typename X>
void
testCompareOptional(const X & d)
{
- BOOST_TEST_CHECKPOINT(typeid(X).name());
- std::stringstream strm;
- Ice::optional<X> x;
- Slicer::SerializeAny<Slicer::IceStreamSerializer>(x, strm);
- auto x2 = Slicer::DeserializeAny<Slicer::IceStreamDeserializer, Ice::optional<X>>(strm);
- BOOST_REQUIRE(!x2);
- x = d;
- Slicer::SerializeAny<Slicer::IceStreamSerializer>(x, strm);
- auto x3 = Slicer::DeserializeAny<Slicer::IceStreamDeserializer, Ice::optional<X>>(strm);
- BOOST_REQUIRE_EQUAL(d, *x3);
+ BOOST_TEST_CONTEXT(typeid(X).name()) {
+ std::stringstream strm;
+ Ice::optional<X> x;
+ Slicer::SerializeAny<Slicer::IceStreamSerializer>(x, strm);
+ auto x2 = Slicer::DeserializeAny<Slicer::IceStreamDeserializer, Ice::optional<X>>(strm);
+ BOOST_REQUIRE(!x2);
+ x = d;
+ Slicer::SerializeAny<Slicer::IceStreamSerializer>(x, strm);
+ auto x3 = Slicer::DeserializeAny<Slicer::IceStreamDeserializer, Ice::optional<X>>(strm);
+ BOOST_REQUIRE_EQUAL(d, *x3);
+ }
}
BOOST_AUTO_TEST_CASE(optionalBuiltins)
diff --git a/slicer/json/serializer.cpp b/slicer/json/serializer.cpp
index 4d50501..893b494 100644
--- a/slicer/json/serializer.cpp
+++ b/slicer/json/serializer.cpp
@@ -1,11 +1,19 @@
#include "serializer.h"
+#include <Ice/Config.h>
#include <boost/numeric/conversion/cast.hpp>
-#include <fstream>
+#include <cmath>
+#include <factory.h>
+#include <fstream> // IWYU pragma: keep
#include <functional>
#include <glibmm/ustring.h>
#include <jsonpp.h>
-#include <slicer/metadata.h>
-#include <stdexcept>
+#include <map>
+#include <memory>
+#include <optional>
+#include <string_view>
+#include <utility>
+#include <variant>
+#include <vector>
NAMEDFACTORY(".js", Slicer::JsonFileSerializer, Slicer::FileSerializerFactory)
NAMEDFACTORY(".js", Slicer::JsonFileDeserializer, Slicer::FileDeserializerFactory)
diff --git a/slicer/json/serializer.h b/slicer/json/serializer.h
index c23121b..ef79b47 100644
--- a/slicer/json/serializer.h
+++ b/slicer/json/serializer.h
@@ -1,8 +1,12 @@
#ifndef SLICER_JSON_H
#define SLICER_JSON_H
+#include "modelParts.h"
+#include "slicer/serializer.h"
+#include <filesystem>
+#include <iosfwd>
#include <jsonpp.h>
-#include <slicer/serializer.h>
+#include <string>
#include <visibility.h>
namespace Slicer {
diff --git a/slicer/json/testSpecifics.cpp b/slicer/json/testSpecifics.cpp
index 92c699b..19bb47c 100644
--- a/slicer/json/testSpecifics.cpp
+++ b/slicer/json/testSpecifics.cpp
@@ -2,8 +2,7 @@
#include <boost/test/unit_test.hpp>
#include "serializer.h"
-#include <slicer/slicer.h>
-#include <types.h>
+#include <iostream>
BOOST_AUTO_TEST_CASE(factories)
{
diff --git a/slicer/slicer/enum-test.cpp b/slicer/slicer/enum-test.cpp
index 04ca9df..25723d9 100644
--- a/slicer/slicer/enum-test.cpp
+++ b/slicer/slicer/enum-test.cpp
@@ -1,4 +1,6 @@
#include "enumMap.h"
+#include <string>
+#include <string_view>
namespace test {
enum class Es { one, two, three };
diff --git a/slicer/slicer/hook-test.cpp b/slicer/slicer/hook-test.cpp
index abde1c5..b5b0701 100644
--- a/slicer/slicer/hook-test.cpp
+++ b/slicer/slicer/hook-test.cpp
@@ -1,7 +1,11 @@
#include "hookMap.h"
+#include "modelPartsTypes.h"
#include "modelPartsTypes.impl.h"
-
+#include <array>
+#include <iterator>
#include <string>
+#include <string_view>
+#include <utility>
namespace test {
struct S {
diff --git a/slicer/slicer/metadata-test.cpp b/slicer/slicer/metadata-test.cpp
index 1fe9cec..f6263f1 100644
--- a/slicer/slicer/metadata-test.cpp
+++ b/slicer/slicer/metadata-test.cpp
@@ -1,4 +1,9 @@
#include "metadata.h"
+#include <array>
+#include <optional>
+#include <string>
+#include <string_view>
+#include <utility>
namespace test {
constexpr auto rc = [](std::string_view sv) {
diff --git a/slicer/slicer/modelParts.h b/slicer/slicer/modelParts.h
index ac7aa4f..1986a95 100644
--- a/slicer/slicer/modelParts.h
+++ b/slicer/slicer/modelParts.h
@@ -3,6 +3,7 @@
#include "metadata.h"
#include <Ice/Config.h>
+#include <c++11Helpers.h>
#include <functional>
#include <memory>
#include <optional>
@@ -18,8 +19,10 @@ namespace Ice {
namespace Slicer {
template<typename T> class TValueTarget {
public:
+ constexpr TValueTarget() = default;
virtual ~TValueTarget() = default;
virtual void get(const T &) const = 0;
+ SPECIAL_MEMBERS_DEFAULT(TValueTarget);
};
class ValueTarget :
public TValueTarget<bool>,
@@ -43,8 +46,10 @@ namespace Slicer {
template<typename T> class TValueSource {
public:
+ constexpr TValueSource() = default;
virtual ~TValueSource() = default;
virtual void set(T &) const = 0;
+ SPECIAL_MEMBERS_DEFAULT(TValueSource);
};
class ValueSource :
public TValueSource<bool>,
@@ -115,6 +120,7 @@ namespace Slicer {
{
}
virtual ~HookCommon() = default;
+ SPECIAL_MEMBERS_DEFAULT(HookCommon);
[[nodiscard]] bool filter(const HookFilter & flt) const;
void apply(const ChildHandler & ch, const ModelPartPtr & modelPart) const;
diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h
index 9caac5f..0355c62 100644
--- a/slicer/slicer/modelPartsTypes.h
+++ b/slicer/slicer/modelPartsTypes.h
@@ -3,6 +3,7 @@
#include "modelParts.h"
#include <Ice/Optional.h>
+#include <c++11Helpers.h>
#include <cstddef>
#include <functional>
#include <memory>
@@ -324,7 +325,9 @@ namespace Slicer {
using Consumer = std::function<void(const T &)>;
using element_type = T;
+ constexpr Stream() = default;
virtual ~Stream() = default;
+ SPECIAL_MEMBERS_DEFAULT(Stream);
virtual void Produce(const Consumer & c) = 0;
};
diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h
index dc97148..ef07248 100644
--- a/slicer/slicer/modelPartsTypes.impl.h
+++ b/slicer/slicer/modelPartsTypes.impl.h
@@ -385,7 +385,8 @@ namespace Slicer {
{
static_assert(sizeof...(MD) == N, "Wrong amount of metadata");
}
- ~Hook() = default;
+ ~Hook() override = default;
+ SPECIAL_MEMBERS_DEFAULT(Hook);
[[nodiscard]] const Metadata &
GetMetadata() const override
diff --git a/slicer/test/compilation.cpp b/slicer/test/compilation.cpp
index 42f0759..2920e99 100644
--- a/slicer/test/compilation.cpp
+++ b/slicer/test/compilation.cpp
@@ -1,10 +1,20 @@
#define BOOST_TEST_MODULE compilation
#include <boost/test/unit_test.hpp>
-#include <locals.h>
-#include <slicer/modelParts.h>
-#include <slicer/modelPartsTypes.h>
-#include <types.h>
+#include "classes.h"
+#include "classtype.h"
+#include "collections.h"
+#include "enums.h"
+#include "inheritance.h"
+#include "locals.h"
+#include "slicer/modelParts.h"
+#include "structs.h"
+#include <Ice/Config.h>
+#include <memory>
+#include <optional>
+#include <string>
+#include <typeinfo>
+#include <vector>
// LCOV_EXCL_START
// cppcheck-suppress unknownMacro
@@ -22,9 +32,10 @@ BOOST_TEST_DONT_PRINT_LOG_VALUE(Slicer::ModelPartType)
auto mppvalue = mpp.get(); \
auto amppvalue = mpp.get(); \
auto apmppvalue = mpp.get(); \
- BOOST_TEST_CHECKPOINT(typeid(*mppvalue).name()); \
- BOOST_REQUIRE_EQUAL(typeid(*mppvalue), typeid(*amppvalue)); \
- BOOST_REQUIRE_EQUAL(typeid(*mppvalue), typeid(*apmppvalue)); \
+ BOOST_TEST_CONTEXT(typeid(*mppvalue).name()) { \
+ BOOST_REQUIRE_EQUAL(typeid(*mppvalue), typeid(*amppvalue)); \
+ BOOST_REQUIRE_EQUAL(typeid(*mppvalue), typeid(*apmppvalue)); \
+ } \
}
#define StackTypeTest(Var, Explicit, Expected) TypeTest(Var, Var(), Explicit, Expected)
diff --git a/slicer/test/conversions.cpp b/slicer/test/conversions.cpp
index ff4371a..400daa0 100644
--- a/slicer/test/conversions.cpp
+++ b/slicer/test/conversions.cpp
@@ -1,5 +1,16 @@
#include "conversions.h"
+#include "modelParts.h"
+#include "modelPartsTypes.h"
+#include <boost/date_time/date.hpp>
+#include <boost/date_time/gregorian_calendar.hpp>
+#include <boost/date_time/time.hpp>
#include <boost/numeric/conversion/cast.hpp>
+#include <cstdint>
+#include <cstdio>
+#include <ctime>
+#include <memory>
+#include <stdexcept>
+#include <visibility.h>
#define SHORT(x) boost::numeric_cast<::Ice::Short, int64_t>(x)
inline auto
diff --git a/slicer/test/conversions.h b/slicer/test/conversions.h
index 8bd376f..cb46b93 100644
--- a/slicer/test/conversions.h
+++ b/slicer/test/conversions.h
@@ -1,9 +1,14 @@
#ifndef SLICER_TEST_CONVERSIONS_H
#define SLICER_TEST_CONVERSIONS_H
-#include <boost/date_time/posix_time/posix_time_types.hpp>
+#include "classtype.h"
+#include "structs.h"
+#include <Ice/Config.h>
+#include <Ice/Optional.h>
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <optional>
#include <slicer/modelPartsTypes.h>
-#include <types.h>
+#include <string>
#include <visibility.h>
namespace TestModule {
diff --git a/slicer/test/helpers.cpp b/slicer/test/helpers.cpp
index 808e9d0..151abeb 100644
--- a/slicer/test/helpers.cpp
+++ b/slicer/test/helpers.cpp
@@ -1,6 +1,10 @@
#include "helpers.h"
-#include <boost/test/test_tools.hpp>
+#include <algorithm>
+#include <boost/test/unit_test.hpp>
+#include <cctype>
#include <fstream>
+#include <iterator>
+#include <string>
void
diff(const std::filesystem::path & left, const std::filesystem::path & right)
diff --git a/slicer/test/helpers.h b/slicer/test/helpers.h
index b5db1bf..576a481 100644
--- a/slicer/test/helpers.h
+++ b/slicer/test/helpers.h
@@ -2,7 +2,6 @@
#define SLICER_TEST_HELPERS_H
#include <filesystem>
-#include <string>
#include <visibility.h>
// These are just thin wrappers that throw exceptions
diff --git a/slicer/test/preprocessor.cpp b/slicer/test/preprocessor.cpp
index 463683c..7f9fefd 100644
--- a/slicer/test/preprocessor.cpp
+++ b/slicer/test/preprocessor.cpp
@@ -1,13 +1,16 @@
#define BOOST_TEST_MODULE preprocess
#include <boost/test/unit_test.hpp>
-#include "helpers.h"
-#include <boost/format.hpp>
-#include <buffer.h>
-#include <common.h>
+#include "tool/icemetadata.h"
+#include "tool/parser.h"
+#include <cstdio>
#include <definedDirs.h>
+#include <filesystem>
+#include <map>
#include <numeric>
-#include <tool/parser.h>
+#include <string>
+#include <utility>
+#include <vector>
using ComponentsCount = std::map<std::string, unsigned int>;
ComponentsCount COMPONENTS_IN_TEST_ICE = {{"classtype.ice", 2}, {"classes.ice", 3}, {"collections.ice", 5},
@@ -41,8 +44,9 @@ processAll(Slicer::Slicer & s)
s.includes.push_back(rootDir / "included");
s.includes.push_back(rootDir);
for (const auto & c : COMPONENTS_IN_TEST_ICE) {
- BOOST_TEST_CHECKPOINT(c.first);
- process(s, c);
+ BOOST_TEST_CONTEXT(c.first) {
+ process(s, c);
+ }
}
BOOST_REQUIRE_EQUAL(total(), s.Components());
}
diff --git a/slicer/test/serializers.cpp b/slicer/test/serializers.cpp
index 848e933..68998e4 100644
--- a/slicer/test/serializers.cpp
+++ b/slicer/test/serializers.cpp
@@ -1,24 +1,45 @@
#define BOOST_TEST_MODULE execute_serializers
#include <boost/test/unit_test.hpp>
+#include "classes.h"
+#include "classtype.h"
+#include "collections.h"
+#include "common.h"
#include "conversions.h"
+#include "enums.h"
+#include "functions.h"
#include "helpers.h"
-#include <boost/format.hpp>
-#include <common.h>
+#include "inheritance.h"
+#include "modelPartsTypes.h"
+#include "optionals.h"
+#include "structs.h"
+#include "xml/serializer.h"
+#include <Ice/Config.h>
+#include <Ice/Optional.h>
+#include <boost/test/unit_test_log.hpp>
#include <definedDirs.h>
+#include <filesystem>
#include <fstream>
#include <functional>
-#include <functionsImpl.h>
+#include <glibmm/ustring.h>
#include <json.h>
#include <json/serializer.h>
+#include <jsonpp.h>
+#include <libxml++/document.h>
#include <libxml2/libxml/parser.h>
#include <locals.h>
+#include <map>
+#include <memory>
#include <modelParts.h>
#include <slicer.h>
-#include <tool/parser.h>
+#include <sstream>
+#include <string>
#include <types.h>
+#include <utility>
+#include <variant>
+#include <vector>
#include <xml.h>
-#include <xml/serializer.h>
+// IWYU pragma: no_forward_declare Slicer::InvalidEnumerationSymbol
#ifdef SLICER_MODELPARTSTYPES_IMPL_H
# error Client code should NOT need to pull in implementation header
diff --git a/slicer/test/streams.cpp b/slicer/test/streams.cpp
index f5284eb..d2667b0 100644
--- a/slicer/test/streams.cpp
+++ b/slicer/test/streams.cpp
@@ -2,12 +2,16 @@
#include <boost/test/unit_test.hpp>
#include "helpers.h"
+#include "modelPartsTypes.h"
#include "streams.h"
+#include "xml/serializer.h"
+#include "json/serializer.h"
#include <collections.h>
#include <definedDirs.h>
-#include <json/serializer.h>
+#include <filesystem>
#include <slicer.h>
-#include <xml/serializer.h>
+#include <string>
+#include <vector>
void
TestStream::Produce(const Consumer & c)
diff --git a/slicer/test/streams.h b/slicer/test/streams.h
index bf80ce2..8d3a79f 100644
--- a/slicer/test/streams.h
+++ b/slicer/test/streams.h
@@ -2,6 +2,7 @@
#define SLICER_TEST_STREAMS_H
#include <slicer/modelPartsTypes.h>
+#include <string>
class TestStream : public Slicer::Stream<std::string> {
public:
diff --git a/slicer/xml/serializer.cpp b/slicer/xml/serializer.cpp
index 1ac6a63..dcec688 100644
--- a/slicer/xml/serializer.cpp
+++ b/slicer/xml/serializer.cpp
@@ -9,12 +9,25 @@
# pragma GCC diagnostic ignored "-Wuseless-cast"
#endif
#include <glibmm/ustring.h>
+#include <libxml++/attribute.h>
+#include <libxml++/nodes/contentnode.h>
+#include <libxml++/nodes/element.h>
+#include <libxml++/nodes/node.h>
#pragma GCC diagnostic pop
+#include <Ice/Config.h>
+#include <boost/numeric/conversion/cast.hpp>
+#include <factory.h>
+#include <lazyPointer.h>
#include <libxml++/document.h>
#include <libxml++/parsers/domparser.h>
+#include <list>
+#include <memory>
+#include <optional>
#include <slicer/metadata.h>
-#include <stdexcept>
+#include <string_view>
+#include <utility>
#include <xmlExceptions.h>
+// IWYU pragma: no_include <boost/detail/basic_pointerbuf.hpp>
NAMEDFACTORY(".xml", Slicer::XmlFileSerializer, Slicer::FileSerializerFactory)
NAMEDFACTORY(".xml", Slicer::XmlFileDeserializer, Slicer::FileDeserializerFactory)
diff --git a/slicer/xml/serializer.h b/slicer/xml/serializer.h
index 522b1e9..b2c0b7c 100644
--- a/slicer/xml/serializer.h
+++ b/slicer/xml/serializer.h
@@ -8,11 +8,22 @@
#ifndef __clang__
# pragma GCC diagnostic ignored "-Wuseless-cast"
#endif
-#include <libxml++/document.h>
#include <libxml++/nodes/element.h>
#pragma GCC diagnostic pop
+#include "modelParts.h"
+#include <filesystem>
+#include <functional>
+#include <iosfwd>
#include <slicer/serializer.h>
+#include <string>
#include <visibility.h>
+namespace Glib {
+ class ustring;
+}
+namespace xmlpp {
+ class Document;
+ class Node;
+}
namespace Slicer {
using CurrentElementCreator = ::AdHoc::LazyPointer<xmlpp::Element, xmlpp::Element *>;
@@ -57,6 +68,7 @@ namespace Slicer {
void Serialize(ModelPartForRootPtr) override;
protected:
+ // cppcheck-suppress unsafeClassCanLeak
xmlpp::Document *& doc;
};
diff --git a/slicer/xml/testSpecifics.cpp b/slicer/xml/testSpecifics.cpp
index d2c2d22..0b086b1 100644
--- a/slicer/xml/testSpecifics.cpp
+++ b/slicer/xml/testSpecifics.cpp
@@ -2,10 +2,13 @@
#include <boost/test/unit_test.hpp>
#include "serializer.h"
+#include <Ice/Config.h>
+#include <iostream>
#include <libxml++/parsers/domparser.h>
#include <slicer/slicer.h>
-#include <types.h>
+#include <typeinfo>
#include <xmlExceptions.h>
+// IWYU pragma: no_forward_declare Slicer::BadBooleanValue
template<typename T, typename... P>
T