This commit is contained in:
Victor Zverovich 2024-09-10 20:23:04 -07:00
parent ff82d8d2b5
commit 61a241f03f
2 changed files with 3 additions and 14 deletions

View File

@ -276,15 +276,11 @@
# define FMT_OPTIMIZE_SIZE 0
#endif
// Specifies whether to handle built-in and string types specially.
// FMT_BUILTIN_TYPE=0 may result in smaller library size at the cost of higher
// per-call binary size.
// per-call binary size by passing built-in types through the extension API.
#ifndef FMT_BUILTIN_TYPES
# define FMT_BUILTIN_TYPES 1
#endif
#if !FMT_BUILTIN_TYPES && !defined(__cpp_if_constexpr)
# error FMT_BUILTIN_TYPES=0 requires constexpr if support
#endif
#define FMT_APPLY_VARIADIC(expr) \
using ignore = int[]; \
@ -2195,7 +2191,7 @@ template <typename Context> class value {
}
FMT_CONSTEXPR FMT_INLINE value(const char_type* x FMT_BUILTIN) {
string.data = x;
if (is_constant_evaluated()) string.size = {};
if (is_constant_evaluated()) string.size = 0;
}
FMT_CONSTEXPR FMT_INLINE value(basic_string_view<char_type> x FMT_BUILTIN) {
string.data = x.data();
@ -2238,11 +2234,6 @@ template <typename Context> class value {
#if defined(__cpp_if_constexpr)
if constexpr (!formattable) type_is_unformattable_for<T, char_type> _;
if constexpr (std::is_same<T, int>::value) {
int_value = x; // int is always handled as a built-in type.
return;
}
// T may overload operator& e.g. std::vector<bool>::reference in libc++.
if constexpr (std::is_same<decltype(&x), remove_reference_t<T>*>::value)
custom.value = const_cast<value_type*>(&x);

View File

@ -1028,9 +1028,7 @@ FMT_API void print(std::FILE*, string_view);
FMT_BEGIN_EXPORT
// Suppress a misleading warning in older versions of clang.
#if FMT_CLANG_VERSION
# pragma clang diagnostic ignored "-Wweak-vtables"
#endif
FMT_CLANG_PRAGMA(diagnostic ignored "-Wweak-vtables")
/// An error reported from a formatting function.
class FMT_SO_VISIBILITY("default") format_error : public std::runtime_error {