Skip to content

Commit

Permalink
update bundled libfmt to 11.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
odygrd committed Jan 26, 2025
1 parent 34c6268 commit 0b57a5f
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 18 deletions.
19 changes: 11 additions & 8 deletions include/quill/bundled/fmt/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#endif

// The fmt library version in the form major * 10000 + minor * 100 + patch.
#define FMTQUILL_VERSION 110102
#define FMTQUILL_VERSION 110103

// Detect compiler versions.
#if defined(__clang__) && !defined(__ibmxl__)
Expand Down Expand Up @@ -100,9 +100,9 @@
// Detect C++14 relaxed constexpr.
#ifdef FMTQUILL_USE_CONSTEXPR
// Use the provided definition.
#elif FMTQUILL_GCC_VERSION >= 600 && FMTQUILL_CPLUSPLUS >= 201402L
// GCC only allows throw in constexpr since version 6:
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67371.
#elif FMTQUILL_GCC_VERSION >= 702 && FMTQUILL_CPLUSPLUS >= 201402L
// GCC only allows constexpr member functions in non-literal types since 7.2:
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66297.
# define FMTQUILL_USE_CONSTEXPR 1
#elif FMTQUILL_ICC_VERSION
# define FMTQUILL_USE_CONSTEXPR 0 // https://github.com/fmtlib/fmt/issues/1628
Expand Down Expand Up @@ -303,7 +303,7 @@

// Enable minimal optimizations for more compact code in debug mode.
FMTQUILL_PRAGMA_GCC(push_options)
#if !defined(__OPTIMIZE__) && !defined(__CUDACC__)
#if !defined(__OPTIMIZE__) && !defined(__CUDACC__) && !defined(FMTQUILL_MODULE)
FMTQUILL_PRAGMA_GCC(optimize("Og"))
#endif
FMTQUILL_PRAGMA_CLANG(diagnostic push)
Expand Down Expand Up @@ -743,13 +743,15 @@ class basic_specs {
max_fill_size = 4
};

size_t data_ = 1 << fill_size_shift;
unsigned data_ = 1 << fill_size_shift;
static_assert(sizeof(data_) * CHAR_BIT >= 18, "");

// Character (code unit) type is erased to prevent template bloat.
char fill_data_[max_fill_size] = {' '};

FMTQUILL_CONSTEXPR void set_fill_size(size_t size) {
data_ = (data_ & ~fill_size_mask) | (size << fill_size_shift);
data_ = (data_ & ~fill_size_mask) |
(static_cast<unsigned>(size) << fill_size_shift);
}

public:
Expand Down Expand Up @@ -1123,7 +1125,7 @@ using use_formatter =
bool_constant<(std::is_class<T>::value || std::is_enum<T>::value ||
std::is_union<T>::value || std::is_array<T>::value) &&
!has_to_string_view<T>::value && !is_named_arg<T>::value &&
!use_format_as<T>::value && !use_format_as_member<T>::value>;
!use_format_as<T>::value && !use_format_as_member<U>::value>;

template <typename Char, typename T, typename U = remove_const_t<T>>
auto has_formatter_impl(T* p, buffered_context<Char>* ctx = nullptr)
Expand Down Expand Up @@ -2671,6 +2673,7 @@ class context {
FMTQUILL_CONSTEXPR auto arg_id(string_view name) const -> int {
return args_.get_id(name);
}
auto args() const -> const format_args& { return args_; }

// Returns an iterator to the beginning of the output range.
FMTQUILL_CONSTEXPR auto out() const -> iterator { return out_; }
Expand Down
12 changes: 6 additions & 6 deletions include/quill/bundled/fmt/chrono.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "format.h"

namespace fmt_detail {
namespace fmtquill_detail {
struct time_zone {
template <typename Duration, typename T>
auto to_sys(T)
Expand All @@ -35,7 +35,7 @@ template <typename... T> inline auto current_zone(T...) -> time_zone* {
}

template <typename... T> inline void _tzset(T...) {}
} // namespace fmt_detail
} // namespace fmtquill_detail

FMTQUILL_BEGIN_NAMESPACE

Expand Down Expand Up @@ -523,8 +523,8 @@ auto to_time_t(sys_time<Duration> time_point) -> std::time_t {
// providing current_zone(): https://github.com/fmtlib/fmt/issues/4160.
template <typename T> FMTQUILL_CONSTEXPR auto has_current_zone() -> bool {
using namespace std::chrono;
using namespace fmt_detail;
return !std::is_same<decltype(current_zone()), fmt_detail::time_zone*>::value;
using namespace fmtquill_detail;
return !std::is_same<decltype(current_zone()), fmtquill_detail::time_zone*>::value;
}
} // namespace detail

Expand Down Expand Up @@ -576,7 +576,7 @@ template <typename Duration,
FMTQUILL_ENABLE_IF(detail::has_current_zone<Duration>())>
inline auto localtime(std::chrono::local_time<Duration> time) -> std::tm {
using namespace std::chrono;
using namespace fmt_detail;
using namespace fmtquill_detail;
return localtime(detail::to_time_t(current_zone()->to_sys<Duration>(time)));
}
#endif
Expand Down Expand Up @@ -992,7 +992,7 @@ struct has_member_data_tm_zone<T, void_t<decltype(T::tm_zone)>>

inline void tzset_once() {
static bool init = []() {
using namespace fmt_detail;
using namespace fmtquill_detail;
_tzset();
return false;
}();
Expand Down
6 changes: 4 additions & 2 deletions include/quill/bundled/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ FMTQUILL_CONSTEXPR inline void abort_fuzzing_if(bool condition) {
#if defined(FMTQUILL_USE_STRING_VIEW)
template <typename Char> using std_string_view = std::basic_string_view<Char>;
#else
template <typename T> struct std_string_view {};
template <typename Char> struct std_string_view {
operator basic_string_view<Char>() const;
};
#endif

template <typename Char, Char... C> struct string_literal {
Expand Down Expand Up @@ -1210,7 +1212,7 @@ FMTQUILL_CONSTEXPR FMTQUILL_INLINE auto format_decimal(Char* out, UInt value,
}

template <typename Char, typename UInt, typename OutputIt,
FMTQUILL_ENABLE_IF(is_back_insert_iterator<OutputIt>::value)>
FMTQUILL_ENABLE_IF(!std::is_pointer<remove_cvref_t<OutputIt>>::value)>
FMTQUILL_CONSTEXPR auto format_decimal(OutputIt out, UInt value, int num_digits)
-> OutputIt {
if (auto ptr = to_pointer<Char>(out, to_unsigned(num_digits))) {
Expand Down
2 changes: 1 addition & 1 deletion include/quill/bundled/fmt/ostream.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ inline void vprint(std::ostream& os, string_view fmt, format_args args) {
FMTQUILL_EXPORT template <typename... T>
void print(std::ostream& os, format_string<T...> fmt, T&&... args) {
fmtquill::vargs<T...> vargs = {{args...}};
if (detail::use_utf8) return vprint(os, fmt.str, vargs);
if (detail::const_check(detail::use_utf8)) return vprint(os, fmt.str, vargs);
auto buffer = memory_buffer();
detail::vformat_to(buffer, fmt.str, vargs);
detail::write_buffer(os, buffer);
Expand Down
4 changes: 3 additions & 1 deletion include/quill/bundled/fmt/ranges.h
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,9 @@ struct formatter<
template <typename R, typename Char>
struct formatter<
R, Char,
enable_if_t<range_format_kind<R, Char>::value == range_format::map>> {
enable_if_t<conjunction<
bool_constant<range_format_kind<R, Char>::value == range_format::map>,
detail::is_formattable_delayed<R, Char>>::value>> {
private:
using map_type = detail::maybe_const_range<R>;
using element_type = detail::uncvref_type<map_type>;
Expand Down
4 changes: 4 additions & 0 deletions scripts/rename_libfmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ def rename(file_path, macro_replace, namespace_replace):
# Use regular expressions to find and replace macros and namespace
macro_pattern = r'\bFMT_'
namespace_pattern = r'namespace\s+fmt\b'
fmt_namespace_detail_pattern = r'namespace\s+fmt_detail\b'
fmt_detail_pattern = r'\bfmt_detail::'

updated_content = re.sub(macro_pattern, macro_replace + '_', content)
updated_content = re.sub(r'fmt::', f'{namespace_replace}::', updated_content)
updated_content = re.sub(namespace_pattern, f'namespace {namespace_replace}', updated_content)
updated_content = re.sub(fmt_namespace_detail_pattern, f'namespace {namespace_replace}_detail', updated_content)
updated_content = re.sub(fmt_detail_pattern, f'{namespace_replace}_detail::', updated_content)

# Write the updated content back to the source file
with open(file_path, 'w') as file:
Expand Down

0 comments on commit 0b57a5f

Please sign in to comment.