Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
910fabf8
Unverified
Commit
910fabf8
authored
3 years ago
by
Niels Lohmann
Committed by
GitHub
3 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2925 from nlohmann/issue2924
Guard GCC pragmas
parents
57d31d1b
e20f3f95
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
0 deletions
+24
-0
include/nlohmann/detail/conversions/to_chars.hpp
include/nlohmann/detail/conversions/to_chars.hpp
+4
-0
include/nlohmann/detail/output/binary_writer.hpp
include/nlohmann/detail/output/binary_writer.hpp
+4
-0
include/nlohmann/json.hpp
include/nlohmann/json.hpp
+4
-0
single_include/nlohmann/json.hpp
single_include/nlohmann/json.hpp
+12
-0
No files found.
include/nlohmann/detail/conversions/to_chars.hpp
View file @
910fabf8
...
@@ -1066,8 +1066,10 @@ char* to_chars(char* first, const char* last, FloatType value)
...
@@ -1066,8 +1066,10 @@ char* to_chars(char* first, const char* last, FloatType value)
*
first
++
=
'-'
;
*
first
++
=
'-'
;
}
}
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
if
(
value
==
0
)
// +-0
if
(
value
==
0
)
// +-0
{
{
*
first
++
=
'0'
;
*
first
++
=
'0'
;
...
@@ -1076,7 +1078,9 @@ char* to_chars(char* first, const char* last, FloatType value)
...
@@ -1076,7 +1078,9 @@ char* to_chars(char* first, const char* last, FloatType value)
*
first
++
=
'0'
;
*
first
++
=
'0'
;
return
first
;
return
first
;
}
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#pragma GCC diagnostic pop
#endif
JSON_ASSERT
(
last
-
first
>=
std
::
numeric_limits
<
FloatType
>::
max_digits10
);
JSON_ASSERT
(
last
-
first
>=
std
::
numeric_limits
<
FloatType
>::
max_digits10
);
...
...
This diff is collapsed.
Click to expand it.
include/nlohmann/detail/output/binary_writer.hpp
View file @
910fabf8
...
@@ -1525,8 +1525,10 @@ class binary_writer
...
@@ -1525,8 +1525,10 @@ 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
)
{
{
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
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
))
...
@@ -1543,7 +1545,9 @@ class binary_writer
...
@@ -1543,7 +1545,9 @@ class binary_writer
:
get_msgpack_float_prefix
(
n
));
:
get_msgpack_float_prefix
(
n
));
write_number
(
n
);
write_number
(
n
);
}
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#pragma GCC diagnostic pop
#endif
}
}
public:
public:
...
...
This diff is collapsed.
Click to expand it.
include/nlohmann/json.hpp
View file @
910fabf8
...
@@ -6278,8 +6278,10 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
...
@@ -6278,8 +6278,10 @@ 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
{
{
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
const
auto
lhs_type
=
lhs
.
type
();
const
auto
lhs_type
=
lhs
.
type
();
const
auto
rhs_type
=
rhs
.
type
();
const
auto
rhs_type
=
rhs
.
type
();
...
@@ -6344,7 +6346,9 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
...
@@ -6344,7 +6346,9 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
}
}
return
false
;
return
false
;
#ifdef __GNUC__
#pragma GCC diagnostic pop
#pragma GCC diagnostic pop
#endif
}
}
/*!
/*!
...
...
This diff is collapsed.
Click to expand it.
single_include/nlohmann/json.hpp
View file @
910fabf8
...
@@ -14826,8 +14826,10 @@ class binary_writer
...
@@ -14826,8 +14826,10 @@ 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)
{
{
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
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))
...
@@ -14844,7 +14846,9 @@ class binary_writer
...
@@ -14844,7 +14846,9 @@ class binary_writer
: get_msgpack_float_prefix(n));
: get_msgpack_float_prefix(n));
write_number(n);
write_number(n);
}
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#pragma GCC diagnostic pop
#endif
}
}
public:
public:
...
@@ -15985,8 +15989,10 @@ char* to_chars(char* first, const char* last, FloatType value)
...
@@ -15985,8 +15989,10 @@ char* to_chars(char* first, const char* last, FloatType value)
*first++ = '-';
*first++ = '-';
}
}
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
if (value == 0) // +-0
if (value == 0) // +-0
{
{
*first++ = '0';
*first++ = '0';
...
@@ -15995,7 +16001,9 @@ char* to_chars(char* first, const char* last, FloatType value)
...
@@ -15995,7 +16001,9 @@ char* to_chars(char* first, const char* last, FloatType value)
*first++ = '0';
*first++ = '0';
return first;
return first;
}
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#pragma GCC diagnostic pop
#endif
JSON_ASSERT(last - first >= std::numeric_limits<FloatType>::max_digits10);
JSON_ASSERT(last - first >= std::numeric_limits<FloatType>::max_digits10);
...
@@ -23370,8 +23378,10 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
...
@@ -23370,8 +23378,10 @@ 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
{
{
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
const auto lhs_type = lhs.type();
const auto lhs_type = lhs.type();
const auto rhs_type = rhs.type();
const auto rhs_type = rhs.type();
...
@@ -23436,7 +23446,9 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
...
@@ -23436,7 +23446,9 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
}
}
return false;
return false;
#ifdef __GNUC__
#pragma GCC diagnostic pop
#pragma GCC diagnostic pop
#endif
}
}
/*!
/*!
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment