forked from fmtlib/fmt
Cleanup the core API
This commit is contained in:
@ -138,20 +138,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef FMT_DEPRECATED
|
||||
# if FMT_HAS_CPP14_ATTRIBUTE(deprecated) || FMT_MSC_VERSION >= 1900
|
||||
# define FMT_DEPRECATED [[deprecated]]
|
||||
# else
|
||||
# if (defined(__GNUC__) && !defined(__LCC__)) || defined(__clang__)
|
||||
# define FMT_DEPRECATED __attribute__((deprecated))
|
||||
# elif FMT_MSC_VERSION
|
||||
# define FMT_DEPRECATED __declspec(deprecated)
|
||||
# else
|
||||
# define FMT_DEPRECATED /* deprecated */
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Disable [[noreturn]] on MSVC/NVCC because of bogus unreachable code warnings.
|
||||
#if FMT_EXCEPTIONS && FMT_HAS_CPP_ATTRIBUTE(noreturn) && !FMT_MSC_VERSION && \
|
||||
!defined(__NVCC__)
|
||||
@ -160,17 +146,6 @@
|
||||
# define FMT_NORETURN
|
||||
#endif
|
||||
|
||||
#if FMT_HAS_CPP17_ATTRIBUTE(fallthrough)
|
||||
# define FMT_FALLTHROUGH [[fallthrough]]
|
||||
#elif defined(__clang__)
|
||||
# define FMT_FALLTHROUGH [[clang::fallthrough]]
|
||||
#elif FMT_GCC_VERSION >= 700 && \
|
||||
(!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 520)
|
||||
# define FMT_FALLTHROUGH [[gnu::fallthrough]]
|
||||
#else
|
||||
# define FMT_FALLTHROUGH
|
||||
#endif
|
||||
|
||||
#ifndef FMT_NODISCARD
|
||||
# if FMT_HAS_CPP17_ATTRIBUTE(nodiscard)
|
||||
# define FMT_NODISCARD [[nodiscard]]
|
||||
@ -179,16 +154,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef FMT_USE_FLOAT
|
||||
# define FMT_USE_FLOAT 1
|
||||
#endif
|
||||
#ifndef FMT_USE_DOUBLE
|
||||
# define FMT_USE_DOUBLE 1
|
||||
#endif
|
||||
#ifndef FMT_USE_LONG_DOUBLE
|
||||
# define FMT_USE_LONG_DOUBLE 1
|
||||
#endif
|
||||
|
||||
#ifndef FMT_INLINE
|
||||
# if FMT_GCC_VERSION || FMT_CLANG_VERSION
|
||||
# define FMT_INLINE inline __attribute__((always_inline))
|
||||
@ -372,12 +337,12 @@ FMT_NORETURN FMT_API void assert_fail(const char* file, int line,
|
||||
# ifdef NDEBUG
|
||||
// FMT_ASSERT is not empty to avoid -Wempty-body.
|
||||
# define FMT_ASSERT(condition, message) \
|
||||
::fmt::detail::ignore_unused((condition), (message))
|
||||
fmt::detail::ignore_unused((condition), (message))
|
||||
# else
|
||||
# define FMT_ASSERT(condition, message) \
|
||||
((condition) /* void() fails with -Winvalid-constexpr on clang 4.0.1 */ \
|
||||
? (void)0 \
|
||||
: ::fmt::detail::assert_fail(__FILE__, __LINE__, (message)))
|
||||
: fmt::detail::assert_fail(__FILE__, __LINE__, (message)))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -2605,11 +2570,10 @@ FMT_CONSTEXPR auto parse_format_specs(ParseContext& ctx)
|
||||
-> decltype(ctx.begin()) {
|
||||
using char_type = typename ParseContext::char_type;
|
||||
using context = buffer_context<char_type>;
|
||||
using stripped_type = typename strip_named_arg<T>::type;
|
||||
using mapped_type = conditional_t<
|
||||
mapped_type_constant<T, context>::value != type::custom_type,
|
||||
decltype(arg_mapper<context>().map(std::declval<const T&>())),
|
||||
stripped_type>;
|
||||
typename strip_named_arg<T>::type>;
|
||||
return formatter<mapped_type, char_type>().parse(ctx);
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,31 @@
|
||||
|
||||
#include "core.h"
|
||||
|
||||
#if FMT_HAS_CPP17_ATTRIBUTE(fallthrough)
|
||||
# define FMT_FALLTHROUGH [[fallthrough]]
|
||||
#elif defined(__clang__)
|
||||
# define FMT_FALLTHROUGH [[clang::fallthrough]]
|
||||
#elif FMT_GCC_VERSION >= 700 && \
|
||||
(!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 520)
|
||||
# define FMT_FALLTHROUGH [[gnu::fallthrough]]
|
||||
#else
|
||||
# define FMT_FALLTHROUGH
|
||||
#endif
|
||||
|
||||
#ifndef FMT_DEPRECATED
|
||||
# if FMT_HAS_CPP14_ATTRIBUTE(deprecated) || FMT_MSC_VERSION >= 1900
|
||||
# define FMT_DEPRECATED [[deprecated]]
|
||||
# else
|
||||
# if (defined(__GNUC__) && !defined(__LCC__)) || defined(__clang__)
|
||||
# define FMT_DEPRECATED __attribute__((deprecated))
|
||||
# elif FMT_MSC_VERSION
|
||||
# define FMT_DEPRECATED __declspec(deprecated)
|
||||
# else
|
||||
# define FMT_DEPRECATED /* deprecated */
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if FMT_GCC_VERSION
|
||||
# define FMT_GCC_VISIBILITY_HIDDEN __attribute__((visibility("hidden")))
|
||||
#else
|
||||
@ -798,6 +823,16 @@ using is_integer =
|
||||
!std::is_same<T, char>::value &&
|
||||
!std::is_same<T, wchar_t>::value>;
|
||||
|
||||
#ifndef FMT_USE_FLOAT
|
||||
# define FMT_USE_FLOAT 1
|
||||
#endif
|
||||
#ifndef FMT_USE_DOUBLE
|
||||
# define FMT_USE_DOUBLE 1
|
||||
#endif
|
||||
#ifndef FMT_USE_LONG_DOUBLE
|
||||
# define FMT_USE_LONG_DOUBLE 1
|
||||
#endif
|
||||
|
||||
#ifndef FMT_USE_FLOAT128
|
||||
# ifdef __clang__
|
||||
// Clang emulates GCC, so it has to appear early.
|
||||
|
Reference in New Issue
Block a user