mirror of
https://github.com/nlohmann/json.git
synced 2026-10-10 00:17:13 +00:00
Do not force inlining of the recovery stubs with MSVC
f8ff0942b marked the stubs that stand in for error recovery with
JSON_HEDLEY_ALWAYS_INLINE, which is __forceinline with MSVC. Visual
Studio 2015 and 2017 do not inline them and warn (C4714), which /WX
turns into an error on AppVeyor. The new internal macro
JSON_INTERNAL_ALWAYS_INLINE forces inlining everywhere else (including
clang-cl), and leaves the decision to MSVC. The MinGW objects keep their
smaller section counts, as GCC and clang still inline the stubs.
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
5 files changed
+62
-38
No files matched your search
@@ -483,7 +483,7 @@ class binary_reader
|
||||
|
||||
/// @copydoc skip_unsupported_bson_element
|
||||
template < bool Recover = AllowRecovery, enable_if_t < !Recover, int > = 0 >
|
||||
JSON_HEDLEY_ALWAYS_INLINE
|
||||
JSON_INTERNAL_ALWAYS_INLINE
|
||||
constexpr std::false_type skip_unsupported_bson_element(const char_int_type /*element_type*/) const noexcept
|
||||
{
|
||||
return {};
|
||||
@@ -3906,7 +3906,7 @@ class binary_reader
|
||||
|
||||
/// @copydoc recover_high_precision_number
|
||||
template < bool Recover = AllowRecovery, enable_if_t < !Recover, int > = 0 >
|
||||
JSON_HEDLEY_ALWAYS_INLINE
|
||||
JSON_INTERNAL_ALWAYS_INLINE
|
||||
constexpr std::false_type recover_high_precision_number(const std::vector<char>& /*number_vector*/, const std::size_t /*remaining*/ = 0) const noexcept
|
||||
{
|
||||
return {};
|
||||
@@ -5016,7 +5016,7 @@ class binary_reader
|
||||
@return false, so that the caller stops reading
|
||||
*/
|
||||
template<typename Exception>
|
||||
JSON_HEDLEY_ALWAYS_INLINE
|
||||
JSON_INTERNAL_ALWAYS_INLINE
|
||||
bool report_error(const std::size_t position, const std::string& last_token, const Exception& ex)
|
||||
{
|
||||
close_requested = sax->parse_error(position, last_token, ex);
|
||||
@@ -5053,7 +5053,7 @@ class binary_reader
|
||||
|
||||
/// @copydoc repair_requested
|
||||
template < bool Recover = AllowRecovery, enable_if_t < !Recover, int > = 0 >
|
||||
JSON_HEDLEY_ALWAYS_INLINE
|
||||
JSON_INTERNAL_ALWAYS_INLINE
|
||||
constexpr std::false_type repair_requested() const noexcept
|
||||
{
|
||||
return {};
|
||||
@@ -5078,7 +5078,7 @@ class binary_reader
|
||||
|
||||
/// @copydoc value_failed
|
||||
template < bool Recover = AllowRecovery, enable_if_t < !Recover, int > = 0 >
|
||||
JSON_HEDLEY_ALWAYS_INLINE
|
||||
JSON_INTERNAL_ALWAYS_INLINE
|
||||
constexpr std::false_type value_failed() const noexcept
|
||||
{
|
||||
return {};
|
||||
@@ -5129,7 +5129,7 @@ class binary_reader
|
||||
|
||||
/// @copydoc close_open_containers
|
||||
template < bool Recover = AllowRecovery, enable_if_t < !Recover, int > = 0 >
|
||||
JSON_HEDLEY_ALWAYS_INLINE
|
||||
JSON_INTERNAL_ALWAYS_INLINE
|
||||
void close_open_containers() const noexcept {}
|
||||
|
||||
/*!
|
||||
@@ -5165,7 +5165,7 @@ class binary_reader
|
||||
|
||||
/// @copydoc resync
|
||||
template < bool Recover = AllowRecovery, enable_if_t < !Recover, int > = 0 >
|
||||
JSON_HEDLEY_ALWAYS_INLINE
|
||||
JSON_INTERNAL_ALWAYS_INLINE
|
||||
constexpr std::false_type resync() const noexcept
|
||||
{
|
||||
return {};
|
||||
|
||||
Reference in new issue
Block a user