⚗️ update warning flags

This commit is contained in:
Niels Lohmann 2021-08-17 11:52:08 +02:00
parent bfeac776b9
commit 57dd00f410
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
10 changed files with 31 additions and 30 deletions

View File

@ -114,7 +114,6 @@ set(CLANG_CXXFLAGS "-std=c++11 \
# -Wno-aggregate-return The library uses aggregate returns.
# -Wno-long-long The library uses the long long type to interface with system functions.
# -Wno-namespaces The library uses namespaces.
# -Wno-noexcept
# -Wno-padded We do not care about padding warnings.
# -Wno-system-headers We do not care about warnings in system headers.
# -Wno-templates The library uses templates.

View File

@ -38,9 +38,9 @@
// disable documentation warnings on clang
#if defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdocumentation"
#pragma GCC diagnostic ignored "-Wdocumentation-unknown-command"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"
#pragma clang diagnostic ignored "-Wdocumentation-unknown-command"
#endif
// allow to disable exceptions

View File

@ -1,8 +1,8 @@
#pragma once
// restore GCC/clang diagnostic settings
// restore clang diagnostic settings
#if defined(__clang__)
#pragma GCC diagnostic pop
#pragma clang diagnostic pop
#endif
// clean up

View File

@ -2250,9 +2250,9 @@ JSON_HEDLEY_DIAGNOSTIC_POP
// disable documentation warnings on clang
#if defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdocumentation"
#pragma GCC diagnostic ignored "-Wdocumentation-unknown-command"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"
#pragma clang diagnostic ignored "-Wdocumentation-unknown-command"
#endif
// allow to disable exceptions
@ -26424,9 +26424,9 @@ inline nlohmann::json::json_pointer operator "" _json_pointer(const char* s, std
// #include <nlohmann/detail/macro_unscope.hpp>
// restore GCC/clang diagnostic settings
// restore clang diagnostic settings
#if defined(__clang__)
#pragma GCC diagnostic pop
#pragma clang diagnostic pop
#endif
// clean up

View File

@ -27,13 +27,14 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
// avoid warning when assert does not abort
#if defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wstrict-overflow"
#endif
#include "doctest_compatibility.h"
// avoid warning when assert does not abort
DOCTEST_GCC_SUPPRESS_WARNING_PUSH
DOCTEST_GCC_SUPPRESS_WARNING("-Wstrict-overflow")
DOCTEST_CLANG_SUPPRESS_WARNING_PUSH
DOCTEST_CLANG_SUPPRESS_WARNING("-Wstrict-overflow")
/// global variable to record side effect of assert calls
static int assert_counter;
@ -63,3 +64,6 @@ TEST_CASE("JSON_ASSERT(x)")
}
}
#endif
DOCTEST_GCC_SUPPRESS_WARNING_POP
DOCTEST_CLANG_SUPPRESS_WARNING_POP

View File

@ -29,6 +29,7 @@ SOFTWARE.
#include "doctest_compatibility.h"
// disable -Wnoexcept as exceptions are switched off for this test suite
DOCTEST_GCC_SUPPRESS_WARNING_PUSH
DOCTEST_GCC_SUPPRESS_WARNING("-Wnoexcept")

View File

@ -358,10 +358,10 @@ TEST_CASE("JSON pointers")
CHECK_THROWS_WITH(j_const[jp] == 1, throw_msg.c_str());
}
#if defined(_MSC_VER)
#pragma warning (push)
#pragma warning (disable : 4127) // on some machines, the check below is not constant
#endif
// on some machines, the check below is not constant
DOCTEST_MSVC_SUPPRESS_WARNING_PUSH
DOCTEST_MSVC_SUPPRESS_WARNING(4127)
if (sizeof(typename json::size_type) < sizeof(unsigned long long))
{
auto size_type_max_uul = static_cast<unsigned long long>((std::numeric_limits<json::size_type>::max)());
@ -375,9 +375,7 @@ TEST_CASE("JSON pointers")
CHECK_THROWS_WITH(j_const[jp] == 1, throw_msg.c_str());
}
#if defined(_MSC_VER)
#pragma warning (pop)
#endif
DOCTEST_MSVC_SUPPRESS_WARNING_POP
CHECK_THROWS_AS(j.at("/one"_json_pointer) = 1, json::parse_error&);
CHECK_THROWS_WITH(j.at("/one"_json_pointer) = 1,

View File

@ -29,6 +29,7 @@ SOFTWARE.
#include "doctest_compatibility.h"
// disable -Wnoexcept due to struct pod_bis
DOCTEST_GCC_SUPPRESS_WARNING_PUSH
DOCTEST_GCC_SUPPRESS_WARNING("-Wnoexcept")

View File

@ -42,10 +42,9 @@ using nlohmann::json;
#include <sstream>
#include <iomanip>
#if defined(_MSC_VER)
#pragma warning (push)
#pragma warning (disable : 4189) // local variable is initialized but not referenced
#endif
// local variable is initialized but not referenced
DOCTEST_MSVC_SUPPRESS_WARNING_PUSH
DOCTEST_MSVC_SUPPRESS_WARNING(4189)
TEST_CASE("README" * doctest::skip())
{
@ -321,6 +320,4 @@ TEST_CASE("README" * doctest::skip())
}
}
#if defined(_MSC_VER)
#pragma warning (pop)
#endif
DOCTEST_MSVC_SUPPRESS_WARNING_POP

View File

@ -29,6 +29,7 @@ SOFTWARE.
#include "doctest_compatibility.h"
// disable -Wnoexcept due to class Evil
DOCTEST_GCC_SUPPRESS_WARNING_PUSH
DOCTEST_GCC_SUPPRESS_WARNING("-Wnoexcept")