From e2889e3138919be7e4366d8cdf7d60c1ebf253b2 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Tue, 1 Sep 2020 13:37:36 +0200 Subject: [PATCH] Tests: Ignore some compiler warnings Co-authored-by: James Moore --- test/src/unit-allocator.cpp | 6 ++++++ test/src/unit-class_const_iterator.cpp | 4 ++++ test/src/unit-class_iterator.cpp | 4 ++++ test/src/unit-class_lexer.cpp | 4 ++++ test/src/unit-class_parser.cpp | 4 ++++ test/src/unit-constructor1.cpp | 5 +++++ test/src/unit-convenience.cpp | 4 ++++ test/src/unit-conversions.cpp | 4 ++++ test/src/unit-iterators1.cpp | 4 ++++ test/src/unit-json_pointer.cpp | 6 ++++++ test/src/unit-noexcept.cpp | 2 ++ test/src/unit-regression1.cpp | 4 ++++ test/src/unit-to_chars.cpp | 5 +++++ test/src/unit-unicode.cpp | 4 ++++ test/src/unit-user_defined_input.cpp | 2 ++ 15 files changed, 62 insertions(+) diff --git a/test/src/unit-allocator.cpp b/test/src/unit-allocator.cpp index ad78b8f9e..df03249ae 100644 --- a/test/src/unit-allocator.cpp +++ b/test/src/unit-allocator.cpp @@ -29,6 +29,10 @@ SOFTWARE. #include "doctest_compatibility.h" +#if DOCTEST_CLANG && DOCTEST_CLANG >= DOCTEST_COMPILER(3, 6, 0) + DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") +#endif // clang 3.6.x + #define JSON_TESTS_PRIVATE #include using nlohmann::json; @@ -95,6 +99,8 @@ struct my_allocator : std::allocator { if (next_deallocate_fails) { + (void)p; // Ignored unused + (void)n; // ignored unused next_deallocate_fails = false; throw std::bad_alloc(); } diff --git a/test/src/unit-class_const_iterator.cpp b/test/src/unit-class_const_iterator.cpp index a972fd4c7..722e3518c 100644 --- a/test/src/unit-class_const_iterator.cpp +++ b/test/src/unit-class_const_iterator.cpp @@ -29,6 +29,10 @@ SOFTWARE. #include "doctest_compatibility.h" +#if DOCTEST_CLANG && DOCTEST_CLANG >= DOCTEST_COMPILER(3, 6, 0) + DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") +#endif // clang 3.6.x + #define JSON_TESTS_PRIVATE #include using nlohmann::json; diff --git a/test/src/unit-class_iterator.cpp b/test/src/unit-class_iterator.cpp index b4ef11e43..ff8bbf1ec 100644 --- a/test/src/unit-class_iterator.cpp +++ b/test/src/unit-class_iterator.cpp @@ -29,6 +29,10 @@ SOFTWARE. #include "doctest_compatibility.h" +#if DOCTEST_CLANG && DOCTEST_CLANG >= DOCTEST_COMPILER(3, 6, 0) + DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") +#endif // clang 3.6.x + #define JSON_TESTS_PRIVATE #include using nlohmann::json; diff --git a/test/src/unit-class_lexer.cpp b/test/src/unit-class_lexer.cpp index 1a4f8ed75..0d7e49799 100644 --- a/test/src/unit-class_lexer.cpp +++ b/test/src/unit-class_lexer.cpp @@ -29,6 +29,10 @@ SOFTWARE. #include "doctest_compatibility.h" +#if DOCTEST_CLANG && DOCTEST_CLANG >= DOCTEST_COMPILER(3, 6, 0) + DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") +#endif // clang 3.6.x + #define JSON_TESTS_PRIVATE #include using nlohmann::json; diff --git a/test/src/unit-class_parser.cpp b/test/src/unit-class_parser.cpp index d0335c948..274b7955b 100644 --- a/test/src/unit-class_parser.cpp +++ b/test/src/unit-class_parser.cpp @@ -29,6 +29,10 @@ SOFTWARE. #include "doctest_compatibility.h" +#if DOCTEST_CLANG && DOCTEST_CLANG >= DOCTEST_COMPILER(3, 6, 0) + DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") +#endif // clang 3.6.x + #define JSON_TESTS_PRIVATE #include using nlohmann::json; diff --git a/test/src/unit-constructor1.cpp b/test/src/unit-constructor1.cpp index 70b3e4047..8509fa1e3 100644 --- a/test/src/unit-constructor1.cpp +++ b/test/src/unit-constructor1.cpp @@ -28,8 +28,13 @@ SOFTWARE. */ #include "doctest_compatibility.h" + DOCTEST_GCC_SUPPRESS_WARNING("-Wfloat-equal") +#if DOCTEST_CLANG && DOCTEST_CLANG >= DOCTEST_COMPILER(3, 6, 0) + DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") +#endif // clang 3.6.x + #define JSON_TESTS_PRIVATE #include using nlohmann::json; diff --git a/test/src/unit-convenience.cpp b/test/src/unit-convenience.cpp index c75edac4e..14b932451 100644 --- a/test/src/unit-convenience.cpp +++ b/test/src/unit-convenience.cpp @@ -29,6 +29,10 @@ SOFTWARE. #include "doctest_compatibility.h" +#if DOCTEST_CLANG && DOCTEST_CLANG >= DOCTEST_COMPILER(3, 6, 0) + DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") +#endif // clang 3.6.x + #define JSON_TESTS_PRIVATE #include using nlohmann::json; diff --git a/test/src/unit-conversions.cpp b/test/src/unit-conversions.cpp index c71e230d9..e4deb7e03 100644 --- a/test/src/unit-conversions.cpp +++ b/test/src/unit-conversions.cpp @@ -29,6 +29,10 @@ SOFTWARE. #include "doctest_compatibility.h" +#if DOCTEST_CLANG && DOCTEST_CLANG >= DOCTEST_COMPILER(3, 6, 0) + DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") +#endif // clang 3.6.x + #define JSON_TESTS_PRIVATE #include using nlohmann::json; diff --git a/test/src/unit-iterators1.cpp b/test/src/unit-iterators1.cpp index 1ff8958fa..90743d265 100644 --- a/test/src/unit-iterators1.cpp +++ b/test/src/unit-iterators1.cpp @@ -29,6 +29,10 @@ SOFTWARE. #include "doctest_compatibility.h" +#if DOCTEST_CLANG && DOCTEST_CLANG >= DOCTEST_COMPILER(3, 6, 0) + DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") +#endif // clang 3.6.x + #define JSON_TESTS_PRIVATE #include using nlohmann::json; diff --git a/test/src/unit-json_pointer.cpp b/test/src/unit-json_pointer.cpp index 14d8cd183..a076baa71 100644 --- a/test/src/unit-json_pointer.cpp +++ b/test/src/unit-json_pointer.cpp @@ -29,6 +29,12 @@ SOFTWARE. #include "doctest_compatibility.h" +DOCTEST_MSVC_SUPPRESS_WARNING(4127) + +#if DOCTEST_CLANG && DOCTEST_CLANG >= DOCTEST_COMPILER(3, 6, 0) + DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") +#endif // clang 3.6.x + #define JSON_TESTS_PRIVATE #include using nlohmann::json; diff --git a/test/src/unit-noexcept.cpp b/test/src/unit-noexcept.cpp index 7e657bf9f..9f4b63f77 100644 --- a/test/src/unit-noexcept.cpp +++ b/test/src/unit-noexcept.cpp @@ -31,6 +31,8 @@ SOFTWARE. #include +DOCTEST_CLANG_SUPPRESS_WARNING("-Wunneeded-internal-declaration") + using nlohmann::json; namespace diff --git a/test/src/unit-regression1.cpp b/test/src/unit-regression1.cpp index 9dcc75b09..03f356127 100644 --- a/test/src/unit-regression1.cpp +++ b/test/src/unit-regression1.cpp @@ -30,6 +30,10 @@ SOFTWARE. #include "doctest_compatibility.h" DOCTEST_GCC_SUPPRESS_WARNING("-Wfloat-equal") +#if DOCTEST_CLANG && DOCTEST_CLANG >= DOCTEST_COMPILER(3, 6, 0) + DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") +#endif // clang 3.6.x + // for some reason including this after the json header leads to linker errors with VS 2017... #include diff --git a/test/src/unit-to_chars.cpp b/test/src/unit-to_chars.cpp index 2861928f8..68587d976 100644 --- a/test/src/unit-to_chars.cpp +++ b/test/src/unit-to_chars.cpp @@ -33,6 +33,11 @@ SOFTWARE. #include "doctest_compatibility.h" +#if (DOCTEST_GCC >= DOCTEST_COMPILER(4, 8, 0)) && \ + (DOCTEST_GCC < DOCTEST_COMPILER(5, 0, 0)) + DOCTEST_GCC_SUPPRESS_WARNING("-Wmissing-field-initializers") +#endif // gcc 4.8.x and 4.9.x + #include using nlohmann::detail::dtoa_impl::reinterpret_bits; diff --git a/test/src/unit-unicode.cpp b/test/src/unit-unicode.cpp index d1b8ac9a9..4b41d1472 100644 --- a/test/src/unit-unicode.cpp +++ b/test/src/unit-unicode.cpp @@ -29,6 +29,10 @@ SOFTWARE. #include "doctest_compatibility.h" +#if DOCTEST_CLANG && DOCTEST_CLANG >= DOCTEST_COMPILER(3, 6, 0) + DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") +#endif // clang 3.6.x + // for some reason including this after the json header leads to linker errors with VS 2017... #include diff --git a/test/src/unit-user_defined_input.cpp b/test/src/unit-user_defined_input.cpp index 5a1138b00..28ee97490 100644 --- a/test/src/unit-user_defined_input.cpp +++ b/test/src/unit-user_defined_input.cpp @@ -29,6 +29,8 @@ SOFTWARE. #include "doctest_compatibility.h" +DOCTEST_GCC_SUPPRESS_WARNING("-Wunused-local-typedefs") + #include using nlohmann::json;