fixes for VS2017 (closes #55)

This commit is contained in:
Mark Gillard 2020-08-26 14:18:28 +03:00
parent 83b9ca3f9c
commit 977cfbbf4e
5 changed files with 50 additions and 54 deletions

View File

@ -90,6 +90,7 @@ TOML_POP_WARNINGS // TOML_DISABLE_SPAM_WARNINGS
#undef TOML_FLOAT_CHARCONV
#undef TOML_FP16
#undef TOML_GCC
#undef TOML_HAS_ATTR
#undef TOML_HAS_CUSTOM_OPTIONAL_TYPE
#undef TOML_HAS_INCLUDE
#undef TOML_ICC

View File

@ -92,61 +92,61 @@ TOML_IMPL_NAMESPACE_START
}
[[nodiscard]]
friend constexpr array_iterator operator + (const array_iterator& lhs, ptrdiff_t rhs) noexcept
friend array_iterator operator + (const array_iterator& lhs, ptrdiff_t rhs) noexcept
{
return { lhs.raw_ + rhs };
}
[[nodiscard]]
friend constexpr array_iterator operator + (ptrdiff_t lhs, const array_iterator& rhs) noexcept
friend array_iterator operator + (ptrdiff_t lhs, const array_iterator& rhs) noexcept
{
return { rhs.raw_ + lhs };
}
[[nodiscard]]
friend constexpr array_iterator operator - (const array_iterator& lhs, ptrdiff_t rhs) noexcept
friend array_iterator operator - (const array_iterator& lhs, ptrdiff_t rhs) noexcept
{
return { lhs.raw_ - rhs };
}
[[nodiscard]]
friend constexpr ptrdiff_t operator - (const array_iterator& lhs, const array_iterator& rhs) noexcept
friend ptrdiff_t operator - (const array_iterator& lhs, const array_iterator& rhs) noexcept
{
return lhs.raw_ - rhs.raw_;
}
[[nodiscard]]
friend constexpr bool operator == (const array_iterator& lhs, const array_iterator& rhs) noexcept
friend bool operator == (const array_iterator& lhs, const array_iterator& rhs) noexcept
{
return lhs.raw_ == rhs.raw_;
}
[[nodiscard]]
friend constexpr bool operator != (const array_iterator& lhs, const array_iterator& rhs) noexcept
friend bool operator != (const array_iterator& lhs, const array_iterator& rhs) noexcept
{
return lhs.raw_ != rhs.raw_;
}
[[nodiscard]]
friend constexpr bool operator < (const array_iterator& lhs, const array_iterator& rhs) noexcept
friend bool operator < (const array_iterator& lhs, const array_iterator& rhs) noexcept
{
return lhs.raw_ < rhs.raw_;
}
[[nodiscard]]
friend constexpr bool operator <= (const array_iterator& lhs, const array_iterator& rhs) noexcept
friend bool operator <= (const array_iterator& lhs, const array_iterator& rhs) noexcept
{
return lhs.raw_ <= rhs.raw_;
}
[[nodiscard]]
friend constexpr bool operator > (const array_iterator& lhs, const array_iterator& rhs) noexcept
friend bool operator > (const array_iterator& lhs, const array_iterator& rhs) noexcept
{
return lhs.raw_ > rhs.raw_;
}
[[nodiscard]]
friend constexpr bool operator >= (const array_iterator& lhs, const array_iterator& rhs) noexcept
friend bool operator >= (const array_iterator& lhs, const array_iterator& rhs) noexcept
{
return lhs.raw_ >= rhs.raw_;
}
@ -160,7 +160,6 @@ TOML_IMPL_NAMESPACE_START
TOML_DISABLE_WARNINGS
template <bool C = IsConst, typename = std::enable_if_t<!C>>
[[nodiscard]]
operator array_iterator<true>() const noexcept
{
return array_iterator<true>{ raw_ };

View File

@ -97,9 +97,6 @@
#define TOML_TRIVIAL_ABI __attribute__((__trivial_abi__))
#endif
#endif
#ifndef __EXCEPTIONS
#define TOML_COMPILER_EXCEPTIONS 0
#endif
#define TOML_LIKELY(...) (__builtin_expect(!!(__VA_ARGS__), 1) )
#define TOML_UNLIKELY(...) (__builtin_expect(!!(__VA_ARGS__), 0) )
@ -138,9 +135,6 @@
#if !defined(TOML_RELOPS_REORDERING) && defined(__cpp_impl_three_way_comparison)
#define TOML_RELOPS_REORDERING 1
#endif
#ifndef _CPPUNWIND
#define TOML_COMPILER_EXCEPTIONS 0
#endif
#endif // msvc
@ -205,9 +199,6 @@
#if !defined(TOML_RELOPS_REORDERING) && defined(__cpp_impl_three_way_comparison)
#define TOML_RELOPS_REORDERING 1
#endif
#ifndef __cpp_exceptions
#define TOML_COMPILER_EXCEPTIONS 0
#endif
#define TOML_LIKELY(...) (__builtin_expect(!!(__VA_ARGS__), 1) )
#define TOML_UNLIKELY(...) (__builtin_expect(!!(__VA_ARGS__), 0) )
@ -319,8 +310,10 @@ is no longer necessary.
#define TOML_HAS_INCLUDE(header) 0
#endif
#ifndef TOML_COMPILER_EXCEPTIONS
#if defined(__EXCEPTIONS) || defined(_CPPUNWIND) || defined(__cpp_exceptions)
#define TOML_COMPILER_EXCEPTIONS 1
#else
#define TOML_COMPILER_EXCEPTIONS 0
#endif
#if TOML_COMPILER_EXCEPTIONS
#if !defined(TOML_EXCEPTIONS) || (defined(TOML_EXCEPTIONS) && TOML_EXCEPTIONS)
@ -414,14 +407,20 @@ is no longer necessary.
#define TOML_CONSTEVAL constexpr
#endif
#ifdef __has_cpp_attribute
#define TOML_HAS_ATTR(...) __has_cpp_attribute(__VA_ARGS__)
#else
#define TOML_HAS_ATTR(...) 0
#endif
#if !defined(DOXYGEN) && !TOML_INTELLISENSE
#if !defined(TOML_LIKELY) && __has_cpp_attribute(likely)
#if !defined(TOML_LIKELY) && TOML_HAS_ATTR(likely)
#define TOML_LIKELY(...) (__VA_ARGS__) [[likely]]
#endif
#if !defined(TOML_UNLIKELY) && __has_cpp_attribute(unlikely)
#if !defined(TOML_UNLIKELY) && TOML_HAS_ATTR(unlikely)
#define TOML_UNLIKELY(...) (__VA_ARGS__) [[unlikely]]
#endif
#if __has_cpp_attribute(nodiscard) >= 201907L
#if TOML_HAS_ATTR(nodiscard) >= 201907L
#define TOML_NODISCARD_CTOR [[nodiscard]]
#endif
#endif

View File

@ -117,13 +117,13 @@ TOML_IMPL_NAMESPACE_START
}
[[nodiscard]]
friend constexpr bool operator == (const table_iterator& lhs, const table_iterator& rhs) noexcept
friend bool operator == (const table_iterator& lhs, const table_iterator& rhs) noexcept
{
return lhs.raw_ == rhs.raw_;
}
[[nodiscard]]
friend constexpr bool operator != (const table_iterator& lhs, const table_iterator& rhs) noexcept
friend bool operator != (const table_iterator& lhs, const table_iterator& rhs) noexcept
{
return lhs.raw_ != rhs.raw_;
}
@ -131,7 +131,6 @@ TOML_IMPL_NAMESPACE_START
TOML_DISABLE_WARNINGS
template <bool C = IsConst, typename = std::enable_if_t<!C>>
[[nodiscard]]
operator table_iterator<true>() const noexcept
{
return table_iterator<true>{ raw_ };

View File

@ -130,9 +130,6 @@
#define TOML_TRIVIAL_ABI __attribute__((__trivial_abi__))
#endif
#endif
#ifndef __EXCEPTIONS
#define TOML_COMPILER_EXCEPTIONS 0
#endif
#define TOML_LIKELY(...) (__builtin_expect(!!(__VA_ARGS__), 1) )
#define TOML_UNLIKELY(...) (__builtin_expect(!!(__VA_ARGS__), 0) )
@ -167,9 +164,6 @@
#if !defined(TOML_RELOPS_REORDERING) && defined(__cpp_impl_three_way_comparison)
#define TOML_RELOPS_REORDERING 1
#endif
#ifndef _CPPUNWIND
#define TOML_COMPILER_EXCEPTIONS 0
#endif
#endif // msvc
@ -226,9 +220,6 @@
#if !defined(TOML_RELOPS_REORDERING) && defined(__cpp_impl_three_way_comparison)
#define TOML_RELOPS_REORDERING 1
#endif
#ifndef __cpp_exceptions
#define TOML_COMPILER_EXCEPTIONS 0
#endif
#define TOML_LIKELY(...) (__builtin_expect(!!(__VA_ARGS__), 1) )
#define TOML_UNLIKELY(...) (__builtin_expect(!!(__VA_ARGS__), 0) )
@ -332,8 +323,10 @@ is no longer necessary.
#define TOML_HAS_INCLUDE(header) 0
#endif
#ifndef TOML_COMPILER_EXCEPTIONS
#if defined(__EXCEPTIONS) || defined(_CPPUNWIND) || defined(__cpp_exceptions)
#define TOML_COMPILER_EXCEPTIONS 1
#else
#define TOML_COMPILER_EXCEPTIONS 0
#endif
#if TOML_COMPILER_EXCEPTIONS
#if !defined(TOML_EXCEPTIONS) || (defined(TOML_EXCEPTIONS) && TOML_EXCEPTIONS)
@ -427,14 +420,20 @@ is no longer necessary.
#define TOML_CONSTEVAL constexpr
#endif
#ifdef __has_cpp_attribute
#define TOML_HAS_ATTR(...) __has_cpp_attribute(__VA_ARGS__)
#else
#define TOML_HAS_ATTR(...) 0
#endif
#if !defined(DOXYGEN) && !TOML_INTELLISENSE
#if !defined(TOML_LIKELY) && __has_cpp_attribute(likely)
#if !defined(TOML_LIKELY) && TOML_HAS_ATTR(likely)
#define TOML_LIKELY(...) (__VA_ARGS__) [[likely]]
#endif
#if !defined(TOML_UNLIKELY) && __has_cpp_attribute(unlikely)
#if !defined(TOML_UNLIKELY) && TOML_HAS_ATTR(unlikely)
#define TOML_UNLIKELY(...) (__VA_ARGS__) [[unlikely]]
#endif
#if __has_cpp_attribute(nodiscard) >= 201907L
#if TOML_HAS_ATTR(nodiscard) >= 201907L
#define TOML_NODISCARD_CTOR [[nodiscard]]
#endif
#endif
@ -3342,61 +3341,61 @@ TOML_IMPL_NAMESPACE_START
}
[[nodiscard]]
friend constexpr array_iterator operator + (const array_iterator& lhs, ptrdiff_t rhs) noexcept
friend array_iterator operator + (const array_iterator& lhs, ptrdiff_t rhs) noexcept
{
return { lhs.raw_ + rhs };
}
[[nodiscard]]
friend constexpr array_iterator operator + (ptrdiff_t lhs, const array_iterator& rhs) noexcept
friend array_iterator operator + (ptrdiff_t lhs, const array_iterator& rhs) noexcept
{
return { rhs.raw_ + lhs };
}
[[nodiscard]]
friend constexpr array_iterator operator - (const array_iterator& lhs, ptrdiff_t rhs) noexcept
friend array_iterator operator - (const array_iterator& lhs, ptrdiff_t rhs) noexcept
{
return { lhs.raw_ - rhs };
}
[[nodiscard]]
friend constexpr ptrdiff_t operator - (const array_iterator& lhs, const array_iterator& rhs) noexcept
friend ptrdiff_t operator - (const array_iterator& lhs, const array_iterator& rhs) noexcept
{
return lhs.raw_ - rhs.raw_;
}
[[nodiscard]]
friend constexpr bool operator == (const array_iterator& lhs, const array_iterator& rhs) noexcept
friend bool operator == (const array_iterator& lhs, const array_iterator& rhs) noexcept
{
return lhs.raw_ == rhs.raw_;
}
[[nodiscard]]
friend constexpr bool operator != (const array_iterator& lhs, const array_iterator& rhs) noexcept
friend bool operator != (const array_iterator& lhs, const array_iterator& rhs) noexcept
{
return lhs.raw_ != rhs.raw_;
}
[[nodiscard]]
friend constexpr bool operator < (const array_iterator& lhs, const array_iterator& rhs) noexcept
friend bool operator < (const array_iterator& lhs, const array_iterator& rhs) noexcept
{
return lhs.raw_ < rhs.raw_;
}
[[nodiscard]]
friend constexpr bool operator <= (const array_iterator& lhs, const array_iterator& rhs) noexcept
friend bool operator <= (const array_iterator& lhs, const array_iterator& rhs) noexcept
{
return lhs.raw_ <= rhs.raw_;
}
[[nodiscard]]
friend constexpr bool operator > (const array_iterator& lhs, const array_iterator& rhs) noexcept
friend bool operator > (const array_iterator& lhs, const array_iterator& rhs) noexcept
{
return lhs.raw_ > rhs.raw_;
}
[[nodiscard]]
friend constexpr bool operator >= (const array_iterator& lhs, const array_iterator& rhs) noexcept
friend bool operator >= (const array_iterator& lhs, const array_iterator& rhs) noexcept
{
return lhs.raw_ >= rhs.raw_;
}
@ -3410,7 +3409,6 @@ TOML_IMPL_NAMESPACE_START
TOML_DISABLE_WARNINGS
template <bool C = IsConst, typename = std::enable_if_t<!C>>
[[nodiscard]]
operator array_iterator<true>() const noexcept
{
return array_iterator<true>{ raw_ };
@ -3931,13 +3929,13 @@ TOML_IMPL_NAMESPACE_START
}
[[nodiscard]]
friend constexpr bool operator == (const table_iterator& lhs, const table_iterator& rhs) noexcept
friend bool operator == (const table_iterator& lhs, const table_iterator& rhs) noexcept
{
return lhs.raw_ == rhs.raw_;
}
[[nodiscard]]
friend constexpr bool operator != (const table_iterator& lhs, const table_iterator& rhs) noexcept
friend bool operator != (const table_iterator& lhs, const table_iterator& rhs) noexcept
{
return lhs.raw_ != rhs.raw_;
}
@ -3945,7 +3943,6 @@ TOML_IMPL_NAMESPACE_START
TOML_DISABLE_WARNINGS
template <bool C = IsConst, typename = std::enable_if_t<!C>>
[[nodiscard]]
operator table_iterator<true>() const noexcept
{
return table_iterator<true>{ raw_ };
@ -11687,6 +11684,7 @@ TOML_POP_WARNINGS // TOML_DISABLE_SPAM_WARNINGS
#undef TOML_FLOAT_CHARCONV
#undef TOML_FP16
#undef TOML_GCC
#undef TOML_HAS_ATTR
#undef TOML_HAS_CUSTOM_OPTIONAL_TYPE
#undef TOML_HAS_INCLUDE
#undef TOML_ICC