diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-09-30 13:09:27 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-09-30 13:09:27 +0100 |
commit | d9459fd9d98655de9db578e9fa9ac34b519601a9 (patch) | |
tree | 0b00b47c9df5fa2ec55a7bdf1b24da0c71e46861 | |
parent | Include typename in LocalTypeException and simplify ICE read/write functions (diff) | |
download | slicer-d9459fd9d98655de9db578e9fa9ac34b519601a9.tar.bz2 slicer-d9459fd9d98655de9db578e9fa9ac34b519601a9.tar.xz slicer-d9459fd9d98655de9db578e9fa9ac34b519601a9.zip |
Fix up all the little niggly warnings
... where practical.
35 files changed, 22 insertions, 59 deletions
diff --git a/slicer/db/sqlBinder.h b/slicer/db/sqlBinder.h index 4453d4d..e4e00ca 100644 --- a/slicer/db/sqlBinder.h +++ b/slicer/db/sqlBinder.h @@ -2,7 +2,6 @@ #include <Ice/Config.h> #include <boost/date_time/posix_time/posix_time.hpp> -#include <memory> #include <slicer/modelParts.h> #include <string> diff --git a/slicer/db/sqlInsertSerializer.cpp b/slicer/db/sqlInsertSerializer.cpp index 0881a1b..6119f54 100644 --- a/slicer/db/sqlInsertSerializer.cpp +++ b/slicer/db/sqlInsertSerializer.cpp @@ -8,7 +8,6 @@ #include <command_fwd.h> #include <compileTimeFormatter.h> #include <connection.h> -#include <functional> #include <memory> #include <modifycommand.h> #include <slicer/modelParts.h> diff --git a/slicer/db/sqlSelectDeserializer.cpp b/slicer/db/sqlSelectDeserializer.cpp index f23055e..f1c2726 100644 --- a/slicer/db/sqlSelectDeserializer.cpp +++ b/slicer/db/sqlSelectDeserializer.cpp @@ -2,7 +2,6 @@ #include "sqlExceptions.h" #include "sqlSource.h" #include <column.h> -#include <memory> #include <selectcommand.h> #include <slicer/common.h> #include <slicer/hookMap.h> diff --git a/slicer/db/sqlSource.h b/slicer/db/sqlSource.h index 84e88d4..2479c2e 100644 --- a/slicer/db/sqlSource.h +++ b/slicer/db/sqlSource.h @@ -2,7 +2,6 @@ #include "slicer/modelParts.h" #include <Ice/Config.h> -#include <memory> #include <string> namespace DB { diff --git a/slicer/db/sqlTablePatchSerializer.cpp b/slicer/db/sqlTablePatchSerializer.cpp index ec0e344..f7d8fa9 100644 --- a/slicer/db/sqlTablePatchSerializer.cpp +++ b/slicer/db/sqlTablePatchSerializer.cpp @@ -3,7 +3,6 @@ #include "sqlInsertSerializer.h" #include <compileTimeFormatter.h> #include <connection.h> -#include <memory> #include <scopeExit.h> #include <slicer/modelParts.h> #include <string> diff --git a/slicer/db/sqlUpdateSerializer.cpp b/slicer/db/sqlUpdateSerializer.cpp index 152c923..1cc6dc7 100644 --- a/slicer/db/sqlUpdateSerializer.cpp +++ b/slicer/db/sqlUpdateSerializer.cpp @@ -5,7 +5,6 @@ #include <common.h> #include <compileTimeFormatter.h> #include <connection.h> -#include <functional> #include <memory> #include <modifycommand.h> #include <slicer/modelParts.h> diff --git a/slicer/db/testConversions.cpp b/slicer/db/testConversions.cpp index f957150..09286db 100644 --- a/slicer/db/testConversions.cpp +++ b/slicer/db/testConversions.cpp @@ -1,8 +1,6 @@ #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 24cae7e..65d6c40 100644 --- a/slicer/db/testInsert.cpp +++ b/slicer/db/testInsert.cpp @@ -15,7 +15,6 @@ #include <memory> #include <slicer/slicer.h> #include <string> -#include <string_view> #include <vector> // IWYU pragma: no_forward_declare Slicer::UnsupportedModelType diff --git a/slicer/db/testMockCommon.cpp b/slicer/db/testMockCommon.cpp index 181a970..f8af309 100644 --- a/slicer/db/testMockCommon.cpp +++ b/slicer/db/testMockCommon.cpp @@ -2,7 +2,6 @@ #include <connection_fwd.h> #include <definedDirs.h> #include <filesystem> -#include <memory> #include <mockDatabase.h> #include <pq-mock.h> diff --git a/slicer/db/testSelect.cpp b/slicer/db/testSelect.cpp index 769e31b..2f73d70 100644 --- a/slicer/db/testSelect.cpp +++ b/slicer/db/testSelect.cpp @@ -17,7 +17,6 @@ #include <connection.h> #include <memory> #include <string> -#include <string_view> #include <vector> // IWYU pragma: no_forward_declare Slicer::NoRowsReturned // IWYU pragma: no_forward_declare Slicer::TooManyRowsReturned diff --git a/slicer/db/testUpdate.cpp b/slicer/db/testUpdate.cpp index e6368e4..508f0a2 100644 --- a/slicer/db/testUpdate.cpp +++ b/slicer/db/testUpdate.cpp @@ -15,7 +15,6 @@ #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 diff --git a/slicer/ice/serializer.cpp b/slicer/ice/serializer.cpp index eb27729..e7f497d 100644 --- a/slicer/ice/serializer.cpp +++ b/slicer/ice/serializer.cpp @@ -6,7 +6,6 @@ #include <factory.h> #include <istream> #include <iterator> -#include <memory> #include <slicer/modelParts.h> #include <slicer/serializer.h> diff --git a/slicer/json/serializer.cpp b/slicer/json/serializer.cpp index 4070231..ab7471e 100644 --- a/slicer/json/serializer.cpp +++ b/slicer/json/serializer.cpp @@ -7,14 +7,12 @@ #include <glibmm/ustring.h> #include <jsonpp.h> #include <map> -#include <memory> #include <optional> #include <slicer/modelParts.h> #include <slicer/serializer.h> #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 2e54a2d..ab1995e 100644 --- a/slicer/json/serializer.h +++ b/slicer/json/serializer.h @@ -6,7 +6,6 @@ #include <jsonpp.h> #include <slicer/modelParts.h> #include <slicer/serializer.h> -#include <string> #include <visibility.h> namespace Slicer { diff --git a/slicer/slicer/any_ptr.h b/slicer/slicer/any_ptr.h index 14199c0..662023a 100644 --- a/slicer/slicer/any_ptr.h +++ b/slicer/slicer/any_ptr.h @@ -1,8 +1,5 @@ #pragma once -#include <memory> -#include <vector> - namespace Slicer { template<typename T> struct any_ptr { // cppcheck-suppress noExplicitConstructor @@ -14,7 +11,7 @@ namespace Slicer { inline constexpr any_ptr(T & p) noexcept : ptr {&p} { } // cppcheck-suppress noExplicitConstructor - // NOLINTNEXTLINE(hicpp-explicit-conversions) + // NOLINTNEXTLINE(hicpp-explicit-conversions,cppcoreguidelines-rvalue-reference-param-not-moved) inline constexpr any_ptr(T && p) noexcept : ptr {&p} { } template<typename S> @@ -43,7 +40,8 @@ namespace Slicer { return *ptr; } - inline constexpr explicit operator bool() const noexcept + inline constexpr explicit + operator bool() const noexcept { return ptr; } diff --git a/slicer/slicer/enumMap.cpp b/slicer/slicer/enumMap.cpp deleted file mode 100644 index 8d6b96a..0000000 --- a/slicer/slicer/enumMap.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "enumMap.h" diff --git a/slicer/slicer/hook-test.cpp b/slicer/slicer/hook-test.cpp index 2fa1b8b..ac9fe3c 100644 --- a/slicer/slicer/hook-test.cpp +++ b/slicer/slicer/hook-test.cpp @@ -1,7 +1,6 @@ #include "hookMap.h" #include "modelPartsTypes.h" #include "modelPartsTypes.impl.h" -#include <array> #include <iterator> #include <string> #include <string_view> diff --git a/slicer/slicer/metadata-test.cpp b/slicer/slicer/metadata-test.cpp index f6263f1..a72b844 100644 --- a/slicer/slicer/metadata-test.cpp +++ b/slicer/slicer/metadata-test.cpp @@ -1,9 +1,7 @@ #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/metadata.cpp b/slicer/slicer/metadata.cpp deleted file mode 100644 index f5a1b66..0000000 --- a/slicer/slicer/metadata.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "metadata.h" diff --git a/slicer/slicer/modelParts.h b/slicer/slicer/modelParts.h index c9be22e..d6e58b1 100644 --- a/slicer/slicer/modelParts.h +++ b/slicer/slicer/modelParts.h @@ -5,7 +5,6 @@ #include <Ice/Config.h> #include <c++11Helpers.h> #include <functional> -#include <memory> #include <optional> #include <string> #include <string_view> diff --git a/slicer/slicer/modelPartsTraits.cpp b/slicer/slicer/modelPartsTraits.cpp deleted file mode 100644 index ca770cd..0000000 --- a/slicer/slicer/modelPartsTraits.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "modelPartsTraits.h" diff --git a/slicer/slicer/modelPartsTraits.h b/slicer/slicer/modelPartsTraits.h index 7e2daa2..cca1899 100644 --- a/slicer/slicer/modelPartsTraits.h +++ b/slicer/slicer/modelPartsTraits.h @@ -5,7 +5,6 @@ #include <functional> #include <tuple> #include <type_traits> -#include <utility> namespace Slicer { // Function traits helpers diff --git a/slicer/slicer/modelPartsTypes.impl.cpp b/slicer/slicer/modelPartsTypes.impl.cpp deleted file mode 100644 index 639f718..0000000 --- a/slicer/slicer/modelPartsTypes.impl.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "modelPartsTypes.impl.h" diff --git a/slicer/slicer/slicer.cpp b/slicer/slicer/slicer.cpp index 5a253b0..a912077 100644 --- a/slicer/slicer/slicer.cpp +++ b/slicer/slicer/slicer.cpp @@ -1,8 +1,5 @@ -#include "slicer.h" -#include "slicer/modelParts.h" #include <common.h> #include <compileTimeFormatter.h> -#include <utility> namespace Slicer { AdHocFormatter(InvalidEnumerationSymbolMsg, "Invalid enumeration symbol [%?] for type [%?]"); diff --git a/slicer/slicer/slicer.h b/slicer/slicer/slicer.h index a4b43f3..d57214d 100644 --- a/slicer/slicer/slicer.h +++ b/slicer/slicer/slicer.h @@ -1,6 +1,5 @@ #pragma once -#include <memory> #include <slicer/modelParts.h> #include <slicer/serializer.h> diff --git a/slicer/test/compilation.cpp b/slicer/test/compilation.cpp index 3cdfca3..8521643 100644 --- a/slicer/test/compilation.cpp +++ b/slicer/test/compilation.cpp @@ -11,7 +11,6 @@ #include "structs.h" #include <Ice/Config.h> #include <memory> -#include <optional> #include <string> #include <typeinfo> #include <vector> @@ -52,15 +51,17 @@ BOOST_AUTO_TEST_CASE(compile_auto_modelpart_type_class) ModelPartType::Complex, { BOOST_CHECK_THROW(mpp->OnContained(DontCall), std::logic_error); }); } -static void -hookHandler(std::vector<std::string> * names, const std::string & name, Slicer::ModelPartParam mpp, - const Slicer::HookCommon * h) -{ - names->push_back(name); - BOOST_REQUIRE(mpp); - BOOST_CHECK_THROW(mpp->OnContained(DontCall), std::logic_error); - BOOST_REQUIRE(h); - BOOST_REQUIRE_EQUAL(h->name, name); +namespace { + void + hookHandler(std::vector<std::string> * names, const std::string & name, Slicer::ModelPartParam mpp, + const Slicer::HookCommon * h) + { + names->push_back(name); + BOOST_REQUIRE(mpp); + BOOST_CHECK_THROW(mpp->OnContained(DontCall), std::logic_error); + BOOST_REQUIRE(h); + BOOST_REQUIRE_EQUAL(h->name, name); + } } BOOST_AUTO_TEST_CASE(compile_auto_modelpart_type_sequenceclasses) diff --git a/slicer/test/conversions.cpp b/slicer/test/conversions.cpp index 193cd4f..221ce6f 100644 --- a/slicer/test/conversions.cpp +++ b/slicer/test/conversions.cpp @@ -3,10 +3,8 @@ #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 <slicer/modelParts.h> #include <slicer/modelPartsTypes.h> #include <stdexcept> diff --git a/slicer/test/conversions.h b/slicer/test/conversions.h index f503f97..ff4af3e 100644 --- a/slicer/test/conversions.h +++ b/slicer/test/conversions.h @@ -5,7 +5,6 @@ #include <Ice/Config.h> #include <Ice/Optional.h> #include <boost/date_time/posix_time/posix_time.hpp> -#include <optional> #include <slicer/modelPartsTypes.h> #include <string> #include <visibility.h> diff --git a/slicer/test/preprocessor.cpp b/slicer/test/preprocessor.cpp index e85a42a..fea951b 100644 --- a/slicer/test/preprocessor.cpp +++ b/slicer/test/preprocessor.cpp @@ -6,10 +6,8 @@ #include <cstdio> #include <definedDirs.h> #include <filesystem> -#include <map> #include <numeric> #include <span> -#include <string> #include <utility> #include <vector> diff --git a/slicer/test/serializers.cpp b/slicer/test/serializers.cpp index ae9a30e..1780237 100644 --- a/slicer/test/serializers.cpp +++ b/slicer/test/serializers.cpp @@ -684,7 +684,8 @@ BOOST_AUTO_TEST_CASE(typeid_specifies_same) auto d1 = Slicer::DeserializeAny<Slicer::XmlStreamDeserializer, TestModule::D1Ptr>(in); BOOST_REQUIRE(d1); BOOST_CHECK_EQUAL(d1->a, 3); - BOOST_CHECK_EQUAL(typeid(*d1).name(), typeid(TestModule::D1).name()); + auto d1i = *d1; + BOOST_CHECK_EQUAL(typeid(d1i).name(), typeid(TestModule::D1).name()); } BOOST_DATA_TEST_CASE(typeid_specifies_bad, diff --git a/slicer/tool/icemetadata.cpp b/slicer/tool/icemetadata.cpp index 4804542..3dfbee9 100644 --- a/slicer/tool/icemetadata.cpp +++ b/slicer/tool/icemetadata.cpp @@ -5,12 +5,13 @@ // IWYU pragma: no_include <list> namespace Slicer { - IceMetaData::IceMetaData(Slice::StringList && as) + IceMetaData::IceMetaData(Slice::StringList as) { arr.reserve(as.size()); - std::for_each(as.begin(), as.end(), [this](auto && a) { - auto & md = arr.emplace_back(a, std::string_view {}); + std::transform(as.begin(), as.end(), std::back_inserter(arr), [](auto && a) { + decltype(arr)::value_type md {std::forward<decltype(a)>(a), std::string_view {}}; md.second = std::string_view(md.first).substr(0, md.first.rfind(':')); + return md; }); _begin = arr.begin(); _end = arr.end(); diff --git a/slicer/tool/icemetadata.h b/slicer/tool/icemetadata.h index 87d34f2..89dc422 100644 --- a/slicer/tool/icemetadata.h +++ b/slicer/tool/icemetadata.h @@ -6,7 +6,6 @@ #include <slicer/metadata.h> #include <string> #include <string_view> -#include <utility> #include <vector> #include <visibility.h> @@ -16,10 +15,10 @@ namespace Slicer { static constexpr std::string_view slicer_prefix {"slicer"}; explicit IceMetaData() = default; - explicit IceMetaData(Slice::StringList && arr); + explicit IceMetaData(Slice::StringList arr); ~IceMetaData() = default; - SPECIAL_MEMBERS_DELETE(IceMetaData); + SPECIAL_MEMBERS_DEFAULT(IceMetaData); [[nodiscard]] static std::vector<std::string_view> split(std::string_view metaData); diff --git a/slicer/xml/serializer.cpp b/slicer/xml/serializer.cpp index 8e351b6..6c0fc27 100644 --- a/slicer/xml/serializer.cpp +++ b/slicer/xml/serializer.cpp @@ -21,7 +21,6 @@ #include <factory.h> #include <lazyPointer.h> #include <list> -#include <memory> #include <optional> #include <slicer/metadata.h> #include <slicer/modelParts.h> diff --git a/slicer/xml/serializer.h b/slicer/xml/serializer.h index 6ee0bff..9f75d2c 100644 --- a/slicer/xml/serializer.h +++ b/slicer/xml/serializer.h @@ -12,7 +12,6 @@ #include <fstream> #include <slicer/modelParts.h> #include <slicer/serializer.h> -#include <string> #include <visibility.h> namespace Glib { diff --git a/slicer/xml/testSpecifics.cpp b/slicer/xml/testSpecifics.cpp index 036c03d..37199a2 100644 --- a/slicer/xml/testSpecifics.cpp +++ b/slicer/xml/testSpecifics.cpp @@ -15,7 +15,6 @@ #pragma GCC diagnostic pop #include <slicer/serializer.h> #include <slicer/slicer.h> -#include <typeinfo> #include <xmlExceptions.h> // IWYU pragma: no_forward_declare Slicer::BadBooleanValue |