mirror of
https://github.com/nlohmann/json.git
synced 2025-07-29 23:01:16 +03:00
Merge branch 'develop' of https://github.com/nlohmann/json into issue2863
This commit is contained in:
@ -1066,6 +1066,8 @@ char* to_chars(char* first, const char* last, FloatType value)
|
|||||||
*first++ = '-';
|
*first++ = '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||||
if (value == 0) // +-0
|
if (value == 0) // +-0
|
||||||
{
|
{
|
||||||
*first++ = '0';
|
*first++ = '0';
|
||||||
@ -1074,6 +1076,7 @@ char* to_chars(char* first, const char* last, FloatType value)
|
|||||||
*first++ = '0';
|
*first++ = '0';
|
||||||
return first;
|
return first;
|
||||||
}
|
}
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
JSON_ASSERT(last - first >= std::numeric_limits<FloatType>::max_digits10);
|
JSON_ASSERT(last - first >= std::numeric_limits<FloatType>::max_digits10);
|
||||||
|
|
||||||
|
@ -1524,6 +1524,8 @@ class binary_writer
|
|||||||
|
|
||||||
void write_compact_float(const number_float_t n, detail::input_format_t format)
|
void write_compact_float(const number_float_t n, detail::input_format_t format)
|
||||||
{
|
{
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||||
if (static_cast<double>(n) >= static_cast<double>(std::numeric_limits<float>::lowest()) &&
|
if (static_cast<double>(n) >= static_cast<double>(std::numeric_limits<float>::lowest()) &&
|
||||||
static_cast<double>(n) <= static_cast<double>((std::numeric_limits<float>::max)()) &&
|
static_cast<double>(n) <= static_cast<double>((std::numeric_limits<float>::max)()) &&
|
||||||
static_cast<double>(static_cast<float>(n)) == static_cast<double>(n))
|
static_cast<double>(static_cast<float>(n)) == static_cast<double>(n))
|
||||||
@ -1540,6 +1542,7 @@ class binary_writer
|
|||||||
: get_msgpack_float_prefix(n));
|
: get_msgpack_float_prefix(n));
|
||||||
write_number(n);
|
write_number(n);
|
||||||
}
|
}
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -6278,6 +6278,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
|||||||
*/
|
*/
|
||||||
friend bool operator==(const_reference lhs, const_reference rhs) noexcept
|
friend bool operator==(const_reference lhs, const_reference rhs) noexcept
|
||||||
{
|
{
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||||
const auto lhs_type = lhs.type();
|
const auto lhs_type = lhs.type();
|
||||||
const auto rhs_type = rhs.type();
|
const auto rhs_type = rhs.type();
|
||||||
|
|
||||||
@ -6342,6 +6344,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -14827,6 +14827,8 @@ class binary_writer
|
|||||||
|
|
||||||
void write_compact_float(const number_float_t n, detail::input_format_t format)
|
void write_compact_float(const number_float_t n, detail::input_format_t format)
|
||||||
{
|
{
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||||
if (static_cast<double>(n) >= static_cast<double>(std::numeric_limits<float>::lowest()) &&
|
if (static_cast<double>(n) >= static_cast<double>(std::numeric_limits<float>::lowest()) &&
|
||||||
static_cast<double>(n) <= static_cast<double>((std::numeric_limits<float>::max)()) &&
|
static_cast<double>(n) <= static_cast<double>((std::numeric_limits<float>::max)()) &&
|
||||||
static_cast<double>(static_cast<float>(n)) == static_cast<double>(n))
|
static_cast<double>(static_cast<float>(n)) == static_cast<double>(n))
|
||||||
@ -14843,6 +14845,7 @@ class binary_writer
|
|||||||
: get_msgpack_float_prefix(n));
|
: get_msgpack_float_prefix(n));
|
||||||
write_number(n);
|
write_number(n);
|
||||||
}
|
}
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -15983,6 +15986,8 @@ char* to_chars(char* first, const char* last, FloatType value)
|
|||||||
*first++ = '-';
|
*first++ = '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||||
if (value == 0) // +-0
|
if (value == 0) // +-0
|
||||||
{
|
{
|
||||||
*first++ = '0';
|
*first++ = '0';
|
||||||
@ -15991,6 +15996,7 @@ char* to_chars(char* first, const char* last, FloatType value)
|
|||||||
*first++ = '0';
|
*first++ = '0';
|
||||||
return first;
|
return first;
|
||||||
}
|
}
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
JSON_ASSERT(last - first >= std::numeric_limits<FloatType>::max_digits10);
|
JSON_ASSERT(last - first >= std::numeric_limits<FloatType>::max_digits10);
|
||||||
|
|
||||||
@ -23365,6 +23371,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
|||||||
*/
|
*/
|
||||||
friend bool operator==(const_reference lhs, const_reference rhs) noexcept
|
friend bool operator==(const_reference lhs, const_reference rhs) noexcept
|
||||||
{
|
{
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||||
const auto lhs_type = lhs.type();
|
const auto lhs_type = lhs.type();
|
||||||
const auto rhs_type = rhs.type();
|
const auto rhs_type = rhs.type();
|
||||||
|
|
||||||
@ -23429,6 +23437,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -28,7 +28,6 @@ SOFTWARE.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "doctest_compatibility.h"
|
#include "doctest_compatibility.h"
|
||||||
DOCTEST_GCC_SUPPRESS_WARNING("-Wfloat-equal")
|
|
||||||
|
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
using nlohmann::json;
|
using nlohmann::json;
|
||||||
|
@ -28,7 +28,6 @@ SOFTWARE.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "doctest_compatibility.h"
|
#include "doctest_compatibility.h"
|
||||||
DOCTEST_GCC_SUPPRESS_WARNING("-Wfloat-equal")
|
|
||||||
|
|
||||||
#define JSON_TESTS_PRIVATE
|
#define JSON_TESTS_PRIVATE
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
@ -28,7 +28,6 @@ SOFTWARE.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "doctest_compatibility.h"
|
#include "doctest_compatibility.h"
|
||||||
DOCTEST_GCC_SUPPRESS_WARNING("-Wfloat-equal")
|
|
||||||
|
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
using nlohmann::json;
|
using nlohmann::json;
|
||||||
|
@ -28,7 +28,6 @@ SOFTWARE.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "doctest_compatibility.h"
|
#include "doctest_compatibility.h"
|
||||||
DOCTEST_GCC_SUPPRESS_WARNING("-Wfloat-equal")
|
|
||||||
|
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
using nlohmann::json;
|
using nlohmann::json;
|
||||||
|
@ -28,7 +28,6 @@ SOFTWARE.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "doctest_compatibility.h"
|
#include "doctest_compatibility.h"
|
||||||
DOCTEST_GCC_SUPPRESS_WARNING("-Wfloat-equal")
|
|
||||||
|
|
||||||
// for some reason including this after the json header leads to linker errors with VS 2017...
|
// for some reason including this after the json header leads to linker errors with VS 2017...
|
||||||
#include <locale>
|
#include <locale>
|
||||||
|
@ -28,7 +28,6 @@ SOFTWARE.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "doctest_compatibility.h"
|
#include "doctest_compatibility.h"
|
||||||
DOCTEST_GCC_SUPPRESS_WARNING("-Wfloat-equal")
|
|
||||||
|
|
||||||
// for some reason including this after the json header leads to linker errors with VS 2017...
|
// for some reason including this after the json header leads to linker errors with VS 2017...
|
||||||
#include <locale>
|
#include <locale>
|
||||||
|
Reference in New Issue
Block a user