mirror of
https://github.com/fmtlib/fmt.git
synced 2025-04-16 14:42:25 +00:00
commit
de3cea7f02
@ -55,7 +55,7 @@ using fmt::internal::Arg;
|
|||||||
#if __GNUC__ && !__EXCEPTIONS
|
#if __GNUC__ && !__EXCEPTIONS
|
||||||
# define FMT_EXCEPTIONS 0
|
# define FMT_EXCEPTIONS 0
|
||||||
#endif
|
#endif
|
||||||
#if _MSC_VER && !_HAS_EXCEPTIONS
|
#if defined(_MSC_VER) && !_HAS_EXCEPTIONS
|
||||||
# define FMT_EXCEPTIONS 0
|
# define FMT_EXCEPTIONS 0
|
||||||
#endif
|
#endif
|
||||||
#ifndef FMT_EXCEPTIONS
|
#ifndef FMT_EXCEPTIONS
|
||||||
@ -84,7 +84,7 @@ using fmt::internal::Arg;
|
|||||||
# define FMT_FUNC
|
# define FMT_FUNC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# pragma warning(push)
|
# pragma warning(push)
|
||||||
# pragma warning(disable: 4127) // conditional expression is constant
|
# pragma warning(disable: 4127) // conditional expression is constant
|
||||||
# pragma warning(disable: 4702) // unreachable code
|
# pragma warning(disable: 4702) // unreachable code
|
||||||
@ -1325,6 +1325,6 @@ template int fmt::internal::CharTraits<wchar_t>::format_float(
|
|||||||
|
|
||||||
#endif // FMT_HEADER_ONLY
|
#endif // FMT_HEADER_ONLY
|
||||||
|
|
||||||
#if _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# pragma warning(pop)
|
# pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
29
format.h
29
format.h
@ -48,6 +48,10 @@
|
|||||||
# include <sstream>
|
# include <sstream>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _SECURE_SCL
|
||||||
|
# define _SECURE_SCL 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#if _SECURE_SCL
|
#if _SECURE_SCL
|
||||||
# include <iterator>
|
# include <iterator>
|
||||||
#endif
|
#endif
|
||||||
@ -160,6 +164,10 @@ inline uint32_t clzll(uint64_t x) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Define FMT_USE_NOEXCEPT to make C++ Format use noexcept (C++11 feature).
|
// Define FMT_USE_NOEXCEPT to make C++ Format use noexcept (C++11 feature).
|
||||||
|
#ifndef FMT_USE_NOEXCEPT
|
||||||
|
# define FMT_USE_NOEXCEPT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef FMT_NOEXCEPT
|
#ifndef FMT_NOEXCEPT
|
||||||
# if FMT_USE_NOEXCEPT || FMT_HAS_FEATURE(cxx_noexcept) || \
|
# if FMT_USE_NOEXCEPT || FMT_HAS_FEATURE(cxx_noexcept) || \
|
||||||
(FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || \
|
(FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || \
|
||||||
@ -172,6 +180,10 @@ inline uint32_t clzll(uint64_t x) {
|
|||||||
|
|
||||||
// A macro to disallow the copy constructor and operator= functions
|
// A macro to disallow the copy constructor and operator= functions
|
||||||
// This should be used in the private: declarations for a class
|
// This should be used in the private: declarations for a class
|
||||||
|
#ifndef FMT_USE_DELETED_FUNCTIONS
|
||||||
|
# define FMT_USE_DELETED_FUNCTIONS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#if FMT_USE_DELETED_FUNCTIONS || FMT_HAS_FEATURE(cxx_deleted_functions) || \
|
#if FMT_USE_DELETED_FUNCTIONS || FMT_HAS_FEATURE(cxx_deleted_functions) || \
|
||||||
(FMT_GCC_VERSION >= 404 && FMT_HAS_GXX_CXX11) || _MSC_VER >= 1800
|
(FMT_GCC_VERSION >= 404 && FMT_HAS_GXX_CXX11) || _MSC_VER >= 1800
|
||||||
# define FMT_DELETED_OR_UNDEFINED = delete
|
# define FMT_DELETED_OR_UNDEFINED = delete
|
||||||
@ -582,6 +594,15 @@ inline int isinfinity(long double x) { return isinf(x); }
|
|||||||
inline int isinfinity(double x) { return std::isinf(x); }
|
inline int isinfinity(double x) { return std::isinf(x); }
|
||||||
inline int isinfinity(long double x) { return std::isinf(x); }
|
inline int isinfinity(long double x) { return std::isinf(x); }
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
// Portable version of isnan.
|
||||||
|
# ifdef isnan
|
||||||
|
inline int isnotanumber(double x) { return isnan(x); }
|
||||||
|
inline int isnotanumber(long double x) { return isnan(x); }
|
||||||
|
# else
|
||||||
|
inline int isnotanumber(double x) { return std::isnan(x); }
|
||||||
|
inline int isnotanumber(long double x) { return std::isnan(x); }
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
inline int getsign(double value) {
|
inline int getsign(double value) {
|
||||||
if (value < 0) return 1;
|
if (value < 0) return 1;
|
||||||
@ -595,6 +616,10 @@ inline int isinfinity(double x) { return !_finite(x); }
|
|||||||
inline int isinfinity(long double x) {
|
inline int isinfinity(long double x) {
|
||||||
return !_finite(static_cast<double>(x));
|
return !_finite(static_cast<double>(x));
|
||||||
}
|
}
|
||||||
|
inline int isnotanumber(double x) { return _isnan(x); }
|
||||||
|
inline int isnotanumber(long double x) {
|
||||||
|
return _isnan(static_cast<double>(x));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <typename Char>
|
template <typename Char>
|
||||||
@ -2366,7 +2391,7 @@ void BasicWriter<Char>::write_double(
|
|||||||
sign = spec.flag(PLUS_FLAG) ? '+' : ' ';
|
sign = spec.flag(PLUS_FLAG) ? '+' : ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value != value) {
|
if (internal::isnotanumber(value)) {
|
||||||
// Format NaN ourselves because sprintf's output is not consistent
|
// Format NaN ourselves because sprintf's output is not consistent
|
||||||
// across platforms.
|
// across platforms.
|
||||||
std::size_t nan_size = 4;
|
std::size_t nan_size = 4;
|
||||||
@ -2434,7 +2459,7 @@ void BasicWriter<Char>::write_double(
|
|||||||
Char fill = internal::CharTraits<Char>::cast(spec.fill());
|
Char fill = internal::CharTraits<Char>::cast(spec.fill());
|
||||||
for (;;) {
|
for (;;) {
|
||||||
std::size_t buffer_size = buffer_.capacity() - offset;
|
std::size_t buffer_size = buffer_.capacity() - offset;
|
||||||
#if _MSC_VER
|
#ifdef _MSC_VER
|
||||||
// MSVC's vsnprintf_s doesn't work with zero size, so reserve
|
// MSVC's vsnprintf_s doesn't work with zero size, so reserve
|
||||||
// space for at least one extra character to make the size non-zero.
|
// space for at least one extra character to make the size non-zero.
|
||||||
// Note that the buffer's capacity will increase by more than 1.
|
// Note that the buffer's capacity will increase by more than 1.
|
||||||
|
4
posix.h
4
posix.h
@ -69,6 +69,10 @@
|
|||||||
# define FMT_UNUSED
|
# define FMT_UNUSED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef FMT_USE_STATIC_ASSERT
|
||||||
|
# define FMT_USE_STATIC_ASSERT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#if FMT_USE_STATIC_ASSERT || FMT_HAS_CPP_ATTRIBUTE(cxx_static_assert) || \
|
#if FMT_USE_STATIC_ASSERT || FMT_HAS_CPP_ATTRIBUTE(cxx_static_assert) || \
|
||||||
(FMT_GCC_VERSION >= 403 && FMT_HAS_GXX_CXX11) || _MSC_VER >= 1600
|
(FMT_GCC_VERSION >= 403 && FMT_HAS_GXX_CXX11) || _MSC_VER >= 1600
|
||||||
# define FMT_STATIC_ASSERT(cond, message) static_assert(cond, message)
|
# define FMT_STATIC_ASSERT(cond, message) static_assert(cond, message)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user