tentative fix for #189
This commit is contained in:
parent
d8bb7176d5
commit
d00464a7bc
@ -34,8 +34,11 @@
|
||||
//# COMPILER / OS
|
||||
//#=====================================================================================================================
|
||||
|
||||
#define TOML_MAKE_VERSION(major, minor, patch) (((major)*10000) + ((minor)*100) + ((patch)))
|
||||
|
||||
#ifdef __clang__
|
||||
#define TOML_CLANG __clang_major__
|
||||
#define TOML_CLANG __clang_major__
|
||||
#define TOML_CLANG_VERSION TOML_MAKE_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__)
|
||||
#else
|
||||
#define TOML_CLANG 0
|
||||
#endif
|
||||
@ -76,6 +79,33 @@
|
||||
#define TOML_INTELLISENSE 0
|
||||
#endif
|
||||
|
||||
// special handling for apple clang; see:
|
||||
// - https://github.com/marzer/tomlplusplus/issues/189
|
||||
// - https://en.wikipedia.org/wiki/Xcode
|
||||
// - https://stackoverflow.com/questions/19387043/how-can-i-reliably-detect-the-version-of-clang-at-preprocessing-time
|
||||
#if TOML_CLANG && defined(__apple_build_version__)
|
||||
#undef TOML_CLANG
|
||||
#if TOML_CLANG_VERSION >= TOML_MAKE_VERSION(14, 0, 0)
|
||||
#define TOML_CLANG 14
|
||||
#elif TOML_CLANG_VERSION >= TOML_MAKE_VERSION(13, 1, 6)
|
||||
#define TOML_CLANG 13
|
||||
#elif TOML_CLANG_VERSION >= TOML_MAKE_VERSION(13, 0, 0)
|
||||
#define TOML_CLANG 12
|
||||
#elif TOML_CLANG_VERSION >= TOML_MAKE_VERSION(12, 0, 5)
|
||||
#define TOML_CLANG 11
|
||||
#elif TOML_CLANG_VERSION >= TOML_MAKE_VERSION(12, 0, 0)
|
||||
#define TOML_CLANG 10
|
||||
#elif TOML_CLANG_VERSION >= TOML_MAKE_VERSION(11, 0, 3)
|
||||
#define TOML_CLANG 9
|
||||
#elif TOML_CLANG_VERSION >= TOML_MAKE_VERSION(11, 0, 0)
|
||||
#define TOML_CLANG 8
|
||||
#elif TOML_CLANG_VERSION >= TOML_MAKE_VERSION(10, 0, 1)
|
||||
#define TOML_CLANG 7
|
||||
#else
|
||||
#define TOML_CLANG 6 // not strictly correct but doesn't matter below this
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//#=====================================================================================================================
|
||||
//# ARCHITECTURE
|
||||
//#=====================================================================================================================
|
||||
@ -438,6 +468,7 @@
|
||||
|
||||
#define TOML_PUSH_WARNINGS \
|
||||
TOML_PRAGMA_CLANG(diagnostic push) \
|
||||
TOML_PRAGMA_CLANG(diagnostic ignored "-Wunknown-warning-option") \
|
||||
static_assert(true)
|
||||
|
||||
#define TOML_DISABLE_SWITCH_WARNINGS \
|
||||
@ -938,8 +969,6 @@
|
||||
/// \def TOML_SMALL_FLOAT_TYPE
|
||||
/// \brief If your codebase has an additional 'small' float type (e.g. half-precision), this tells toml++ about it.
|
||||
/// \detail Not defined by default.
|
||||
/// \remark If you're building for a platform that has `_Float16` and/or `__fp16`, you don't
|
||||
/// need to use this configuration option to make toml++ aware of them. The library comes with that built-in.
|
||||
//# }}
|
||||
|
||||
#ifndef TOML_UNDEF_MACROS
|
||||
@ -998,6 +1027,15 @@ TOML_ENABLE_WARNINGS;
|
||||
/// \detail Not defined by default.
|
||||
//# }}
|
||||
|
||||
#ifndef TOML_ENABLE_FLOAT16
|
||||
#define TOML_ENABLE_FLOAT16 0
|
||||
#endif
|
||||
//# {{
|
||||
/// \def TOML_ENABLE_FLOAT16
|
||||
/// \brief Enable support for the built-in `_Float16` type.
|
||||
/// \detail Defaults to `0`.
|
||||
//# }}
|
||||
|
||||
/// @}
|
||||
//#====================================================================================================================
|
||||
//# CHARCONV SUPPORT
|
||||
@ -1051,20 +1089,6 @@ TOML_ENABLE_WARNINGS;
|
||||
#endif
|
||||
//# }}
|
||||
|
||||
//#=====================================================================================================================
|
||||
//# FLOAT16
|
||||
//#=====================================================================================================================
|
||||
|
||||
#ifndef TOML_ENABLE_FLOAT16
|
||||
#define TOML_ENABLE_FLOAT16 0
|
||||
#endif
|
||||
//# {{
|
||||
/// \def TOML_ENABLE_FLOAT16
|
||||
/// \brief Enable support for the built-in `_Float16` type.
|
||||
/// \detail Default behaviour is to try to determine support based on compiler, architecture and built-in defines, but
|
||||
/// you can override it to force-enable/disable support.
|
||||
//# }}
|
||||
|
||||
//#=====================================================================================================================
|
||||
//# FLOAT128
|
||||
//#=====================================================================================================================
|
||||
@ -1092,9 +1116,6 @@ TOML_ENABLE_WARNINGS;
|
||||
|
||||
#define TOML_LIB_SINGLE_HEADER 0
|
||||
|
||||
#define TOML_MAKE_VERSION(major, minor, patch) \
|
||||
((major) * 10000 + (minor) * 100 + (patch))
|
||||
|
||||
#if TOML_ENABLE_UNRELEASED_FEATURES
|
||||
#define TOML_LANG_EFFECTIVE_VERSION \
|
||||
TOML_MAKE_VERSION(TOML_LANG_MAJOR, TOML_LANG_MINOR, TOML_LANG_PATCH+1)
|
||||
|
@ -9,7 +9,7 @@ TOML_DISABLE_WARNINGS;
|
||||
#include <new>
|
||||
TOML_ENABLE_WARNINGS;
|
||||
|
||||
#if TOML_CLANG >= 8 || TOML_GCC >= 7 || TOML_ICC >= 1910 || TOML_MSVC >= 1914
|
||||
#if (!defined(__apple_build_version__) && TOML_CLANG >= 8) || TOML_GCC >= 7 || TOML_ICC >= 1910 || TOML_MSVC >= 1914
|
||||
#define TOML_LAUNDER(x) __builtin_launder(x)
|
||||
#elif defined(__cpp_lib_launder) && __cpp_lib_launder >= 201606
|
||||
#define TOML_LAUNDER(x) std::launder(x)
|
||||
|
@ -28,7 +28,7 @@ TOML_DISABLE_SUGGEST_ATTR_WARNINGS;
|
||||
#if TOML_CLANG >= 12
|
||||
#pragma clang diagnostic ignored "-Wc++20-extensions"
|
||||
#endif
|
||||
#if (TOML_CLANG == 13) && !defined(__APPLE__)
|
||||
#if TOML_CLANG == 13 && !defined(__APPLE__)
|
||||
#pragma clang diagnostic ignored "-Wreserved-identifier"
|
||||
#endif
|
||||
#endif
|
||||
@ -102,6 +102,7 @@ TOML_POP_WARNINGS;
|
||||
#undef TOML_ASYMMETRICAL_EQUALITY_OPS
|
||||
#undef TOML_ATTR
|
||||
#undef TOML_CLANG
|
||||
#undef TOML_CLANG_VERSION
|
||||
#undef TOML_CLOSED_ENUM
|
||||
#undef TOML_CLOSED_FLAGS_ENUM
|
||||
#undef TOML_COMPILER_HAS_EXCEPTIONS
|
||||
|
49
toml.hpp
49
toml.hpp
@ -70,8 +70,11 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define TOML_MAKE_VERSION(major, minor, patch) (((major)*10000) + ((minor)*100) + ((patch)))
|
||||
|
||||
#ifdef __clang__
|
||||
#define TOML_CLANG __clang_major__
|
||||
#define TOML_CLANG __clang_major__
|
||||
#define TOML_CLANG_VERSION TOML_MAKE_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__)
|
||||
#else
|
||||
#define TOML_CLANG 0
|
||||
#endif
|
||||
@ -112,6 +115,33 @@
|
||||
#define TOML_INTELLISENSE 0
|
||||
#endif
|
||||
|
||||
// special handling for apple clang; see:
|
||||
// - https://github.com/marzer/tomlplusplus/issues/189
|
||||
// - https://en.wikipedia.org/wiki/Xcode
|
||||
// - https://stackoverflow.com/questions/19387043/how-can-i-reliably-detect-the-version-of-clang-at-preprocessing-time
|
||||
#if TOML_CLANG && defined(__apple_build_version__)
|
||||
#undef TOML_CLANG
|
||||
#if TOML_CLANG_VERSION >= TOML_MAKE_VERSION(14, 0, 0)
|
||||
#define TOML_CLANG 14
|
||||
#elif TOML_CLANG_VERSION >= TOML_MAKE_VERSION(13, 1, 6)
|
||||
#define TOML_CLANG 13
|
||||
#elif TOML_CLANG_VERSION >= TOML_MAKE_VERSION(13, 0, 0)
|
||||
#define TOML_CLANG 12
|
||||
#elif TOML_CLANG_VERSION >= TOML_MAKE_VERSION(12, 0, 5)
|
||||
#define TOML_CLANG 11
|
||||
#elif TOML_CLANG_VERSION >= TOML_MAKE_VERSION(12, 0, 0)
|
||||
#define TOML_CLANG 10
|
||||
#elif TOML_CLANG_VERSION >= TOML_MAKE_VERSION(11, 0, 3)
|
||||
#define TOML_CLANG 9
|
||||
#elif TOML_CLANG_VERSION >= TOML_MAKE_VERSION(11, 0, 0)
|
||||
#define TOML_CLANG 8
|
||||
#elif TOML_CLANG_VERSION >= TOML_MAKE_VERSION(10, 0, 1)
|
||||
#define TOML_CLANG 7
|
||||
#else
|
||||
#define TOML_CLANG 6 // not strictly correct but doesn't matter below this
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// IA64
|
||||
#if defined(__ia64__) || defined(__ia64) || defined(_IA64) || defined(__IA64__) || defined(_M_IA64)
|
||||
#define TOML_ARCH_ITANIUM 1
|
||||
@ -464,6 +494,7 @@
|
||||
|
||||
#define TOML_PUSH_WARNINGS \
|
||||
TOML_PRAGMA_CLANG(diagnostic push) \
|
||||
TOML_PRAGMA_CLANG(diagnostic ignored "-Wunknown-warning-option") \
|
||||
static_assert(true)
|
||||
|
||||
#define TOML_DISABLE_SWITCH_WARNINGS \
|
||||
@ -896,6 +927,10 @@ TOML_ENABLE_WARNINGS;
|
||||
#define TOML_ASSERT_ASSUME(expr) TOML_ASSERT(expr)
|
||||
#endif
|
||||
|
||||
#ifndef TOML_ENABLE_FLOAT16
|
||||
#define TOML_ENABLE_FLOAT16 0
|
||||
#endif
|
||||
|
||||
#if !defined(TOML_FLOAT_CHARCONV) && (TOML_GCC || TOML_CLANG || (TOML_ICC && !TOML_ICC_CL))
|
||||
// not supported by any version of GCC or Clang as of 26/11/2020
|
||||
// not supported by any version of ICC on Linux as of 11/01/2021
|
||||
@ -930,10 +965,6 @@ TOML_ENABLE_WARNINGS;
|
||||
TOML_REQUIRES(condition)
|
||||
#define TOML_HIDDEN_CONSTRAINT(condition, ...) TOML_CONSTRAINED_TEMPLATE(condition, __VA_ARGS__)
|
||||
|
||||
#ifndef TOML_ENABLE_FLOAT16
|
||||
#define TOML_ENABLE_FLOAT16 0
|
||||
#endif
|
||||
|
||||
#if defined(__SIZEOF_FLOAT128__) && defined(__FLT128_MANT_DIG__) && defined(__LDBL_MANT_DIG__) \
|
||||
&& __FLT128_MANT_DIG__ > __LDBL_MANT_DIG__
|
||||
#define TOML_FLOAT128 __float128
|
||||
@ -960,9 +991,6 @@ TOML_ENABLE_WARNINGS;
|
||||
|
||||
#define TOML_LIB_SINGLE_HEADER 1
|
||||
|
||||
#define TOML_MAKE_VERSION(major, minor, patch) \
|
||||
((major) * 10000 + (minor) * 100 + (patch))
|
||||
|
||||
#if TOML_ENABLE_UNRELEASED_FEATURES
|
||||
#define TOML_LANG_EFFECTIVE_VERSION \
|
||||
TOML_MAKE_VERSION(TOML_LANG_MAJOR, TOML_LANG_MINOR, TOML_LANG_PATCH+1)
|
||||
@ -1091,7 +1119,7 @@ TOML_DISABLE_SUGGEST_ATTR_WARNINGS;
|
||||
#if TOML_CLANG >= 12
|
||||
#pragma clang diagnostic ignored "-Wc++20-extensions"
|
||||
#endif
|
||||
#if (TOML_CLANG == 13) && !defined(__APPLE__)
|
||||
#if TOML_CLANG == 13 && !defined(__APPLE__)
|
||||
#pragma clang diagnostic ignored "-Wreserved-identifier"
|
||||
#endif
|
||||
#endif
|
||||
@ -1102,7 +1130,7 @@ TOML_DISABLE_WARNINGS;
|
||||
#include <new>
|
||||
TOML_ENABLE_WARNINGS;
|
||||
|
||||
#if TOML_CLANG >= 8 || TOML_GCC >= 7 || TOML_ICC >= 1910 || TOML_MSVC >= 1914
|
||||
#if (!defined(__apple_build_version__) && TOML_CLANG >= 8) || TOML_GCC >= 7 || TOML_ICC >= 1910 || TOML_MSVC >= 1914
|
||||
#define TOML_LAUNDER(x) __builtin_launder(x)
|
||||
#elif defined(__cpp_lib_launder) && __cpp_lib_launder >= 201606
|
||||
#define TOML_LAUNDER(x) std::launder(x)
|
||||
@ -17094,6 +17122,7 @@ TOML_POP_WARNINGS;
|
||||
#undef TOML_ASYMMETRICAL_EQUALITY_OPS
|
||||
#undef TOML_ATTR
|
||||
#undef TOML_CLANG
|
||||
#undef TOML_CLANG_VERSION
|
||||
#undef TOML_CLOSED_ENUM
|
||||
#undef TOML_CLOSED_FLAGS_ENUM
|
||||
#undef TOML_COMPILER_HAS_EXCEPTIONS
|
||||
|
Loading…
Reference in New Issue
Block a user