Skip to content

Commit ff80f3d

Browse files
chore: fmtlib 11.1.3 (#1350)
1 parent 05c7579 commit ff80f3d

File tree

12 files changed

+181
-72
lines changed

12 files changed

+181
-72
lines changed

.github/workflows/mamba.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- uses: actions/checkout@v4
1313

1414
- name: install micromamba
15-
uses: mamba-org/setup-micromamba@v1
15+
uses: mamba-org/setup-micromamba@v2
1616
with:
1717
environment-file: environment-linux-dev.yml
1818
environment-name: nelson
@@ -68,7 +68,7 @@ jobs:
6868
- uses: actions/checkout@v4
6969

7070
- name: install micromamba
71-
uses: mamba-org/setup-micromamba@v1
71+
uses: mamba-org/setup-micromamba@v2
7272
with:
7373
environment-file: environment-macos-dev.yml
7474
environment-name: nelson

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## 1.13.0 (UNRELEASED)
9+
10+
### Changed
11+
12+
- fmtlib 11.1.3
13+
814
## 1.12.0 (2025-02-16)
915

1016
### Added

environment-linux-dev.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
name: nelson
22
channels:
33
- conda-forge
4+
- defaults
5+
channel_priority: strict
46
dependencies:
57
# Build dependencies
68
- cmake
79
- cxx-compiler
10+
- gcc=13.3.0=h9576a4e_1 # recent version of gcc is buggy
11+
- gcc_impl_linux-64=13.3.0=hfea6d02_1
12+
- gcc_linux-64=13.3.0=hc28eda2_7
813
# Host dependencies
914
- mesalib
1015
- qt-main

modules/commons/src/fmt/ChangeLog.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,70 @@
1+
# 11.1.3 - 2025-01-25
2+
3+
- Fixed compilation on GCC 9.4 (https://github.com/fmtlib/fmt/issues/4313).
4+
5+
- Worked around an internal compiler error when using C++20 modules with GCC
6+
14.2 and earlier (https://github.com/fmtlib/fmt/issues/4295).
7+
8+
- Worked around a bug in GCC 6 (https://github.com/fmtlib/fmt/issues/4318).
9+
10+
- Fixed an issue caused by instantiating `formatter<const T>`
11+
(https://github.com/fmtlib/fmt/issues/4303,
12+
https://github.com/fmtlib/fmt/pull/4325). Thanks @timsong-cpp.
13+
14+
- Fixed formatting into `std::ostreambuf_iterator` when using format string
15+
compilation (https://github.com/fmtlib/fmt/issues/4309,
16+
https://github.com/fmtlib/fmt/pull/4312). Thanks @phprus.
17+
18+
- Restored a constraint on the map formatter so that it correctly reports as
19+
unformattable when the element is (https://github.com/fmtlib/fmt/pull/4326).
20+
Thanks @timsong-cpp.
21+
22+
- Reduced the size of format specs (https://github.com/fmtlib/fmt/issues/4298).
23+
24+
- Readded `args()` to `fmt::format_context`
25+
(https://github.com/fmtlib/fmt/issues/4307,
26+
https://github.com/fmtlib/fmt/pull/4310). Thanks @Erroneous1.
27+
28+
- Fixed a bogus MSVC warning (https://github.com/fmtlib/fmt/issues/4314,
29+
https://github.com/fmtlib/fmt/pull/4322). Thanks @ZehMatt.
30+
31+
- Fixed a pedantic mode error in the CMake config
32+
(https://github.com/fmtlib/fmt/pull/4327). Thanks @rlalik.
33+
34+
# 11.1.2 - 2025-01-12
35+
36+
- Fixed ABI compatibility with earlier 11.x versions
37+
(https://github.com/fmtlib/fmt/issues/4292).
38+
39+
- Added `wchar_t` support to the `std::bitset` formatter
40+
(https://github.com/fmtlib/fmt/issues/4285,
41+
https://github.com/fmtlib/fmt/pull/4286,
42+
https://github.com/fmtlib/fmt/issues/4289,
43+
https://github.com/fmtlib/fmt/pull/4290). Thanks @phprus.
44+
45+
- Prefixed CMake components with `fmt-` to simplify usage of {fmt} via
46+
`add_subdirectory` (https://github.com/fmtlib/fmt/issues/4283).
47+
48+
- Updated docs for meson (https://github.com/fmtlib/fmt/pull/4291).
49+
Thanks @trim21.
50+
51+
- Fixed a compilation error in chrono on nvcc
52+
(https://github.com/fmtlib/fmt/issues/4297,
53+
https://github.com/fmtlib/fmt/pull/4301). Thanks @breyerml.
54+
55+
- Fixed various warnings
56+
(https://github.com/fmtlib/fmt/pull/4288,
57+
https://github.com/fmtlib/fmt/pull/4299). Thanks @GamesTrap and @edo9300.
58+
59+
# 11.1.1 - 2024-12-27
60+
61+
- Fixed ABI compatibility with earlier 11.x versions
62+
(https://github.com/fmtlib/fmt/issues/4278).
63+
64+
- Defined CMake components (`core` and `doc`) to allow docs to be installed
65+
separately (https://github.com/fmtlib/fmt/pull/4276).
66+
Thanks @carlsmedstad.
67+
168
# 11.1.0 - 2024-12-25
269

370
- Improved C++20 module support

modules/commons/src/fmt/include/fmt/base.h

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#endif
2222

2323
// The fmt library version in the form major * 10000 + minor * 100 + patch.
24-
#define FMT_VERSION 110100
24+
#define FMT_VERSION 110103
2525

2626
// Detect compiler versions.
2727
#if defined(__clang__) && !defined(__ibmxl__)
@@ -96,9 +96,9 @@
9696
// Detect C++14 relaxed constexpr.
9797
#ifdef FMT_USE_CONSTEXPR
9898
// Use the provided definition.
99-
#elif FMT_GCC_VERSION >= 600 && FMT_CPLUSPLUS >= 201402L
100-
// GCC only allows throw in constexpr since version 6:
101-
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67371.
99+
#elif FMT_GCC_VERSION >= 702 && FMT_CPLUSPLUS >= 201402L
100+
// GCC only allows constexpr member functions in non-literal types since 7.2:
101+
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66297.
102102
# define FMT_USE_CONSTEXPR 1
103103
#elif FMT_ICC_VERSION
104104
# define FMT_USE_CONSTEXPR 0 // https://github.com/fmtlib/fmt/issues/1628
@@ -161,6 +161,20 @@
161161
# define FMT_CATCH(x) if (false)
162162
#endif
163163

164+
#ifdef FMT_NO_UNIQUE_ADDRESS
165+
// Use the provided definition.
166+
#elif FMT_CPLUSPLUS < 202002L
167+
// Not supported.
168+
#elif FMT_HAS_CPP_ATTRIBUTE(no_unique_address)
169+
# define FMT_NO_UNIQUE_ADDRESS [[no_unique_address]]
170+
// VS2019 v16.10 and later except clang-cl (https://reviews.llvm.org/D110485).
171+
#elif FMT_MSC_VERSION >= 1929 && !FMT_CLANG_VERSION
172+
# define FMT_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
173+
#endif
174+
#ifndef FMT_NO_UNIQUE_ADDRESS
175+
# define FMT_NO_UNIQUE_ADDRESS
176+
#endif
177+
164178
#if FMT_HAS_CPP17_ATTRIBUTE(fallthrough)
165179
# define FMT_FALLTHROUGH [[fallthrough]]
166180
#elif defined(__clang__)
@@ -285,7 +299,7 @@
285299

286300
// Enable minimal optimizations for more compact code in debug mode.
287301
FMT_PRAGMA_GCC(push_options)
288-
#if !defined(__OPTIMIZE__) && !defined(__CUDACC__)
302+
#if !defined(__OPTIMIZE__) && !defined(__CUDACC__) && !defined(FMT_MODULE)
289303
FMT_PRAGMA_GCC(optimize("Og"))
290304
#endif
291305
FMT_PRAGMA_CLANG(diagnostic push)
@@ -725,13 +739,15 @@ class basic_specs {
725739
max_fill_size = 4
726740
};
727741

728-
size_t data_ = 1 << fill_size_shift;
742+
unsigned data_ = 1 << fill_size_shift;
743+
static_assert(sizeof(data_) * CHAR_BIT >= 18, "");
729744

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

733748
FMT_CONSTEXPR void set_fill_size(size_t size) {
734-
data_ = (data_ & ~fill_size_mask) | (size << fill_size_shift);
749+
data_ = (data_ & ~fill_size_mask) |
750+
(static_cast<unsigned>(size) << fill_size_shift);
735751
}
736752

737753
public:
@@ -828,6 +844,12 @@ class basic_specs {
828844
for (size_t i = 0; i < size; ++i)
829845
fill_data_[i & 3] = static_cast<char>(s[i]);
830846
}
847+
848+
FMT_CONSTEXPR void copy_fill_from(const basic_specs& specs) {
849+
set_fill_size(specs.fill_size());
850+
for (size_t i = 0; i < max_fill_size; ++i)
851+
fill_data_[i] = specs.fill_data_[i];
852+
}
831853
};
832854

833855
// Format specifiers for built-in and string types.
@@ -1099,7 +1121,7 @@ using use_formatter =
10991121
bool_constant<(std::is_class<T>::value || std::is_enum<T>::value ||
11001122
std::is_union<T>::value || std::is_array<T>::value) &&
11011123
!has_to_string_view<T>::value && !is_named_arg<T>::value &&
1102-
!use_format_as<T>::value && !use_format_as_member<T>::value>;
1124+
!use_format_as<T>::value && !use_format_as_member<U>::value>;
11031125

11041126
template <typename Char, typename T, typename U = remove_const_t<T>>
11051127
auto has_formatter_impl(T* p, buffered_context<Char>* ctx = nullptr)
@@ -2256,9 +2278,7 @@ struct locale_ref {
22562278

22572279
public:
22582280
constexpr locale_ref() : locale_(nullptr) {}
2259-
2260-
template <typename Locale, FMT_ENABLE_IF(sizeof(Locale::collate) != 0)>
2261-
locale_ref(const Locale& loc);
2281+
template <typename Locale> locale_ref(const Locale& loc);
22622282

22632283
inline explicit operator bool() const noexcept { return locale_ != nullptr; }
22642284
#endif // FMT_USE_LOCALE
@@ -2604,10 +2624,11 @@ template <typename Context> class basic_format_args {
26042624
};
26052625

26062626
// A formatting context.
2607-
class context : private detail::locale_ref {
2627+
class context {
26082628
private:
26092629
appender out_;
26102630
format_args args_;
2631+
FMT_NO_UNIQUE_ADDRESS detail::locale_ref loc_;
26112632

26122633
public:
26132634
/// The character type for the output.
@@ -2623,7 +2644,7 @@ class context : private detail::locale_ref {
26232644
/// in the object so make sure they have appropriate lifetimes.
26242645
FMT_CONSTEXPR context(iterator out, format_args args,
26252646
detail::locale_ref loc = {})
2626-
: locale_ref(loc), out_(out), args_(args) {}
2647+
: out_(out), args_(args), loc_(loc) {}
26272648
context(context&&) = default;
26282649
context(const context&) = delete;
26292650
void operator=(const context&) = delete;
@@ -2635,14 +2656,15 @@ class context : private detail::locale_ref {
26352656
FMT_CONSTEXPR auto arg_id(string_view name) const -> int {
26362657
return args_.get_id(name);
26372658
}
2659+
auto args() const -> const format_args& { return args_; }
26382660

26392661
// Returns an iterator to the beginning of the output range.
26402662
FMT_CONSTEXPR auto out() const -> iterator { return out_; }
26412663

26422664
// Advances the begin iterator to `it`.
26432665
FMT_CONSTEXPR void advance_to(iterator) {}
26442666

2645-
FMT_CONSTEXPR auto locale() const -> detail::locale_ref { return *this; }
2667+
FMT_CONSTEXPR auto locale() const -> detail::locale_ref { return loc_; }
26462668
};
26472669

26482670
template <typename Char = char> struct runtime_format_string {
@@ -2659,7 +2681,8 @@ template <typename Char = char> struct runtime_format_string {
26592681
*/
26602682
inline auto runtime(string_view s) -> runtime_format_string<> { return {{s}}; }
26612683

2662-
/// A compile-time format string.
2684+
/// A compile-time format string. Use `format_string` in the public API to
2685+
/// prevent type deduction.
26632686
template <typename... T> struct fstring {
26642687
private:
26652688
static constexpr int num_static_named_args =

modules/commons/src/fmt/include/fmt/chrono.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ namespace detail {
261261
using utc_clock = std::chrono::utc_clock;
262262
#else
263263
struct utc_clock {
264-
void to_sys();
264+
template <typename T> void to_sys(T);
265265
};
266266
#endif
267267

@@ -364,7 +364,7 @@ void write_codecvt(codecvt_result<CodeUnit>& out, string_view in,
364364
template <typename OutputIt>
365365
auto write_encoded_tm_str(OutputIt out, string_view in, const std::locale& loc)
366366
-> OutputIt {
367-
if (detail::use_utf8 && loc != get_classic_locale()) {
367+
if (const_check(detail::use_utf8) && loc != get_classic_locale()) {
368368
// char16_t and char32_t codecvts are broken in MSVC (linkage errors) and
369369
// gcc-4.
370370
#if FMT_MSC_VERSION != 0 || \

modules/commons/src/fmt/include/fmt/format-inl.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ using std::locale;
8484
using std::numpunct;
8585
using std::use_facet;
8686

87-
template <typename Locale, enable_if_t<(sizeof(Locale::collate) != 0), int>>
87+
template <typename Locale>
8888
locale_ref::locale_ref(const Locale& loc) : locale_(&loc) {
8989
static_assert(std::is_same<Locale, locale>::value, "");
9090
}
@@ -134,7 +134,9 @@ FMT_FUNC auto write_loc(appender out, loc_value value,
134134

135135
FMT_FUNC void report_error(const char* message) {
136136
#if FMT_USE_EXCEPTIONS
137-
throw format_error(message);
137+
// Use FMT_THROW instead of throw to avoid bogus unreachable code warnings
138+
// from MSVC.
139+
FMT_THROW(format_error(message));
138140
#else
139141
fputs(message, stderr);
140142
abort();

0 commit comments

Comments
 (0)