mirror of
https://github.com/nlohmann/json.git
synced 2026-09-11 18:57:58 +00:00
Route the -Wduplicated-branches pragma through Hedley
Match #5485, which moved the binary writer's hand-rolled diagnostic pragmas onto JSON_HEDLEY_PRAGMA (merged into develop while this branch was open). The devirtualization's -Wduplicated-branches suppression in write_compact_float was the one raw '#pragma GCC diagnostic' left; it now uses JSON_HEDLEY_PRAGMA like the adjacent -Wfloat-equal line, still guarded to GCC >= 7 and non-clang (the warning exists only there). Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAYM1qhSA2FDaDcGfPW3fG Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -2061,7 +2061,7 @@ class binary_writer
|
||||
// (-Wduplicated-branches only exists from GCC 7 on; naming it on an older
|
||||
// GCC would itself warn under -Wpragmas)
|
||||
#if defined(__GNUC__) && !defined(__clang__) && (__GNUC__ >= 7)
|
||||
#pragma GCC diagnostic ignored "-Wduplicated-branches"
|
||||
JSON_HEDLEY_PRAGMA(GCC diagnostic ignored "-Wduplicated-branches")
|
||||
#endif
|
||||
if (!std::isfinite(n) || ((static_cast<double>(n) >= static_cast<double>(std::numeric_limits<float>::lowest()) &&
|
||||
static_cast<double>(n) <= static_cast<double>((std::numeric_limits<float>::max)()) &&
|
||||
|
||||
Reference in New Issue
Block a user