Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Mar 22, 2024
1 parent 45b772f commit 5af8865
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
26 changes: 10 additions & 16 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -761,28 +761,22 @@ using is_integer =
# define FMT_USE_LONG_DOUBLE 1
#endif

#ifndef FMT_USE_FLOAT128
# ifdef __clang__
// Clang emulates GCC, so it has to appear early.
# if FMT_HAS_INCLUDE(<quadmath.h>)
# define FMT_USE_FLOAT128 1
# endif
# elif defined(__GNUC__)
// GNU C++:
# if defined(_GLIBCXX_USE_FLOAT128) && !defined(__STRICT_ANSI__)
# define FMT_USE_FLOAT128 1
# endif
# endif
# ifndef FMT_USE_FLOAT128
# define FMT_USE_FLOAT128 0
# endif
#if defined(FMT_USE_FLOAT128)
// Use the provided definition.
#elif FMT_CLANG_VERSION && FMT_HAS_INCLUDE(<quadmath.h>)
# define FMT_USE_FLOAT128 1
#elif FMT_GCC_VERSION && defined(_GLIBCXX_USE_FLOAT128) && \
!defined(__STRICT_ANSI__)
# define FMT_USE_FLOAT128 1
#else
# define FMT_USE_FLOAT128 0
#endif

#if FMT_USE_FLOAT128
using float128 = __float128;
#else
using float128 = void;
#endif

template <typename T> using is_float128 = std::is_same<T, float128>;

template <typename T>
Expand Down
7 changes: 3 additions & 4 deletions test/format-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1793,15 +1793,14 @@ struct deadlockable {

FMT_BEGIN_NAMESPACE
template <> struct formatter<deadlockable> {
FMT_CONSTEXPR auto parse(fmt::format_parse_context& ctx)
-> decltype(ctx.begin()) {
FMT_CONSTEXPR auto parse(format_parse_context& ctx) -> decltype(ctx.begin()) {
return ctx.begin();
}

auto format(const deadlockable& d, fmt::format_context& ctx) const
auto format(const deadlockable& d, format_context& ctx) const
-> decltype(ctx.out()) {
std::lock_guard<std::mutex> lock(d.mutex);
return fmt::format_to(ctx.out(), "{}", d.value);
return format_to(ctx.out(), "{}", d.value);
}
};
FMT_END_NAMESPACE
Expand Down

0 comments on commit 5af8865

Please sign in to comment.