mirror of
https://github.com/simdjson/simdjson
synced 2026-06-08 17:27:07 +00:00
Fix GCC 7 strict-overflow warning
This commit is contained in:
@@ -25,6 +25,12 @@ simdjson_really_inline bool object_iterator::operator==(const object_iterator &o
|
||||
simdjson_really_inline bool object_iterator::operator!=(const object_iterator &) const noexcept {
|
||||
return iter.is_open();
|
||||
}
|
||||
|
||||
// GCC 7 warns when the first line of this function is inlined away into oblivion due to the caller
|
||||
// relating depth and iterator depth, which is a desired effect. It does not happen if is_open is
|
||||
// marked non-inline.
|
||||
SIMDJSON_PUSH_DISABLE_WARNINGS
|
||||
SIMDJSON_DISABLE_STRICT_OVERFLOW_WARNING
|
||||
simdjson_really_inline object_iterator &object_iterator::operator++() noexcept {
|
||||
// TODO this is a safety rail ... users should exit loops as soon as they receive an error.
|
||||
// Nonetheless, let's see if performance is OK with this if statement--the compiler may give it to us for free.
|
||||
@@ -37,6 +43,7 @@ simdjson_really_inline object_iterator &object_iterator::operator++() noexcept {
|
||||
if ((error = iter.has_next_field().get(has_value) )) { return *this; };
|
||||
return *this;
|
||||
}
|
||||
SIMDJSON_POP_DISABLE_WARNINGS
|
||||
|
||||
//
|
||||
// ### Live States
|
||||
|
||||
Reference in New Issue
Block a user