diff --git a/test/src/unit-allocator.cpp b/test/src/unit-allocator.cpp index 050429e81..cf7496785 100644 --- a/test/src/unit-allocator.cpp +++ b/test/src/unit-allocator.cpp @@ -29,16 +29,13 @@ SOFTWARE. #include "doctest_compatibility.h" -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wkeyword-macro" +DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") #define private public #include using nlohmann::json; #undef private -#pragma clang diagnostic pop - namespace { // special test case to check if memory is leaked if constructor throws diff --git a/test/src/unit-class_const_iterator.cpp b/test/src/unit-class_const_iterator.cpp index ea63e9c7d..88011efa8 100644 --- a/test/src/unit-class_const_iterator.cpp +++ b/test/src/unit-class_const_iterator.cpp @@ -29,16 +29,13 @@ SOFTWARE. #include "doctest_compatibility.h" -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wkeyword-macro" +DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") #define private public #include using nlohmann::json; #undef private -#pragma clang diagnostic pop - TEST_CASE("const_iterator class") { SECTION("construction") diff --git a/test/src/unit-class_iterator.cpp b/test/src/unit-class_iterator.cpp index 71ea5dfa3..c6948cda9 100644 --- a/test/src/unit-class_iterator.cpp +++ b/test/src/unit-class_iterator.cpp @@ -29,16 +29,13 @@ SOFTWARE. #include "doctest_compatibility.h" -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wkeyword-macro" +DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") #define private public #include using nlohmann::json; #undef private -#pragma clang diagnostic pop - TEST_CASE("iterator class") { SECTION("construction") diff --git a/test/src/unit-class_lexer.cpp b/test/src/unit-class_lexer.cpp index d17589af0..c92b15173 100644 --- a/test/src/unit-class_lexer.cpp +++ b/test/src/unit-class_lexer.cpp @@ -29,16 +29,13 @@ SOFTWARE. #include "doctest_compatibility.h" -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wkeyword-macro" +DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") #define private public #include using nlohmann::json; #undef private -#pragma clang diagnostic pop - namespace { // shortcut to scan a string literal diff --git a/test/src/unit-class_parser.cpp b/test/src/unit-class_parser.cpp index 7e66ad2d7..dae02f77e 100644 --- a/test/src/unit-class_parser.cpp +++ b/test/src/unit-class_parser.cpp @@ -29,16 +29,13 @@ SOFTWARE. #include "doctest_compatibility.h" -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wkeyword-macro" +DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") #define private public #include using nlohmann::json; #undef private -#pragma clang diagnostic pop - #include namespace diff --git a/test/src/unit-constructor1.cpp b/test/src/unit-constructor1.cpp index 2700a9919..4d3ceedb6 100644 --- a/test/src/unit-constructor1.cpp +++ b/test/src/unit-constructor1.cpp @@ -29,17 +29,13 @@ SOFTWARE. #include "doctest_compatibility.h" DOCTEST_GCC_SUPPRESS_WARNING("-Wfloat-equal") - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wkeyword-macro" +DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") #define private public #include using nlohmann::json; #undef private -#pragma clang diagnostic pop - #include #include #include diff --git a/test/src/unit-convenience.cpp b/test/src/unit-convenience.cpp index 7c468ad27..2a54a5ffc 100644 --- a/test/src/unit-convenience.cpp +++ b/test/src/unit-convenience.cpp @@ -29,16 +29,13 @@ SOFTWARE. #include "doctest_compatibility.h" -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wkeyword-macro" +DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") #define private public #include using nlohmann::json; #undef private -#pragma clang diagnostic pop - #include namespace diff --git a/test/src/unit-conversions.cpp b/test/src/unit-conversions.cpp index 539a1f839..cc2c76c58 100644 --- a/test/src/unit-conversions.cpp +++ b/test/src/unit-conversions.cpp @@ -29,16 +29,14 @@ SOFTWARE. #include "doctest_compatibility.h" -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wkeyword-macro" +DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") + #define private public #include using nlohmann::json; #undef private -#pragma clang diagnostic pop - #include #include #include diff --git a/test/src/unit-iterators1.cpp b/test/src/unit-iterators1.cpp index 1f6eb241f..475c5c3df 100644 --- a/test/src/unit-iterators1.cpp +++ b/test/src/unit-iterators1.cpp @@ -29,16 +29,13 @@ SOFTWARE. #include "doctest_compatibility.h" -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wkeyword-macro" +DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") #define private public #include using nlohmann::json; #undef private -#pragma clang diagnostic pop - TEST_CASE("iterators 1") { SECTION("basic behavior") diff --git a/test/src/unit-json_pointer.cpp b/test/src/unit-json_pointer.cpp index 486f92d7f..dea2a7592 100644 --- a/test/src/unit-json_pointer.cpp +++ b/test/src/unit-json_pointer.cpp @@ -29,16 +29,13 @@ SOFTWARE. #include "doctest_compatibility.h" -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wkeyword-macro" +DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") #define private public #include using nlohmann::json; #undef private -#pragma clang diagnostic pop - TEST_CASE("JSON pointers") { SECTION("errors") diff --git a/test/src/unit-noexcept.cpp b/test/src/unit-noexcept.cpp index a4fec5377..2ba48c308 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 @@ -42,17 +44,12 @@ enum test struct pod {}; struct pod_bis {}; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunneeded-internal-declaration" - void to_json(json&, pod) noexcept{} void to_json(json&, pod_bis){} void from_json(const json&, pod) noexcept{} void from_json(const json&, pod_bis){} static json j; -#pragma clang diagnostic pop - static_assert(noexcept(json{}), ""); static_assert(noexcept(nlohmann::to_json(j, 2)), ""); static_assert(noexcept(nlohmann::to_json(j, 2.5)), ""); diff --git a/test/src/unit-regression.cpp b/test/src/unit-regression.cpp index c41720f93..16cd87e46 100644 --- a/test/src/unit-regression.cpp +++ b/test/src/unit-regression.cpp @@ -29,20 +29,16 @@ SOFTWARE. #include "doctest_compatibility.h" DOCTEST_GCC_SUPPRESS_WARNING("-Wfloat-equal") +DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") // for some reason including this after the json header leads to linker errors with VS 2017... #include -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wkeyword-macro" - #define private public #include using nlohmann::json; #undef private -#pragma clang diagnostic pop - #include #include #include diff --git a/test/src/unit-unicode.cpp b/test/src/unit-unicode.cpp index 3487c3fbb..ab6ea373b 100644 --- a/test/src/unit-unicode.cpp +++ b/test/src/unit-unicode.cpp @@ -29,19 +29,16 @@ SOFTWARE. #include "doctest_compatibility.h" +DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro") + // for some reason including this after the json header leads to linker errors with VS 2017... #include -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wkeyword-macro" - #define private public #include using nlohmann::json; #undef private -#pragma clang diagnostic pop - #include #include #include