From 05e301153ce43d6dd23515444396e375aa10a285 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 23 Sep 2021 19:43:19 +0100 Subject: Add -Wpedantic --- Jamroot.jam | 1 + slicer/db/testInsert.cpp | 10 +++++----- slicer/db/testPatch.cpp | 12 ++++++------ slicer/db/testSelect.cpp | 4 ++-- slicer/db/testUpdate.cpp | 4 ++-- slicer/ice/serializer.cpp | 4 ++-- slicer/ice/testSpecifics.cpp | 2 +- slicer/json/serializer.cpp | 16 ++++++++-------- slicer/slicer/modelPartsTypes.cpp | 18 +++++++++--------- slicer/slicer/serializer.cpp | 8 ++++---- slicer/test/compilation.cpp | 4 ++-- slicer/test/serializers.cpp | 8 ++++---- slicer/test/streams-mp.cpp | 2 +- slicer/test/streams.cpp | 4 ++-- slicer/tool/parser.cpp | 12 ++++++------ slicer/xml/serializer.cpp | 8 ++++---- 16 files changed, 59 insertions(+), 58 deletions(-) diff --git a/Jamroot.jam b/Jamroot.jam index 6bee154..8e63adb 100644 --- a/Jamroot.jam +++ b/Jamroot.jam @@ -22,6 +22,7 @@ project debug:-Wcast-align debug:-Wunused debug:-Woverloaded-virtual + debug:-Wpedantic debug:-Wnull-dereference debug:-Wdouble-promotion debug:-Wformat=2 diff --git a/slicer/db/testInsert.cpp b/slicer/db/testInsert.cpp index 6bc6acd..1919a85 100644 --- a/slicer/db/testInsert.cpp +++ b/slicer/db/testInsert.cpp @@ -12,9 +12,9 @@ using namespace std::literals; // LCOV_EXCL_START -BOOST_TEST_DONT_PRINT_LOG_VALUE(TestModule::DateTime); -BOOST_TEST_DONT_PRINT_LOG_VALUE(TestModule::IsoDate); -BOOST_TEST_DONT_PRINT_LOG_VALUE(TestDatabase::Timespan); +BOOST_TEST_DONT_PRINT_LOG_VALUE(TestModule::DateTime) +BOOST_TEST_DONT_PRINT_LOG_VALUE(TestModule::IsoDate) +BOOST_TEST_DONT_PRINT_LOG_VALUE(TestDatabase::Timespan) // LCOV_EXCL_STOP namespace std { @@ -28,7 +28,7 @@ namespace std { BOOST_GLOBAL_FIXTURE(StandardMockDatabase); -BOOST_FIXTURE_TEST_SUITE(db, ConnectionFixture); +BOOST_FIXTURE_TEST_SUITE(db, ConnectionFixture) BOOST_AUTO_TEST_CASE(insert_builtins) { @@ -151,4 +151,4 @@ BOOST_AUTO_TEST_CASE(insert_unsupportedModel) Slicer::SerializeAny(cm, db, "converted"), Slicer::UnsupportedModelType); } -BOOST_AUTO_TEST_SUITE_END(); +BOOST_AUTO_TEST_SUITE_END() diff --git a/slicer/db/testPatch.cpp b/slicer/db/testPatch.cpp index 7c52ea6..5dc5991 100644 --- a/slicer/db/testPatch.cpp +++ b/slicer/db/testPatch.cpp @@ -11,15 +11,15 @@ #include // LCOV_EXCL_START -BOOST_TEST_DONT_PRINT_LOG_VALUE(TestModule::DateTime); -BOOST_TEST_DONT_PRINT_LOG_VALUE(TestModule::IsoDate); -BOOST_TEST_DONT_PRINT_LOG_VALUE(TestDatabase::Timespan); -BOOST_TEST_DONT_PRINT_LOG_VALUE(DB::PrimaryKey); +BOOST_TEST_DONT_PRINT_LOG_VALUE(TestModule::DateTime) +BOOST_TEST_DONT_PRINT_LOG_VALUE(TestModule::IsoDate) +BOOST_TEST_DONT_PRINT_LOG_VALUE(TestDatabase::Timespan) +BOOST_TEST_DONT_PRINT_LOG_VALUE(DB::PrimaryKey) // LCOV_EXCL_STOP BOOST_GLOBAL_FIXTURE(StandardMockDatabase); -BOOST_FIXTURE_TEST_SUITE(db, ConnectionFixture); +BOOST_FIXTURE_TEST_SUITE(db, ConnectionFixture) BOOST_AUTO_TEST_CASE(insert_builtins) { @@ -40,4 +40,4 @@ BOOST_AUTO_TEST_CASE(insert_builtins) BOOST_REQUIRE_EQUAL(cols, tp.cols); } -BOOST_AUTO_TEST_SUITE_END(); +BOOST_AUTO_TEST_SUITE_END() diff --git a/slicer/db/testSelect.cpp b/slicer/db/testSelect.cpp index 7ff5e00..cbceb02 100644 --- a/slicer/db/testSelect.cpp +++ b/slicer/db/testSelect.cpp @@ -14,7 +14,7 @@ using namespace std::literals; BOOST_GLOBAL_FIXTURE(StandardMockDatabase); -BOOST_FIXTURE_TEST_SUITE(db, ConnectionFixture); +BOOST_FIXTURE_TEST_SUITE(db, ConnectionFixture) BOOST_AUTO_TEST_CASE(select_simple_int) { @@ -246,4 +246,4 @@ BOOST_AUTO_TEST_CASE(bulkSelectTest) BOOST_REQUIRE_EQUAL(10000, vec.size()); } -BOOST_AUTO_TEST_SUITE_END(); +BOOST_AUTO_TEST_SUITE_END() diff --git a/slicer/db/testUpdate.cpp b/slicer/db/testUpdate.cpp index 7dbcba3..04fbdaf 100644 --- a/slicer/db/testUpdate.cpp +++ b/slicer/db/testUpdate.cpp @@ -15,7 +15,7 @@ using namespace std::literals; BOOST_GLOBAL_FIXTURE(StandardMockDatabase); -BOOST_FIXTURE_TEST_SUITE(db, ConnectionFixture); +BOOST_FIXTURE_TEST_SUITE(db, ConnectionFixture) BOOST_AUTO_TEST_CASE(update_builtinsNotFound) { @@ -112,4 +112,4 @@ BOOST_AUTO_TEST_CASE(update_unsupportedModel) Slicer::SerializeAny(cm, db, "converted"), Slicer::UnsupportedModelType); } -BOOST_AUTO_TEST_SUITE_END(); +BOOST_AUTO_TEST_SUITE_END() diff --git a/slicer/ice/serializer.cpp b/slicer/ice/serializer.cpp index fdd8409..8f83352 100644 --- a/slicer/ice/serializer.cpp +++ b/slicer/ice/serializer.cpp @@ -2,8 +2,8 @@ #include "Ice/Communicator.h" #include "Ice/Initialize.h" -NAMEDFACTORY("application/ice", Slicer::IceStreamSerializer, Slicer::StreamSerializerFactory); -NAMEDFACTORY("application/ice", Slicer::IceStreamDeserializer, Slicer::StreamDeserializerFactory); +NAMEDFACTORY("application/ice", Slicer::IceStreamSerializer, Slicer::StreamSerializerFactory) +NAMEDFACTORY("application/ice", Slicer::IceStreamDeserializer, Slicer::StreamDeserializerFactory) namespace Slicer { Ice::StringSeq empty; diff --git a/slicer/ice/testSpecifics.cpp b/slicer/ice/testSpecifics.cpp index 3a4be15..d24fd00 100644 --- a/slicer/ice/testSpecifics.cpp +++ b/slicer/ice/testSpecifics.cpp @@ -5,7 +5,7 @@ #include // LCOV_EXCL_START -BOOST_TEST_DONT_PRINT_LOG_VALUE(TestModule::IsoDate); +BOOST_TEST_DONT_PRINT_LOG_VALUE(TestModule::IsoDate) // LCOV_EXCL_STOP template diff --git a/slicer/json/serializer.cpp b/slicer/json/serializer.cpp index cf165b2..4d50501 100644 --- a/slicer/json/serializer.cpp +++ b/slicer/json/serializer.cpp @@ -7,14 +7,14 @@ #include #include -NAMEDFACTORY(".js", Slicer::JsonFileSerializer, Slicer::FileSerializerFactory); -NAMEDFACTORY(".js", Slicer::JsonFileDeserializer, Slicer::FileDeserializerFactory); -NAMEDFACTORY(".json", Slicer::JsonFileSerializer, Slicer::FileSerializerFactory); -NAMEDFACTORY(".json", Slicer::JsonFileDeserializer, Slicer::FileDeserializerFactory); -NAMEDFACTORY("application/javascript", Slicer::JsonStreamSerializer, Slicer::StreamSerializerFactory); -NAMEDFACTORY("application/javascript", Slicer::JsonStreamDeserializer, Slicer::StreamDeserializerFactory); -NAMEDFACTORY("application/json", Slicer::JsonStreamSerializer, Slicer::StreamSerializerFactory); -NAMEDFACTORY("application/json", Slicer::JsonStreamDeserializer, Slicer::StreamDeserializerFactory); +NAMEDFACTORY(".js", Slicer::JsonFileSerializer, Slicer::FileSerializerFactory) +NAMEDFACTORY(".js", Slicer::JsonFileDeserializer, Slicer::FileDeserializerFactory) +NAMEDFACTORY(".json", Slicer::JsonFileSerializer, Slicer::FileSerializerFactory) +NAMEDFACTORY(".json", Slicer::JsonFileDeserializer, Slicer::FileDeserializerFactory) +NAMEDFACTORY("application/javascript", Slicer::JsonStreamSerializer, Slicer::StreamSerializerFactory) +NAMEDFACTORY("application/javascript", Slicer::JsonStreamDeserializer, Slicer::StreamDeserializerFactory) +NAMEDFACTORY("application/json", Slicer::JsonStreamSerializer, Slicer::StreamSerializerFactory) +NAMEDFACTORY("application/json", Slicer::JsonStreamDeserializer, Slicer::StreamDeserializerFactory) namespace Slicer { constexpr std::string_view md_object {"json:object"}; diff --git a/slicer/slicer/modelPartsTypes.cpp b/slicer/slicer/modelPartsTypes.cpp index 13c5507..d859824 100644 --- a/slicer/slicer/modelPartsTypes.cpp +++ b/slicer/slicer/modelPartsTypes.cpp @@ -91,14 +91,14 @@ namespace Slicer { template<> const std::string Slicer::ModelPartForRoot>::rootName = "OptionalInt"; template<> const std::string Slicer::ModelPartForRoot>::rootName = "OptionalLong"; - MODELPARTFOR(std::string, ModelPartForSimple); - MODELPARTFOR(bool, ModelPartForSimple); - MODELPARTFOR(Ice::Float, ModelPartForSimple); - MODELPARTFOR(Ice::Double, ModelPartForSimple); - MODELPARTFOR(Ice::Byte, ModelPartForSimple); - MODELPARTFOR(Ice::Short, ModelPartForSimple); - MODELPARTFOR(Ice::Int, ModelPartForSimple); - MODELPARTFOR(Ice::Long, ModelPartForSimple); + MODELPARTFOR(std::string, ModelPartForSimple) + MODELPARTFOR(bool, ModelPartForSimple) + MODELPARTFOR(Ice::Float, ModelPartForSimple) + MODELPARTFOR(Ice::Double, ModelPartForSimple) + MODELPARTFOR(Ice::Byte, ModelPartForSimple) + MODELPARTFOR(Ice::Short, ModelPartForSimple) + MODELPARTFOR(Ice::Int, ModelPartForSimple) + MODELPARTFOR(Ice::Long, ModelPartForSimple) bool optionalCaseEq(std::string_view a, std::string_view b, bool matchCase) @@ -304,7 +304,7 @@ namespace Slicer { ModelPartForOptionalBase::IsOptional() const { return true; - }; + } const Metadata & ModelPartForOptionalBase::GetMetadata() const diff --git a/slicer/slicer/serializer.cpp b/slicer/slicer/serializer.cpp index 329ef86..396e877 100644 --- a/slicer/slicer/serializer.cpp +++ b/slicer/slicer/serializer.cpp @@ -1,7 +1,7 @@ #include "serializer.h" #include -INSTANTIATEFACTORY(Slicer::Serializer, std::ostream &); -INSTANTIATEFACTORY(Slicer::Deserializer, std::istream &); -INSTANTIATEFACTORY(Slicer::Serializer, const std::filesystem::path &); -INSTANTIATEFACTORY(Slicer::Deserializer, const std::filesystem::path &); +INSTANTIATEFACTORY(Slicer::Serializer, std::ostream &) +INSTANTIATEFACTORY(Slicer::Deserializer, std::istream &) +INSTANTIATEFACTORY(Slicer::Serializer, const std::filesystem::path &) +INSTANTIATEFACTORY(Slicer::Deserializer, const std::filesystem::path &) diff --git a/slicer/test/compilation.cpp b/slicer/test/compilation.cpp index 2ed73e4..c633fd4 100644 --- a/slicer/test/compilation.cpp +++ b/slicer/test/compilation.cpp @@ -7,8 +7,8 @@ #include // LCOV_EXCL_START -BOOST_TEST_DONT_PRINT_LOG_VALUE(std::type_info); -BOOST_TEST_DONT_PRINT_LOG_VALUE(Slicer::ModelPartType); +BOOST_TEST_DONT_PRINT_LOG_VALUE(std::type_info) +BOOST_TEST_DONT_PRINT_LOG_VALUE(Slicer::ModelPartType) // LCOV_EXCL_STOP #define TypeTest(Var, Expr, Explicit, Expected) \ diff --git a/slicer/test/serializers.cpp b/slicer/test/serializers.cpp index a22fd39..848e933 100644 --- a/slicer/test/serializers.cpp +++ b/slicer/test/serializers.cpp @@ -356,7 +356,7 @@ freeJson(json::Value &) { } -BOOST_FIXTURE_TEST_SUITE(byFile, FileBased); +BOOST_FIXTURE_TEST_SUITE(byFile, FileBased) BOOST_AUTO_TEST_CASE(builtins_xml) { @@ -615,9 +615,9 @@ BOOST_AUTO_TEST_CASE(invalid_enum) Slicer::DeserializeAnyWith(xdeserializer), Slicer::InvalidEnumerationSymbol); } -BOOST_AUTO_TEST_SUITE_END(); +BOOST_AUTO_TEST_SUITE_END() -BOOST_FIXTURE_TEST_SUITE(byHandler, FileBased); +BOOST_FIXTURE_TEST_SUITE(byHandler, FileBased) BOOST_AUTO_TEST_CASE(optionals_areset2_json) { @@ -637,7 +637,7 @@ BOOST_AUTO_TEST_CASE(simple_complete_validator) xmlpp::Document *>("isodate.xml", readXml, writeXml, freeXml); } -BOOST_AUTO_TEST_SUITE_END(); +BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_CASE(missingConversion) { diff --git a/slicer/test/streams-mp.cpp b/slicer/test/streams-mp.cpp index 5764248..85d0060 100644 --- a/slicer/test/streams-mp.cpp +++ b/slicer/test/streams-mp.cpp @@ -1,4 +1,4 @@ #include "streams.h" #include -MODELPARTFORSTREAM(TestStream); +MODELPARTFORSTREAM(TestStream) diff --git a/slicer/test/streams.cpp b/slicer/test/streams.cpp index e68de0e..f5284eb 100644 --- a/slicer/test/streams.cpp +++ b/slicer/test/streams.cpp @@ -18,7 +18,7 @@ TestStream::Produce(const Consumer & c) } } -BOOST_FIXTURE_TEST_SUITE(stream, TestStream); +BOOST_FIXTURE_TEST_SUITE(stream, TestStream) BOOST_AUTO_TEST_CASE(streamToXml) { @@ -42,4 +42,4 @@ BOOST_AUTO_TEST_CASE(streamToJson) BOOST_REQUIRE_EQUAL("9", seq.back()); } -BOOST_AUTO_TEST_SUITE_END(); +BOOST_AUTO_TEST_SUITE_END() diff --git a/slicer/tool/parser.cpp b/slicer/tool/parser.cpp index e6a7432..aedeab8 100644 --- a/slicer/tool/parser.cpp +++ b/slicer/tool/parser.cpp @@ -70,7 +70,7 @@ namespace Slicer { void visitEnum(const Slice::EnumPtr & e) override { - fprintbf(cpp, "FORWARD_ENUM(%s);\n", e->name()); + fprintbf(cpp, "FORWARD_ENUM(%s)\n", e->name()); }; void @@ -345,14 +345,14 @@ namespace Slicer { } if (auto cmp = md.value("slicer:custommodelpart:")) { - fprintbf(cpp, "CUSTOMMODELPARTFOR(%s, %s< %s >, %s);\n\n", Slice::typeToString(decl), + fprintbf(cpp, "CUSTOMMODELPARTFOR(%s, %s< %s >, %s)\n\n", Slice::typeToString(decl), getBasicModelPart(decl), c->scoped(), CppName {*cmp}); fprintbf(cpp, "\ttemplate<> DLL_PUBLIC ModelPartPtr ModelPart::Make<%s<%s> >(%s * t)", getBasicModelPart(decl), c->scoped(), Slice::typeToString(decl)); fprintbf(cpp, "{ return std::make_shared<%s>(t); } \n", CppName {*cmp}); } else { - fprintbf(cpp, "CUSTOMMODELPARTFOR(%s, ModelPartForClass<%s>, ModelPartForClass<%s>);\n\n", + fprintbf(cpp, "CUSTOMMODELPARTFOR(%s, ModelPartForClass<%s>, ModelPartForClass<%s>)\n\n", Slice::typeToString(decl), c->scoped(), c->scoped()); } definedTypes.insert(decl->typeId()); @@ -665,14 +665,14 @@ namespace Slicer { Slicer::defineMODELPART(const std::string & type, const Slice::TypePtr & stype, const IceMetaData & metadata) { if (auto cmp = metadata.value("slicer:custommodelpart:")) { - fprintbf(cpp, "CUSTOMMODELPARTFOR(%s, %s< %s >, %s);\n\n", type, getBasicModelPart(stype), type, + fprintbf(cpp, "CUSTOMMODELPARTFOR(%s, %s< %s >, %s)\n\n", type, getBasicModelPart(stype), type, CppName {*cmp}); fprintbf(cpp, "\ttemplate<> DLL_PUBLIC ModelPartPtr ModelPart::Make<%s<%s>>(%s * t)", getBasicModelPart(stype), type, type); fprintbf(cpp, "{ return std::make_shared<%s>(t); } \n", CppName {*cmp}); } else { - fprintbf(cpp, "MODELPARTFOR(%s, %s);\n\n", type, getBasicModelPart(stype)); + fprintbf(cpp, "MODELPARTFOR(%s, %s)\n\n", type, getBasicModelPart(stype)); } definedTypes.insert(stype->typeId()); } @@ -742,4 +742,4 @@ namespace Slicer { throw; } } -}; +} diff --git a/slicer/xml/serializer.cpp b/slicer/xml/serializer.cpp index 581eae2..ad55ae5 100644 --- a/slicer/xml/serializer.cpp +++ b/slicer/xml/serializer.cpp @@ -16,10 +16,10 @@ #include #include -NAMEDFACTORY(".xml", Slicer::XmlFileSerializer, Slicer::FileSerializerFactory); -NAMEDFACTORY(".xml", Slicer::XmlFileDeserializer, Slicer::FileDeserializerFactory); -NAMEDFACTORY("application/xml", Slicer::XmlStreamSerializer, Slicer::StreamSerializerFactory); -NAMEDFACTORY("application/xml", Slicer::XmlStreamDeserializer, Slicer::StreamDeserializerFactory); +NAMEDFACTORY(".xml", Slicer::XmlFileSerializer, Slicer::FileSerializerFactory) +NAMEDFACTORY(".xml", Slicer::XmlFileDeserializer, Slicer::FileDeserializerFactory) +NAMEDFACTORY("application/xml", Slicer::XmlStreamSerializer, Slicer::StreamSerializerFactory) +NAMEDFACTORY("application/xml", Slicer::XmlStreamDeserializer, Slicer::StreamDeserializerFactory) namespace Slicer { constexpr std::string_view md_attribute {"xml:attribute"}; -- cgit v1.2.3