From 77f24509d4f4ca66320018a8e2597b2ac7b1c50b Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Wed, 30 Dec 2020 13:27:29 +0100 Subject: [PATCH] :rotating_light: fix warnings --- cmake/ci.cmake | 8 +++----- test/src/unit-regression2.cpp | 2 ++ test/src/unit-udt.cpp | 2 +- test/src/unit-user_defined_input.cpp | 7 +++++++ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/cmake/ci.cmake b/cmake/ci.cmake index ad866b107..c7d69760d 100644 --- a/cmake/ci.cmake +++ b/cmake/ci.cmake @@ -51,12 +51,10 @@ set(CLANG_CXXFLAGS "-std=c++11 \ -Weverything \ -Wno-c++98-compat \ -Wno-c++98-compat-pedantic \ - -Wno-c++2a-compat \ -Wno-deprecated-declarations \ -Wno-documentation-unknown-command \ -Wno-exit-time-destructors \ - -Wno-float-equal \ - -Wno-missing-prototypes \ + -Wno-extra-semi-stmt \ -Wno-padded \ -Wno-range-loop-analysis \ -Wno-switch-enum -Wno-covered-switch-default \ @@ -193,7 +191,7 @@ set(GCC_CXXFLAGS "-std=c++11 \ -Wmismatched-tags \ -Wmissing-attributes \ -Wmissing-braces \ - -Wno-missing-declarations \ + -Wmissing-declarations \ -Wmissing-field-initializers \ -Wmissing-include-dirs \ -Wmissing-profile \ @@ -301,7 +299,7 @@ set(GCC_CXXFLAGS "-std=c++11 \ -Wunused-const-variable=2 \ -Wunused-function \ -Wunused-label \ - -Wno-unused-local-typedefs \ + -Wunused-local-typedefs \ -Wunused-macros \ -Wunused-parameter \ -Wunused-result \ diff --git a/test/src/unit-regression2.cpp b/test/src/unit-regression2.cpp index 1e8c4922a..107d16b8c 100644 --- a/test/src/unit-regression2.cpp +++ b/test/src/unit-regression2.cpp @@ -94,12 +94,14 @@ struct Data std::string b {}; }; +void from_json(const json& j, Data& data); void from_json(const json& j, Data& data) { j["a"].get_to(data.a); j["b"].get_to(data.b); } +bool operator==(Data const& lhs, Data const& rhs); bool operator==(Data const& lhs, Data const& rhs) { return lhs.a == rhs.a && lhs.b == rhs.b; diff --git a/test/src/unit-udt.cpp b/test/src/unit-udt.cpp index b23765505..b333d0b65 100644 --- a/test/src/unit-udt.cpp +++ b/test/src/unit-udt.cpp @@ -199,7 +199,7 @@ template static void from_json(const BasicJsonType& j, country& c) { const auto str = j.template get(); - static const std::map m = + const std::map m = { {"中华人民共和国", country::china}, {"France", country::france}, diff --git a/test/src/unit-user_defined_input.cpp b/test/src/unit-user_defined_input.cpp index 4b84e8e71..413846005 100644 --- a/test/src/unit-user_defined_input.cpp +++ b/test/src/unit-user_defined_input.cpp @@ -131,6 +131,13 @@ TEST_CASE("Custom iterator") const char* ptr; }; + // avoid -Wunused-local-typedefs + CHECK(std::is_same::value); + CHECK(std::is_same::value); + CHECK(std::is_same::value); + CHECK(std::is_same::value); + CHECK(std::is_same::value); + MyIterator begin{raw_data}; MyIterator end{raw_data + strlen(raw_data)};