From 22d21fcd58c8cd872c90caed84f62bd9798e7427 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 25 Sep 2021 11:53:38 +0100 Subject: Pass nearly all the tidy checks clang-tidy and cppcheck for everything, everything but generated code for IWYU --- Jamroot.jam | 2 +- iwyu.json | 8 +++++ slicer/db/sqlBinder.cpp | 1 + slicer/db/sqlBinder.h | 9 ++++-- slicer/db/sqlCommon.cpp | 3 +- slicer/db/sqlCommon.h | 5 ++-- slicer/db/sqlInsertSerializer.cpp | 11 ++++--- slicer/db/sqlInsertSerializer.h | 8 ++++- slicer/db/sqlSelectDeserializer.cpp | 8 +++-- slicer/db/sqlSelectDeserializer.h | 9 ++++-- slicer/db/sqlSource.cpp | 3 ++ slicer/db/sqlSource.h | 14 +++++++-- slicer/db/sqlTablePatchSerializer.cpp | 8 +++-- slicer/db/sqlTablePatchSerializer.h | 8 +++-- slicer/db/sqlUpdateSerializer.cpp | 5 +++- slicer/db/sqlUpdateSerializer.h | 8 ++++- slicer/db/testConversions.cpp | 5 +++- slicer/db/testInsert.cpp | 22 ++++++++++---- slicer/db/testMockCommon.cpp | 5 ++++ slicer/db/testMockCommon.h | 5 ++++ slicer/db/testPatch.cpp | 21 +++++++++---- slicer/db/testSelect.cpp | 27 ++++++++++++----- slicer/db/testUpdate.cpp | 24 ++++++++++----- slicer/ice/serializer.cpp | 10 +++++-- slicer/ice/serializer.h | 2 ++ slicer/ice/testSpecifics.cpp | 55 ++++++++++++++++++++++------------- slicer/json/serializer.cpp | 14 +++++++-- slicer/json/serializer.h | 6 +++- slicer/json/testSpecifics.cpp | 3 +- slicer/slicer/enum-test.cpp | 2 ++ slicer/slicer/hook-test.cpp | 6 +++- slicer/slicer/metadata-test.cpp | 5 ++++ slicer/slicer/modelParts.h | 6 ++++ slicer/slicer/modelPartsTypes.h | 3 ++ slicer/slicer/modelPartsTypes.impl.h | 3 +- slicer/test/compilation.cpp | 25 +++++++++++----- slicer/test/conversions.cpp | 11 +++++++ slicer/test/conversions.h | 9 ++++-- slicer/test/helpers.cpp | 6 +++- slicer/test/helpers.h | 1 - slicer/test/preprocessor.cpp | 18 +++++++----- slicer/test/serializers.cpp | 31 ++++++++++++++++---- slicer/test/streams.cpp | 8 +++-- slicer/test/streams.h | 1 + slicer/xml/serializer.cpp | 15 +++++++++- slicer/xml/serializer.h | 14 ++++++++- slicer/xml/testSpecifics.cpp | 5 +++- 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 tidy:db/bin/tidy/debug/checker-none/cxxstd-20-iso/visibility-hidden/testModels.h tidy:ice/cpp/* tidy:ICE_IGNORE_VERSION - tidy:ICE_MEMBER + tidy:ICE_MEMBER_IMPORT_EXPORT tidy:__x86_64 tidy:boost tidy:std diff --git a/iwyu.json b/iwyu.json index 81b7e04..ddb8514 100644 --- a/iwyu.json +++ b/iwyu.json @@ -15,6 +15,14 @@ "public" ] }, + { + "symbol": [ + "tm", + "private", + "", + "public" + ] + }, { "symbol": [ "boost::posix_time::time_duration", 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 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 -#include +#include +#include +#include #include +#include +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 -#include +#include #include +#include 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 -#include - 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 #include -#include +#include #include +#include #include +#include #include -#include -#include -#include +#include 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 +#include "modelParts.h" +#include #include #include +#include #include +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 -#include +#include +#include +#include +#include namespace Slicer { SqlSelectDeserializer::SqlSelectDeserializer(DB::SelectCommand * c, std::optional 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 -#include +#include "modelParts.h" +#include "slicer/serializer.h" +#include +#include #include +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 #include +#include +#include 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 -#include -#include +#include "slicer/modelParts.h" +#include +#include +#include +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 -#include +#include +#include #include -#include +#include +#include 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 +#include "modelParts.h" #include -#include +#include +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 #include #include +#include #include +#include #include -#include #include +#include 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 +#include "modelParts.h" +#include #include +#include #include +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 +#include +#include #include +#include +#include #include #include 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 + +#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 -#include -#include -#include -#include -#include +#include "testModels.h" +#include +#include +#include +#include +#include +#include +#include +// 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 #include +#include +#include +#include +#include StandardMockDatabase::StandardMockDatabase() : DB::PluginMock("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 #include #include #include +// IWYU pragma: no_forward_declare PQ::Mock +namespace DB { + class Connection; +} class DLL_PUBLIC StandardMockDatabase : public DB::PluginMock { 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 + +#include "classes.h" +#include "collections.h" +#include "slicer/slicer.h" #include "sqlSelectDeserializer.h" #include "sqlTablePatchSerializer.h" #include "testMockCommon.h" -#include -#include -#include #include -#include -#include -#include +#include +#include +#include +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 + +#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 -#include -#include +#include "testModels.h" +#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include +// 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 +#include "testModels.h" +#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +// 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(); bis[0]->mshort = Ice::optional(); bis[1]->mdouble = Ice::optional(); - BOOST_TEST_CHECKPOINT("Do update"); - Slicer::SerializeAny(bis, db, "builtins"); + BOOST_REQUIRE_NO_THROW(Slicer::SerializeAny(bis, db, "builtins")); auto bis2 = Slicer::DeserializeAny(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 +#include +#include +#include +#include +#include +#include +#include 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 #include +#include #include #include 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 +#include "classes.h" #include "serializer.h" +#include "structs.h" +#include +#include +#include +#include +#include +#include #include -#include +#include +#include +// IWYU pragma: no_forward_declare Slicer::IceStreamDeserializer // LCOV_EXCL_START // cppcheck-suppress unknownMacro @@ -14,22 +24,24 @@ template void testCompare(const X & x) { - BOOST_TEST_CHECKPOINT(typeid(X).name()); - std::stringstream strm; - Slicer::SerializeAny(x, strm); - auto x2 = Slicer::DeserializeAny(strm); - BOOST_REQUIRE_EQUAL(x, x2); + BOOST_TEST_CONTEXT(typeid(X).name()) { + std::stringstream strm; + Slicer::SerializeAny(x, strm); + auto x2 = Slicer::DeserializeAny(strm); + BOOST_REQUIRE_EQUAL(x, x2); + } } template void testCompare(const X & x, const std::function & cmp) { - BOOST_TEST_CHECKPOINT(typeid(X).name()); - std::stringstream strm; - Slicer::SerializeAny(x, strm); - auto x2 = Slicer::DeserializeAny(strm); - BOOST_REQUIRE(cmp(x, x2)); + BOOST_TEST_CONTEXT(typeid(X).name()) { + std::stringstream strm; + Slicer::SerializeAny(x, strm); + auto x2 = Slicer::DeserializeAny(strm); + BOOST_REQUIRE(cmp(x, x2)); + } } BOOST_AUTO_TEST_CASE(builtins) @@ -55,16 +67,17 @@ template void testCompareOptional(const X & d) { - BOOST_TEST_CHECKPOINT(typeid(X).name()); - std::stringstream strm; - Ice::optional x; - Slicer::SerializeAny(x, strm); - auto x2 = Slicer::DeserializeAny>(strm); - BOOST_REQUIRE(!x2); - x = d; - Slicer::SerializeAny(x, strm); - auto x3 = Slicer::DeserializeAny>(strm); - BOOST_REQUIRE_EQUAL(d, *x3); + BOOST_TEST_CONTEXT(typeid(X).name()) { + std::stringstream strm; + Ice::optional x; + Slicer::SerializeAny(x, strm); + auto x2 = Slicer::DeserializeAny>(strm); + BOOST_REQUIRE(!x2); + x = d; + Slicer::SerializeAny(x, strm); + auto x3 = Slicer::DeserializeAny>(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 #include -#include +#include +#include +#include // IWYU pragma: keep #include #include #include -#include -#include +#include +#include +#include +#include +#include +#include +#include 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 +#include #include -#include +#include #include 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 #include "serializer.h" -#include -#include +#include 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 +#include 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 +#include #include +#include +#include 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 +#include +#include +#include +#include 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 +#include #include #include #include @@ -18,8 +19,10 @@ namespace Ice { namespace Slicer { template class TValueTarget { public: + constexpr TValueTarget() = default; virtual ~TValueTarget() = default; virtual void get(const T &) const = 0; + SPECIAL_MEMBERS_DEFAULT(TValueTarget); }; class ValueTarget : public TValueTarget, @@ -43,8 +46,10 @@ namespace Slicer { template class TValueSource { public: + constexpr TValueSource() = default; virtual ~TValueSource() = default; virtual void set(T &) const = 0; + SPECIAL_MEMBERS_DEFAULT(TValueSource); }; class ValueSource : public TValueSource, @@ -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 +#include #include #include #include @@ -324,7 +325,9 @@ namespace Slicer { using Consumer = std::function; 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 -#include -#include -#include -#include +#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 +#include +#include +#include +#include +#include // 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 +#include +#include #include +#include +#include +#include +#include +#include +#include #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 +#include "classtype.h" +#include "structs.h" +#include +#include +#include +#include #include -#include +#include #include 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 +#include +#include +#include #include +#include +#include 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 -#include #include // 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 -#include "helpers.h" -#include -#include -#include +#include "tool/icemetadata.h" +#include "tool/parser.h" +#include #include +#include +#include #include -#include +#include +#include +#include using ComponentsCount = std::map; 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 +#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 -#include +#include "inheritance.h" +#include "modelPartsTypes.h" +#include "optionals.h" +#include "structs.h" +#include "xml/serializer.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 +// 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 #include "helpers.h" +#include "modelPartsTypes.h" #include "streams.h" +#include "xml/serializer.h" +#include "json/serializer.h" #include #include -#include +#include #include -#include +#include +#include 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 +#include class TestStream : public Slicer::Stream { 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 +#include +#include +#include +#include #pragma GCC diagnostic pop +#include +#include +#include +#include #include #include +#include +#include +#include #include -#include +#include +#include #include +// IWYU pragma: no_include 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 #include #pragma GCC diagnostic pop +#include "modelParts.h" +#include +#include +#include #include +#include #include +namespace Glib { + class ustring; +} +namespace xmlpp { + class Document; + class Node; +} namespace Slicer { using CurrentElementCreator = ::AdHoc::LazyPointer; @@ -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 #include "serializer.h" +#include +#include #include #include -#include +#include #include +// IWYU pragma: no_forward_declare Slicer::BadBooleanValue template T -- cgit v1.2.3