mirror of
https://github.com/nlohmann/json.git
synced 2026-04-17 21:48:57 +00:00
Merge branch 'develop' of https://github.com/nlohmann/json into feature/optional
Conflicts: test/src/unit-conversions.cpp
This commit is contained in:
@@ -39,15 +39,15 @@ class byte_container_with_subtype : public BinaryType
|
||||
: container_type(std::move(b))
|
||||
{}
|
||||
|
||||
byte_container_with_subtype(const container_type& b, std::uint8_t subtype) noexcept(noexcept(container_type(b)))
|
||||
byte_container_with_subtype(const container_type& b, std::uint8_t subtype_) noexcept(noexcept(container_type(b)))
|
||||
: container_type(b)
|
||||
, m_subtype(subtype)
|
||||
, m_subtype(subtype_)
|
||||
, m_has_subtype(true)
|
||||
{}
|
||||
|
||||
byte_container_with_subtype(container_type&& b, std::uint8_t subtype) noexcept(noexcept(container_type(std::move(b))))
|
||||
byte_container_with_subtype(container_type&& b, std::uint8_t subtype_) noexcept(noexcept(container_type(std::move(b))))
|
||||
: container_type(std::move(b))
|
||||
, m_subtype(subtype)
|
||||
, m_subtype(subtype_)
|
||||
, m_has_subtype(true)
|
||||
{}
|
||||
|
||||
@@ -80,9 +80,9 @@ class byte_container_with_subtype : public BinaryType
|
||||
|
||||
@since version 3.8.0
|
||||
*/
|
||||
void set_subtype(std::uint8_t subtype) noexcept
|
||||
void set_subtype(std::uint8_t subtype_) noexcept
|
||||
{
|
||||
m_subtype = subtype;
|
||||
m_subtype = subtype_;
|
||||
m_has_subtype = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,19 +83,19 @@ std::size_t hash(const BasicJsonType& j)
|
||||
return combine(type, h);
|
||||
}
|
||||
|
||||
case nlohmann::detail::value_t::number_unsigned:
|
||||
case BasicJsonType::value_t::number_unsigned:
|
||||
{
|
||||
const auto h = std::hash<number_unsigned_t> {}(j.template get<number_unsigned_t>());
|
||||
return combine(type, h);
|
||||
}
|
||||
|
||||
case nlohmann::detail::value_t::number_float:
|
||||
case BasicJsonType::value_t::number_float:
|
||||
{
|
||||
const auto h = std::hash<number_float_t> {}(j.template get<number_float_t>());
|
||||
return combine(type, h);
|
||||
}
|
||||
|
||||
case nlohmann::detail::value_t::binary:
|
||||
case BasicJsonType::value_t::binary:
|
||||
{
|
||||
auto seed = combine(type, j.get_binary().size());
|
||||
const auto h = std::hash<bool> {}(j.get_binary().has_subtype());
|
||||
@@ -108,8 +108,9 @@ std::size_t hash(const BasicJsonType& j)
|
||||
return seed;
|
||||
}
|
||||
|
||||
default: // LCOV_EXCL_LINE
|
||||
JSON_ASSERT(false); // LCOV_EXCL_LINE
|
||||
default: // LCOV_EXCL_LINE
|
||||
JSON_ASSERT(false); // LCOV_EXCL_LINE
|
||||
return 0; // LCOV_EXCL_LINE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -752,8 +752,9 @@ class binary_reader
|
||||
return parse_cbor_internal(true, tag_handler);
|
||||
}
|
||||
|
||||
default: // LCOV_EXCL_LINE
|
||||
default: // LCOV_EXCL_LINE
|
||||
JSON_ASSERT(false); // LCOV_EXCL_LINE
|
||||
return false; // LCOV_EXCL_LINE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ class iter_impl
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
JSON_PRIVATE_UNLESS_TESTED:
|
||||
/*!
|
||||
@brief set the iterator to the first value
|
||||
@pre The iterator is initialized; i.e. `m_object != nullptr`.
|
||||
@@ -627,7 +627,7 @@ class iter_impl
|
||||
return operator*();
|
||||
}
|
||||
|
||||
private:
|
||||
JSON_PRIVATE_UNLESS_TESTED:
|
||||
/// associated JSON instance
|
||||
pointer m_object = nullptr;
|
||||
/// the actual iterator of the associated instance
|
||||
|
||||
@@ -23,6 +23,7 @@ class primitive_iterator_t
|
||||
static constexpr difference_type begin_value = 0;
|
||||
static constexpr difference_type end_value = begin_value + 1;
|
||||
|
||||
JSON_PRIVATE_UNLESS_TESTED:
|
||||
/// iterator as signed integer type
|
||||
difference_type m_it = (std::numeric_limits<std::ptrdiff_t>::min)();
|
||||
|
||||
|
||||
@@ -375,6 +375,7 @@ class json_pointer
|
||||
return static_cast<size_type>(res);
|
||||
}
|
||||
|
||||
JSON_PRIVATE_UNLESS_TESTED:
|
||||
json_pointer top() const
|
||||
{
|
||||
if (JSON_HEDLEY_UNLIKELY(empty()))
|
||||
@@ -387,6 +388,7 @@ class json_pointer
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
/*!
|
||||
@brief create and return a reference to the pointed to value
|
||||
|
||||
@@ -823,6 +825,7 @@ class json_pointer
|
||||
{}
|
||||
}
|
||||
|
||||
JSON_PRIVATE_UNLESS_TESTED:
|
||||
/// escape "~" to "~0" and "/" to "~1"
|
||||
static std::string escape(std::string s)
|
||||
{
|
||||
@@ -838,6 +841,7 @@ class json_pointer
|
||||
replace_substring(s, "~0", "~");
|
||||
}
|
||||
|
||||
private:
|
||||
/*!
|
||||
@param[in] reference_string the reference string to the current value
|
||||
@param[in] value the value to consider
|
||||
|
||||
@@ -17,19 +17,14 @@ class json_ref
|
||||
|
||||
json_ref(value_type&& value)
|
||||
: owned_value(std::move(value))
|
||||
, value_ref(&owned_value)
|
||||
, is_rvalue(true)
|
||||
{}
|
||||
|
||||
json_ref(const value_type& value)
|
||||
: value_ref(const_cast<value_type*>(&value))
|
||||
, is_rvalue(false)
|
||||
: value_ref(&value)
|
||||
{}
|
||||
|
||||
json_ref(std::initializer_list<json_ref> init)
|
||||
: owned_value(init)
|
||||
, value_ref(&owned_value)
|
||||
, is_rvalue(true)
|
||||
{}
|
||||
|
||||
template <
|
||||
@@ -37,8 +32,6 @@ class json_ref
|
||||
enable_if_t<std::is_constructible<value_type, Args...>::value, int> = 0 >
|
||||
json_ref(Args && ... args)
|
||||
: owned_value(std::forward<Args>(args)...)
|
||||
, value_ref(&owned_value)
|
||||
, is_rvalue(true)
|
||||
{}
|
||||
|
||||
// class should be movable only
|
||||
@@ -50,27 +43,26 @@ class json_ref
|
||||
|
||||
value_type moved_or_copied() const
|
||||
{
|
||||
if (is_rvalue)
|
||||
if (value_ref == nullptr)
|
||||
{
|
||||
return std::move(*value_ref);
|
||||
return std::move(owned_value);
|
||||
}
|
||||
return *value_ref;
|
||||
}
|
||||
|
||||
value_type const& operator*() const
|
||||
{
|
||||
return *static_cast<value_type const*>(value_ref);
|
||||
return value_ref ? *value_ref : owned_value;
|
||||
}
|
||||
|
||||
value_type const* operator->() const
|
||||
{
|
||||
return static_cast<value_type const*>(value_ref);
|
||||
return &** this;
|
||||
}
|
||||
|
||||
private:
|
||||
mutable value_type owned_value = nullptr;
|
||||
value_type* value_ref = nullptr;
|
||||
const bool is_rvalue = true;
|
||||
value_type const* value_ref = nullptr;
|
||||
};
|
||||
} // namespace detail
|
||||
} // namespace nlohmann
|
||||
|
||||
@@ -91,6 +91,13 @@
|
||||
#define JSON_ASSERT(x) assert(x)
|
||||
#endif
|
||||
|
||||
// allow to access some private functions (needed by the test suite)
|
||||
#if defined(JSON_TESTS_PRIVATE)
|
||||
#define JSON_PRIVATE_UNLESS_TESTED public
|
||||
#else
|
||||
#define JSON_PRIVATE_UNLESS_TESTED private
|
||||
#endif
|
||||
|
||||
/*!
|
||||
@brief macro to briefly define a mapping between an enum and JSON
|
||||
@def NLOHMANN_JSON_SERIALIZE_ENUM
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#undef JSON_CATCH
|
||||
#undef JSON_THROW
|
||||
#undef JSON_TRY
|
||||
#undef JSON_PRIVATE_UNLESS_TESTED
|
||||
#undef JSON_HAS_CPP_14
|
||||
#undef JSON_HAS_CPP_17
|
||||
#undef NLOHMANN_BASIC_JSON_TPL_DECLARATION
|
||||
|
||||
@@ -2,19 +2,32 @@
|
||||
|
||||
#include <cstddef> // size_t
|
||||
#include <type_traits> // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type
|
||||
#include <utility> // index_sequence, make_index_sequence, index_sequence_for
|
||||
|
||||
#include <nlohmann/detail/macro_scope.hpp>
|
||||
|
||||
namespace nlohmann
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
// alias templates to reduce boilerplate
|
||||
template<bool B, typename T = void>
|
||||
using enable_if_t = typename std::enable_if<B, T>::type;
|
||||
|
||||
template<typename T>
|
||||
using uncvref_t = typename std::remove_cv<typename std::remove_reference<T>::type>::type;
|
||||
|
||||
// implementation of C++14 index_sequence and affiliates
|
||||
#ifdef JSON_HAS_CPP_14
|
||||
|
||||
// the following utilities are natively available in C++14
|
||||
using std::enable_if_t;
|
||||
using std::index_sequence;
|
||||
using std::make_index_sequence;
|
||||
using std::index_sequence_for;
|
||||
|
||||
#else
|
||||
|
||||
// alias templates to reduce boilerplate
|
||||
template<bool B, typename T = void>
|
||||
using enable_if_t = typename std::enable_if<B, T>::type;
|
||||
|
||||
// source: https://stackoverflow.com/a/32223343
|
||||
template<std::size_t... Ints>
|
||||
struct index_sequence
|
||||
@@ -45,6 +58,8 @@ template<> struct make_index_sequence<1> : index_sequence<0> {};
|
||||
template<typename... Ts>
|
||||
using index_sequence_for = make_index_sequence<sizeof...(Ts)>;
|
||||
|
||||
#endif
|
||||
|
||||
// dispatch utility (taken from ranges-v3)
|
||||
template<unsigned N> struct priority_tag : priority_tag < N - 1 > {};
|
||||
template<> struct priority_tag<0> {};
|
||||
@@ -58,5 +73,6 @@ struct static_const
|
||||
|
||||
template<typename T>
|
||||
constexpr T static_const<T>::value;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace nlohmann
|
||||
|
||||
@@ -168,7 +168,9 @@ struct is_iterator_traits<iterator_traits<T>>
|
||||
is_detected<reference_t, traits>::value;
|
||||
};
|
||||
|
||||
// source: https://stackoverflow.com/a/37193089/4116453
|
||||
// The following implementation of is_complete_type is taken from
|
||||
// https://blogs.msdn.microsoft.com/vcblog/2015/12/02/partial-support-for-expression-sfinae-in-vs-2015-update-1/
|
||||
// and is written by Xiang Fan who agreed to using it in this library.
|
||||
|
||||
template<typename T, typename = void>
|
||||
struct is_complete_type : std::false_type {};
|
||||
@@ -186,7 +188,6 @@ struct is_compatible_object_type_impl <
|
||||
enable_if_t < is_detected<mapped_type_t, CompatibleObjectType>::value&&
|
||||
is_detected<key_type_t, CompatibleObjectType>::value >>
|
||||
{
|
||||
|
||||
using object_t = typename BasicJsonType::object_t;
|
||||
|
||||
// macOS's is_constructible does not play well with nonesuch...
|
||||
|
||||
@@ -362,7 +362,7 @@ class serializer
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
JSON_PRIVATE_UNLESS_TESTED:
|
||||
/*!
|
||||
@brief dump escaped string
|
||||
|
||||
@@ -625,6 +625,7 @@ class serializer
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
/*!
|
||||
@brief count digits
|
||||
|
||||
@@ -880,6 +881,7 @@ class serializer
|
||||
}
|
||||
};
|
||||
|
||||
JSON_ASSERT(byte < utf8d.size());
|
||||
const std::uint8_t type = utf8d[byte];
|
||||
|
||||
codep = (state != UTF8_ACCEPT)
|
||||
|
||||
@@ -73,6 +73,10 @@ SOFTWARE.
|
||||
#include <nlohmann/json_fwd.hpp>
|
||||
#include <nlohmann/ordered_map.hpp>
|
||||
|
||||
#if defined(JSON_HAS_CPP_17)
|
||||
#include <string_view>
|
||||
#endif
|
||||
|
||||
/*!
|
||||
@brief namespace for Niels Lohmann
|
||||
@see https://github.com/nlohmann
|
||||
@@ -189,6 +193,7 @@ class basic_json
|
||||
/// workaround type for MSVC
|
||||
using basic_json_t = NLOHMANN_BASIC_JSON_TPL;
|
||||
|
||||
JSON_PRIVATE_UNLESS_TESTED:
|
||||
// convenience aliases for types residing in namespace detail;
|
||||
using lexer = ::nlohmann::detail::lexer_base<basic_json>;
|
||||
|
||||
@@ -204,6 +209,7 @@ class basic_json
|
||||
std::move(cb), allow_exceptions, ignore_comments);
|
||||
}
|
||||
|
||||
private:
|
||||
using primitive_iterator_t = ::nlohmann::detail::primitive_iterator_t;
|
||||
template<typename BasicJsonType>
|
||||
using internal_iterator = ::nlohmann::detail::internal_iterator<BasicJsonType>;
|
||||
@@ -220,6 +226,7 @@ class basic_json
|
||||
using binary_reader = ::nlohmann::detail::binary_reader<basic_json, InputType>;
|
||||
template<typename CharType> using binary_writer = ::nlohmann::detail::binary_writer<basic_json, CharType>;
|
||||
|
||||
JSON_PRIVATE_UNLESS_TESTED:
|
||||
using serializer = ::nlohmann::detail::serializer<basic_json>;
|
||||
|
||||
public:
|
||||
@@ -920,20 +927,21 @@ class basic_json
|
||||
AllocatorType<T> alloc;
|
||||
using AllocatorTraits = std::allocator_traits<AllocatorType<T>>;
|
||||
|
||||
auto deleter = [&](T * object)
|
||||
auto deleter = [&](T * obj)
|
||||
{
|
||||
AllocatorTraits::deallocate(alloc, object, 1);
|
||||
AllocatorTraits::deallocate(alloc, obj, 1);
|
||||
};
|
||||
std::unique_ptr<T, decltype(deleter)> object(AllocatorTraits::allocate(alloc, 1), deleter);
|
||||
AllocatorTraits::construct(alloc, object.get(), std::forward<Args>(args)...);
|
||||
JSON_ASSERT(object != nullptr);
|
||||
return object.release();
|
||||
std::unique_ptr<T, decltype(deleter)> obj(AllocatorTraits::allocate(alloc, 1), deleter);
|
||||
AllocatorTraits::construct(alloc, obj.get(), std::forward<Args>(args)...);
|
||||
JSON_ASSERT(obj != nullptr);
|
||||
return obj.release();
|
||||
}
|
||||
|
||||
////////////////////////
|
||||
// JSON value storage //
|
||||
////////////////////////
|
||||
|
||||
JSON_PRIVATE_UNLESS_TESTED:
|
||||
/*!
|
||||
@brief a JSON value
|
||||
|
||||
@@ -1210,6 +1218,7 @@ class basic_json
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
/*!
|
||||
@brief checks the class invariants
|
||||
|
||||
@@ -6947,7 +6956,7 @@ class basic_json
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
JSON_PRIVATE_UNLESS_TESTED:
|
||||
//////////////////////
|
||||
// member variables //
|
||||
//////////////////////
|
||||
@@ -7793,7 +7802,7 @@ class basic_json
|
||||
string | 0x02 | string
|
||||
document | 0x03 | object
|
||||
array | 0x04 | array
|
||||
binary | 0x05 | still unsupported
|
||||
binary | 0x05 | binary
|
||||
undefined | 0x06 | still unsupported
|
||||
ObjectId | 0x07 | still unsupported
|
||||
boolean | 0x08 | boolean
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <utility> // pair
|
||||
#include <vector> // vector
|
||||
|
||||
#include <nlohmann/detail/macro_scope.hpp>
|
||||
|
||||
namespace nlohmann
|
||||
{
|
||||
|
||||
@@ -64,7 +66,7 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
|
||||
}
|
||||
}
|
||||
|
||||
throw std::out_of_range("key not found");
|
||||
JSON_THROW(std::out_of_range("key not found"));
|
||||
}
|
||||
|
||||
const T& at(const Key& key) const
|
||||
@@ -77,7 +79,7 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
|
||||
}
|
||||
}
|
||||
|
||||
throw std::out_of_range("key not found");
|
||||
JSON_THROW(std::out_of_range("key not found"));
|
||||
}
|
||||
|
||||
size_type erase(const Key& key)
|
||||
@@ -166,6 +168,19 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
|
||||
Container::push_back(value);
|
||||
return {--this->end(), true};
|
||||
}
|
||||
|
||||
template<typename InputIt>
|
||||
using require_input_iter = typename std::enable_if<std::is_convertible<typename std::iterator_traits<InputIt>::iterator_category,
|
||||
std::input_iterator_tag>::value>::type;
|
||||
|
||||
template<typename InputIt, typename = require_input_iter<InputIt>>
|
||||
void insert(InputIt first, InputIt last)
|
||||
{
|
||||
for (auto it = first; it != last; ++it)
|
||||
{
|
||||
insert(*it);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace nlohmann
|
||||
|
||||
254
include/nlohmann/thirdparty/hedley/hedley.hpp
vendored
254
include/nlohmann/thirdparty/hedley/hedley.hpp
vendored
@@ -10,11 +10,11 @@
|
||||
* SPDX-License-Identifier: CC0-1.0
|
||||
*/
|
||||
|
||||
#if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 13)
|
||||
#if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 14)
|
||||
#if defined(JSON_HEDLEY_VERSION)
|
||||
#undef JSON_HEDLEY_VERSION
|
||||
#endif
|
||||
#define JSON_HEDLEY_VERSION 13
|
||||
#define JSON_HEDLEY_VERSION 14
|
||||
|
||||
#if defined(JSON_HEDLEY_STRINGIFY_EX)
|
||||
#undef JSON_HEDLEY_STRINGIFY_EX
|
||||
@@ -87,18 +87,18 @@
|
||||
#if defined(JSON_HEDLEY_MSVC_VERSION)
|
||||
#undef JSON_HEDLEY_MSVC_VERSION
|
||||
#endif
|
||||
#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000)
|
||||
#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) && !defined(__ICL)
|
||||
#define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, (_MSC_FULL_VER % 10000000) / 100000, (_MSC_FULL_VER % 100000) / 100)
|
||||
#elif defined(_MSC_FULL_VER)
|
||||
#elif defined(_MSC_FULL_VER) && !defined(__ICL)
|
||||
#define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, (_MSC_FULL_VER % 1000000) / 10000, (_MSC_FULL_VER % 10000) / 10)
|
||||
#elif defined(_MSC_VER)
|
||||
#elif defined(_MSC_VER) && !defined(__ICL)
|
||||
#define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0)
|
||||
#endif
|
||||
|
||||
#if defined(JSON_HEDLEY_MSVC_VERSION_CHECK)
|
||||
#undef JSON_HEDLEY_MSVC_VERSION_CHECK
|
||||
#endif
|
||||
#if !defined(_MSC_VER)
|
||||
#if !defined(JSON_HEDLEY_MSVC_VERSION)
|
||||
#define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (0)
|
||||
#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||
#define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch)))
|
||||
@@ -111,9 +111,9 @@
|
||||
#if defined(JSON_HEDLEY_INTEL_VERSION)
|
||||
#undef JSON_HEDLEY_INTEL_VERSION
|
||||
#endif
|
||||
#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE)
|
||||
#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && !defined(__ICL)
|
||||
#define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE)
|
||||
#elif defined(__INTEL_COMPILER)
|
||||
#elif defined(__INTEL_COMPILER) && !defined(__ICL)
|
||||
#define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0)
|
||||
#endif
|
||||
|
||||
@@ -126,6 +126,22 @@
|
||||
#define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (0)
|
||||
#endif
|
||||
|
||||
#if defined(JSON_HEDLEY_INTEL_CL_VERSION)
|
||||
#undef JSON_HEDLEY_INTEL_CL_VERSION
|
||||
#endif
|
||||
#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && defined(__ICL)
|
||||
#define JSON_HEDLEY_INTEL_CL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER, __INTEL_COMPILER_UPDATE, 0)
|
||||
#endif
|
||||
|
||||
#if defined(JSON_HEDLEY_INTEL_CL_VERSION_CHECK)
|
||||
#undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK
|
||||
#endif
|
||||
#if defined(JSON_HEDLEY_INTEL_CL_VERSION)
|
||||
#define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_CL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
|
||||
#else
|
||||
#define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (0)
|
||||
#endif
|
||||
|
||||
#if defined(JSON_HEDLEY_PGI_VERSION)
|
||||
#undef JSON_HEDLEY_PGI_VERSION
|
||||
#endif
|
||||
@@ -678,6 +694,72 @@
|
||||
#define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
|
||||
#endif
|
||||
|
||||
#if \
|
||||
(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \
|
||||
defined(__clang__) || \
|
||||
JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \
|
||||
JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
|
||||
JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \
|
||||
JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \
|
||||
JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
|
||||
JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
|
||||
JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \
|
||||
JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \
|
||||
JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \
|
||||
JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,0,0) || \
|
||||
JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
|
||||
JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
|
||||
JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \
|
||||
JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \
|
||||
JSON_HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \
|
||||
(JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) && defined(__C99_PRAGMA_OPERATOR))
|
||||
#define JSON_HEDLEY_PRAGMA(value) _Pragma(#value)
|
||||
#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0)
|
||||
#define JSON_HEDLEY_PRAGMA(value) __pragma(value)
|
||||
#else
|
||||
#define JSON_HEDLEY_PRAGMA(value)
|
||||
#endif
|
||||
|
||||
#if defined(JSON_HEDLEY_DIAGNOSTIC_PUSH)
|
||||
#undef JSON_HEDLEY_DIAGNOSTIC_PUSH
|
||||
#endif
|
||||
#if defined(JSON_HEDLEY_DIAGNOSTIC_POP)
|
||||
#undef JSON_HEDLEY_DIAGNOSTIC_POP
|
||||
#endif
|
||||
#if defined(__clang__)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push")
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop")
|
||||
#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)")
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)")
|
||||
#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push")
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")
|
||||
#elif \
|
||||
JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \
|
||||
JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push))
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop))
|
||||
#elif JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("push")
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("pop")
|
||||
#elif \
|
||||
JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
|
||||
JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
|
||||
JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,4,0) || \
|
||||
JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \
|
||||
JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
|
||||
JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push")
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop")
|
||||
#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)")
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)")
|
||||
#else
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_PUSH
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_POP
|
||||
#endif
|
||||
|
||||
/* JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ is for
|
||||
HEDLEY INTERNAL USE ONLY. API subject to change without notice. */
|
||||
#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_)
|
||||
@@ -686,12 +768,22 @@
|
||||
#if defined(__cplusplus)
|
||||
# if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat")
|
||||
# if JSON_HEDLEY_HAS_WARNING("-Wc++17-extensions")
|
||||
# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \
|
||||
# if JSON_HEDLEY_HAS_WARNING("-Wc++1z-extensions")
|
||||
# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \
|
||||
JSON_HEDLEY_DIAGNOSTIC_PUSH \
|
||||
_Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \
|
||||
_Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \
|
||||
_Pragma("clang diagnostic ignored \"-Wc++1z-extensions\"") \
|
||||
xpr \
|
||||
JSON_HEDLEY_DIAGNOSTIC_POP
|
||||
# else
|
||||
# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \
|
||||
JSON_HEDLEY_DIAGNOSTIC_PUSH \
|
||||
_Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \
|
||||
_Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \
|
||||
xpr \
|
||||
JSON_HEDLEY_DIAGNOSTIC_POP
|
||||
# endif
|
||||
# else
|
||||
# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \
|
||||
JSON_HEDLEY_DIAGNOSTIC_PUSH \
|
||||
@@ -756,7 +848,7 @@
|
||||
# define JSON_HEDLEY_CPP_CAST(T, expr) \
|
||||
JSON_HEDLEY_DIAGNOSTIC_PUSH \
|
||||
_Pragma("diag_suppress=Pe137") \
|
||||
JSON_HEDLEY_DIAGNOSTIC_POP \
|
||||
JSON_HEDLEY_DIAGNOSTIC_POP
|
||||
# else
|
||||
# define JSON_HEDLEY_CPP_CAST(T, expr) ((T) (expr))
|
||||
# endif
|
||||
@@ -764,70 +856,6 @@
|
||||
# define JSON_HEDLEY_CPP_CAST(T, expr) (expr)
|
||||
#endif
|
||||
|
||||
#if \
|
||||
(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \
|
||||
defined(__clang__) || \
|
||||
JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \
|
||||
JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
|
||||
JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \
|
||||
JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \
|
||||
JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
|
||||
JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
|
||||
JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \
|
||||
JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \
|
||||
JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \
|
||||
JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,0,0) || \
|
||||
JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
|
||||
JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
|
||||
JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \
|
||||
JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \
|
||||
JSON_HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \
|
||||
(JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) && defined(__C99_PRAGMA_OPERATOR))
|
||||
#define JSON_HEDLEY_PRAGMA(value) _Pragma(#value)
|
||||
#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0)
|
||||
#define JSON_HEDLEY_PRAGMA(value) __pragma(value)
|
||||
#else
|
||||
#define JSON_HEDLEY_PRAGMA(value)
|
||||
#endif
|
||||
|
||||
#if defined(JSON_HEDLEY_DIAGNOSTIC_PUSH)
|
||||
#undef JSON_HEDLEY_DIAGNOSTIC_PUSH
|
||||
#endif
|
||||
#if defined(JSON_HEDLEY_DIAGNOSTIC_POP)
|
||||
#undef JSON_HEDLEY_DIAGNOSTIC_POP
|
||||
#endif
|
||||
#if defined(__clang__)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push")
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop")
|
||||
#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)")
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)")
|
||||
#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push")
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")
|
||||
#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push))
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop))
|
||||
#elif JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("push")
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("pop")
|
||||
#elif \
|
||||
JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
|
||||
JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
|
||||
JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,4,0) || \
|
||||
JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \
|
||||
JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
|
||||
JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push")
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop")
|
||||
#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)")
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)")
|
||||
#else
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_PUSH
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_POP
|
||||
#endif
|
||||
|
||||
#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED)
|
||||
#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
|
||||
#endif
|
||||
@@ -835,6 +863,10 @@
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
|
||||
#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)")
|
||||
#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:1478 1786))
|
||||
#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1216,1444,1445")
|
||||
#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444")
|
||||
#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0)
|
||||
@@ -873,6 +905,8 @@
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"")
|
||||
#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("warning(disable:161)")
|
||||
#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:161))
|
||||
#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675")
|
||||
#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0)
|
||||
@@ -902,8 +936,12 @@
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
|
||||
#elif JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("warning(disable:1292)")
|
||||
#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:1292))
|
||||
#elif JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:5030))
|
||||
#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097,1098")
|
||||
#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)
|
||||
#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097")
|
||||
#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)
|
||||
@@ -938,12 +976,11 @@
|
||||
#if defined(JSON_HEDLEY_DEPRECATED_FOR)
|
||||
#undef JSON_HEDLEY_DEPRECATED_FOR
|
||||
#endif
|
||||
#if JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0)
|
||||
#if \
|
||||
JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \
|
||||
JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
|
||||
#define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " # since))
|
||||
#define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated("Since " #since "; use " #replacement))
|
||||
#elif defined(__cplusplus) && (__cplusplus >= 201402L)
|
||||
#define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]])
|
||||
#define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]])
|
||||
#elif \
|
||||
JSON_HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) || \
|
||||
JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \
|
||||
@@ -958,6 +995,9 @@
|
||||
JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0)
|
||||
#define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__("Since " #since)))
|
||||
#define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement)))
|
||||
#elif defined(__cplusplus) && (__cplusplus >= 201402L)
|
||||
#define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]])
|
||||
#define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]])
|
||||
#elif \
|
||||
JSON_HEDLEY_HAS_ATTRIBUTE(deprecated) || \
|
||||
JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \
|
||||
@@ -977,7 +1017,8 @@
|
||||
#define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__))
|
||||
#elif \
|
||||
JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \
|
||||
JSON_HEDLEY_PELLES_VERSION_CHECK(6,50,0)
|
||||
JSON_HEDLEY_PELLES_VERSION_CHECK(6,50,0) || \
|
||||
JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
|
||||
#define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated)
|
||||
#define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated)
|
||||
#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
|
||||
@@ -1006,13 +1047,7 @@
|
||||
#if defined(JSON_HEDLEY_WARN_UNUSED_RESULT_MSG)
|
||||
#undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG
|
||||
#endif
|
||||
#if (JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L)
|
||||
#define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])
|
||||
#define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard(msg)]])
|
||||
#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard)
|
||||
#define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])
|
||||
#define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])
|
||||
#elif \
|
||||
#if \
|
||||
JSON_HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \
|
||||
JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \
|
||||
JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
|
||||
@@ -1031,6 +1066,12 @@
|
||||
JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)
|
||||
#define JSON_HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
|
||||
#define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) __attribute__((__warn_unused_result__))
|
||||
#elif (JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L)
|
||||
#define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])
|
||||
#define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard(msg)]])
|
||||
#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard)
|
||||
#define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])
|
||||
#define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])
|
||||
#elif defined(_Check_return_) /* SAL */
|
||||
#define JSON_HEDLEY_WARN_UNUSED_RESULT _Check_return_
|
||||
#define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) _Check_return_
|
||||
@@ -1083,7 +1124,9 @@
|
||||
#define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__))
|
||||
#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0)
|
||||
#define JSON_HEDLEY_NO_RETURN _Pragma("does_not_return")
|
||||
#elif JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0)
|
||||
#elif \
|
||||
JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \
|
||||
JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
|
||||
#define JSON_HEDLEY_NO_RETURN __declspec(noreturn)
|
||||
#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus)
|
||||
#define JSON_HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;")
|
||||
@@ -1115,7 +1158,8 @@
|
||||
#endif
|
||||
#if \
|
||||
JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \
|
||||
JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
|
||||
JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
|
||||
JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
|
||||
#define JSON_HEDLEY_ASSUME(expr) __assume(expr)
|
||||
#elif JSON_HEDLEY_HAS_BUILTIN(__builtin_assume)
|
||||
#define JSON_HEDLEY_ASSUME(expr) __builtin_assume(expr)
|
||||
@@ -1247,7 +1291,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP
|
||||
#define JSON_HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr))
|
||||
#endif
|
||||
#if \
|
||||
JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) || \
|
||||
(JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(JSON_HEDLEY_PGI_VERSION)) || \
|
||||
JSON_HEDLEY_GCC_VERSION_CHECK(9,0,0)
|
||||
# define JSON_HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability( (expr), (value), (probability))
|
||||
# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1 , (probability))
|
||||
@@ -1255,7 +1299,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP
|
||||
# define JSON_HEDLEY_LIKELY(expr) __builtin_expect (!!(expr), 1 )
|
||||
# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect (!!(expr), 0 )
|
||||
#elif \
|
||||
JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) || \
|
||||
(JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \
|
||||
JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \
|
||||
JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
|
||||
(JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \
|
||||
@@ -1319,7 +1363,9 @@ JSON_HEDLEY_DIAGNOSTIC_POP
|
||||
#define JSON_HEDLEY_MALLOC __attribute__((__malloc__))
|
||||
#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0)
|
||||
#define JSON_HEDLEY_MALLOC _Pragma("returns_new_memory")
|
||||
#elif JSON_HEDLEY_MSVC_VERSION_CHECK(14, 0, 0)
|
||||
#elif \
|
||||
JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \
|
||||
JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
|
||||
#define JSON_HEDLEY_MALLOC __declspec(restrict)
|
||||
#else
|
||||
#define JSON_HEDLEY_MALLOC
|
||||
@@ -1400,6 +1446,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP
|
||||
JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \
|
||||
JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \
|
||||
JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
|
||||
JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \
|
||||
JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
|
||||
JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
|
||||
JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \
|
||||
@@ -1430,6 +1477,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP
|
||||
#define JSON_HEDLEY_INLINE __inline__
|
||||
#elif \
|
||||
JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \
|
||||
JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \
|
||||
JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
|
||||
JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,1,0) || \
|
||||
JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \
|
||||
@@ -1464,7 +1512,9 @@ JSON_HEDLEY_DIAGNOSTIC_POP
|
||||
JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
|
||||
JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)
|
||||
# define JSON_HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) JSON_HEDLEY_INLINE
|
||||
#elif JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0)
|
||||
#elif \
|
||||
JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \
|
||||
JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
|
||||
# define JSON_HEDLEY_ALWAYS_INLINE __forceinline
|
||||
#elif defined(__cplusplus) && \
|
||||
( \
|
||||
@@ -1504,7 +1554,9 @@ JSON_HEDLEY_DIAGNOSTIC_POP
|
||||
JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
|
||||
JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)
|
||||
#define JSON_HEDLEY_NEVER_INLINE __attribute__((__noinline__))
|
||||
#elif JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0)
|
||||
#elif \
|
||||
JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \
|
||||
JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
|
||||
#define JSON_HEDLEY_NEVER_INLINE __declspec(noinline)
|
||||
#elif JSON_HEDLEY_PGI_VERSION_CHECK(10,2,0)
|
||||
#define JSON_HEDLEY_NEVER_INLINE _Pragma("noinline")
|
||||
@@ -1567,6 +1619,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP
|
||||
#define JSON_HEDLEY_NO_THROW __attribute__((__nothrow__))
|
||||
#elif \
|
||||
JSON_HEDLEY_MSVC_VERSION_CHECK(13,1,0) || \
|
||||
JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \
|
||||
JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0)
|
||||
#define JSON_HEDLEY_NO_THROW __declspec(nothrow)
|
||||
#else
|
||||
@@ -1731,7 +1784,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP
|
||||
#if \
|
||||
!defined(__cplusplus) && ( \
|
||||
(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \
|
||||
JSON_HEDLEY_HAS_FEATURE(c_static_assert) || \
|
||||
(JSON_HEDLEY_HAS_FEATURE(c_static_assert) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \
|
||||
JSON_HEDLEY_GCC_VERSION_CHECK(6,0,0) || \
|
||||
JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
|
||||
defined(_Static_assert) \
|
||||
@@ -1739,7 +1792,8 @@ JSON_HEDLEY_DIAGNOSTIC_POP
|
||||
# define JSON_HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message)
|
||||
#elif \
|
||||
(defined(__cplusplus) && (__cplusplus >= 201103L)) || \
|
||||
JSON_HEDLEY_MSVC_VERSION_CHECK(16,0,0)
|
||||
JSON_HEDLEY_MSVC_VERSION_CHECK(16,0,0) || \
|
||||
JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
|
||||
# define JSON_HEDLEY_STATIC_ASSERT(expr, message) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message))
|
||||
#else
|
||||
# define JSON_HEDLEY_STATIC_ASSERT(expr, message)
|
||||
@@ -1799,7 +1853,9 @@ JSON_HEDLEY_DIAGNOSTIC_POP
|
||||
JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \
|
||||
JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
|
||||
# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(GCC warning msg)
|
||||
#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0)
|
||||
#elif \
|
||||
JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \
|
||||
JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
|
||||
# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(message(msg))
|
||||
#else
|
||||
# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_MESSAGE(msg)
|
||||
@@ -1837,6 +1893,8 @@ JSON_HEDLEY_DIAGNOSTIC_POP
|
||||
#endif
|
||||
#if JSON_HEDLEY_HAS_ATTRIBUTE(flag_enum)
|
||||
#define JSON_HEDLEY_FLAGS __attribute__((__flag_enum__))
|
||||
#else
|
||||
#define JSON_HEDLEY_FLAGS
|
||||
#endif
|
||||
|
||||
#if defined(JSON_HEDLEY_FLAGS_CAST)
|
||||
@@ -1856,7 +1914,9 @@ JSON_HEDLEY_DIAGNOSTIC_POP
|
||||
#if defined(JSON_HEDLEY_EMPTY_BASES)
|
||||
#undef JSON_HEDLEY_EMPTY_BASES
|
||||
#endif
|
||||
#if JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20,0,0)
|
||||
#if \
|
||||
(JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20,0,0)) || \
|
||||
JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
|
||||
#define JSON_HEDLEY_EMPTY_BASES __declspec(empty_bases)
|
||||
#else
|
||||
#define JSON_HEDLEY_EMPTY_BASES
|
||||
|
||||
@@ -74,6 +74,8 @@
|
||||
#undef JSON_HEDLEY_IBM_VERSION_CHECK
|
||||
#undef JSON_HEDLEY_IMPORT
|
||||
#undef JSON_HEDLEY_INLINE
|
||||
#undef JSON_HEDLEY_INTEL_CL_VERSION
|
||||
#undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK
|
||||
#undef JSON_HEDLEY_INTEL_VERSION
|
||||
#undef JSON_HEDLEY_INTEL_VERSION_CHECK
|
||||
#undef JSON_HEDLEY_IS_CONSTANT
|
||||
|
||||
Reference in New Issue
Block a user