Skip to content

Commit 0760541

Browse files
committed
Update fmt -> 11.0.2, lz4 -> 1.10.0
1 parent 499c347 commit 0760541

File tree

8 files changed

+144
-66
lines changed

8 files changed

+144
-66
lines changed

3rdparty/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262

6363
## {fmt}
6464
- [![Upstream](https://img.shields.io/github/v/release/fmtlib/fmt?label=Upstream)](https://github.com/fmtlib/fmt)
65-
- Version: 11.0.1
65+
- Version: 11.0.2
6666
- License: MIT
6767

6868
## FreeType
@@ -133,7 +133,7 @@
133133

134134
## lz4
135135
- [![Upstream](https://img.shields.io/github/v/release/lz4/lz4?label=Upstream)](https://github.com/lz4/lz4)
136-
- Version: 1.9.4
136+
- Version: 1.10.0
137137
- License: BSD 2-Clause
138138

139139
## minimp3

3rdparty/fmt/ChangeLog.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
# 11.0.2 - 2024-07-20
2+
3+
- Fixed compatibility with non-POSIX systems
4+
(https://github.com/fmtlib/fmt/issues/4054,
5+
https://github.com/fmtlib/fmt/issues/4060).
6+
7+
- Fixed performance regressions when using `std::back_insert_iterator` with
8+
`fmt::format_to` (https://github.com/fmtlib/fmt/issues/4070).
9+
10+
- Fixed handling of `std::generator` and move-only iterators
11+
(https://github.com/fmtlib/fmt/issues/4053,
12+
https://github.com/fmtlib/fmt/pull/4057). Thanks @Arghnews.
13+
14+
- Made `formatter<std::string_view>::parse` work with types convertible to
15+
`std::string_view` (https://github.com/fmtlib/fmt/issues/4036,
16+
https://github.com/fmtlib/fmt/pull/4055). Thanks @Arghnews.
17+
18+
- Made `volatile void*` formattable
19+
(https://github.com/fmtlib/fmt/issues/4049,
20+
https://github.com/fmtlib/fmt/pull/4056). Thanks @Arghnews.
21+
22+
- Made `Glib::ustring` not be confused with `std::string`
23+
(https://github.com/fmtlib/fmt/issues/4052).
24+
25+
- Made `fmt::context` iterator compatible with STL algorithms that rely on
26+
iterator category (https://github.com/fmtlib/fmt/issues/4079).
27+
128
# 11.0.1 - 2024-07-05
229

330
- Fixed version number in the inline namespace
@@ -13,6 +40,9 @@
1340
(https://github.com/fmtlib/fmt/pull/4034,
1441
https://github.com/fmtlib/fmt/pull/4050). Thanks @tesch1 and @phprus.
1542

43+
- Fixed ADL issues in `fmt::printf` when using C++20
44+
(https://github.com/fmtlib/fmt/pull/4042). Thanks @toge.
45+
1646
- Removed a redundant check in the formatter for `std::expected`
1747
(https://github.com/fmtlib/fmt/pull/4040). Thanks @phprus.
1848

3rdparty/fmt/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,23 @@ Try {fmt} in [Compiler Explorer](https://godbolt.org/z/8Mx1EW73v).
2424

2525
# Features
2626

27-
- Simple [format API](https://fmt.dev/latest/api.html) with positional
27+
- Simple [format API](https://fmt.dev/latest/api/) with positional
2828
arguments for localization
2929
- Implementation of [C++20
3030
std::format](https://en.cppreference.com/w/cpp/utility/format) and
3131
[C++23 std::print](https://en.cppreference.com/w/cpp/io/print)
32-
- [Format string syntax](https://fmt.dev/latest/syntax.html) similar
32+
- [Format string syntax](https://fmt.dev/latest/syntax/) similar
3333
to Python\'s
3434
[format](https://docs.python.org/3/library/stdtypes.html#str.format)
3535
- Fast IEEE 754 floating-point formatter with correct rounding,
3636
shortness and round-trip guarantees using the
3737
[Dragonbox](https://github.com/jk-jeon/dragonbox) algorithm
3838
- Portable Unicode support
3939
- Safe [printf
40-
implementation](https://fmt.dev/latest/api.html#printf-formatting)
40+
implementation](https://fmt.dev/latest/api/#printf-formatting)
4141
including the POSIX extension for positional arguments
4242
- Extensibility: [support for user-defined
43-
types](https://fmt.dev/latest/api.html#formatting-user-defined-types)
43+
types](https://fmt.dev/latest/api/#formatting-user-defined-types)
4444
- High performance: faster than common standard library
4545
implementations of `(s)printf`, iostreams, `to_string` and
4646
`to_chars`, see [Speed tests](#speed-tests) and [Converting a
@@ -58,8 +58,8 @@ Try {fmt} in [Compiler Explorer](https://godbolt.org/z/8Mx1EW73v).
5858
buffer overflow errors
5959
- Ease of use: small self-contained code base, no external
6060
dependencies, permissive MIT
61-
[license](https://github.com/fmtlib/fmt/blob/master/LICENSE.rst)
62-
- [Portability](https://fmt.dev/latest/index.html#portability) with
61+
[license](https://github.com/fmtlib/fmt/blob/master/LICENSE)
62+
- [Portability](https://fmt.dev/latest/#portability) with
6363
consistent output across platforms and support for older compilers
6464
- Clean warning-free codebase even on high warning levels such as
6565
`-Wall -Wextra -pedantic`
@@ -243,7 +243,7 @@ header-only library so it doesn\'t provide any linkage options.
243243
## Running the tests
244244

245245
Please refer to [Building the
246-
library](https://fmt.dev/latest/usage.html#building-the-library) for
246+
library](https://fmt.dev/latest/get-started/#building-from-source) for
247247
instructions on how to build the library and run the unit tests.
248248

249249
Benchmarks reside in a separate repository,
@@ -297,7 +297,7 @@ converts to `std::print`.)
297297
underwater vehicle
298298
- [Drake](https://drake.mit.edu/): a planning, control, and analysis
299299
toolbox for nonlinear dynamical systems (MIT)
300-
- [Envoy](https://lyft.github.io/envoy/): C++ L7 proxy and
300+
- [Envoy](https://github.com/envoyproxy/envoy): C++ L7 proxy and
301301
communication bus (Lyft)
302302
- [FiveM](https://fivem.net/): a modification framework for GTA V
303303
- [fmtlog](https://github.com/MengRao/fmtlog): a performant
@@ -456,7 +456,7 @@ second](http://www.zverovich.net/2020/06/13/fast-int-to-string-revisited.html).
456456
457457
# Documentation License
458458
459-
The [Format String Syntax](https://fmt.dev/latest/syntax.html) section
459+
The [Format String Syntax](https://fmt.dev/latest/syntax/) section
460460
in the documentation is based on the one from Python [string module
461461
documentation](https://docs.python.org/3/library/string.html#module-string).
462462
For this reason, the documentation is distributed under the Python

3rdparty/fmt/include/fmt/base.h

Lines changed: 47 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#endif
2424

2525
// The fmt library version in the form major * 10000 + minor * 100 + patch.
26-
#define FMT_VERSION 110001
26+
#define FMT_VERSION 110002
2727

2828
// Detect compiler versions.
2929
#if defined(__clang__) && !defined(__ibmxl__)
@@ -441,7 +441,8 @@ struct is_std_string_like : std::false_type {};
441441
template <typename T>
442442
struct is_std_string_like<T, void_t<decltype(std::declval<T>().find_first_of(
443443
typename T::value_type(), 0))>>
444-
: std::true_type {};
444+
: std::is_convertible<decltype(std::declval<T>().data()),
445+
const typename T::value_type*> {};
445446

446447
// Returns true iff the literal encoding is UTF-8.
447448
constexpr auto is_utf8_enabled() -> bool {
@@ -466,21 +467,30 @@ template <typename Char> FMT_CONSTEXPR auto length(const Char* s) -> size_t {
466467
template <typename Char>
467468
FMT_CONSTEXPR auto compare(const Char* s1, const Char* s2, std::size_t n)
468469
-> int {
470+
if (!is_constant_evaluated() && sizeof(Char) == 1) return memcmp(s1, s2, n);
469471
for (; n != 0; ++s1, ++s2, --n) {
470472
if (*s1 < *s2) return -1;
471473
if (*s1 > *s2) return 1;
472474
}
473475
return 0;
474476
}
475477

478+
namespace adl {
479+
using namespace std;
480+
481+
template <typename Container>
482+
auto invoke_back_inserter()
483+
-> decltype(back_inserter(std::declval<Container&>()));
484+
} // namespace adl
485+
476486
template <typename It, typename Enable = std::true_type>
477487
struct is_back_insert_iterator : std::false_type {};
488+
478489
template <typename It>
479490
struct is_back_insert_iterator<
480-
It,
481-
bool_constant<std::is_same<
482-
decltype(back_inserter(std::declval<typename It::container_type&>())),
483-
It>::value>> : std::true_type {};
491+
It, bool_constant<std::is_same<
492+
decltype(adl::invoke_back_inserter<typename It::container_type>()),
493+
It>::value>> : std::true_type {};
484494

485495
// Extracts a reference to the container from *insert_iterator.
486496
template <typename OutputIt>
@@ -611,11 +621,12 @@ namespace detail {
611621
// to it, deducing Char. Explicitly convertible types such as the ones returned
612622
// from FMT_STRING are intentionally excluded.
613623
template <typename Char, FMT_ENABLE_IF(is_char<Char>::value)>
614-
auto to_string_view(const Char* s) -> basic_string_view<Char> {
624+
constexpr auto to_string_view(const Char* s) -> basic_string_view<Char> {
615625
return s;
616626
}
617627
template <typename T, FMT_ENABLE_IF(is_std_string_like<T>::value)>
618-
auto to_string_view(const T& s) -> basic_string_view<typename T::value_type> {
628+
constexpr auto to_string_view(const T& s)
629+
-> basic_string_view<typename T::value_type> {
619630
return s;
620631
}
621632
template <typename Char>
@@ -919,12 +930,9 @@ template <typename T> class buffer {
919930
try_reserve(size_ + count);
920931
auto free_cap = capacity_ - size_;
921932
if (free_cap < count) count = free_cap;
922-
if (std::is_same<T, U>::value) {
923-
memcpy(ptr_ + size_, begin, count * sizeof(T));
924-
} else {
925-
T* out = ptr_ + size_;
926-
for (size_t i = 0; i < count; ++i) out[i] = begin[i];
927-
}
933+
// A loop is faster than memcpy on small sizes.
934+
T* out = ptr_ + size_;
935+
for (size_t i = 0; i < count; ++i) out[i] = begin[i];
928936
size_ += count;
929937
begin += count;
930938
}
@@ -1157,6 +1165,7 @@ template <typename T> class basic_appender {
11571165
using difference_type = ptrdiff_t;
11581166
using pointer = T*;
11591167
using reference = T&;
1168+
using container_type = detail::buffer<T>;
11601169
FMT_UNCHECKED_ITERATOR(basic_appender);
11611170

11621171
FMT_CONSTEXPR basic_appender(detail::buffer<T>& buf) : buffer_(&buf) {}
@@ -1173,6 +1182,8 @@ template <typename T> class basic_appender {
11731182
using appender = basic_appender<char>;
11741183

11751184
namespace detail {
1185+
template <typename T>
1186+
struct is_back_insert_iterator<basic_appender<T>> : std::true_type {};
11761187

11771188
template <typename T, typename Enable = void>
11781189
struct locking : std::true_type {};
@@ -1189,12 +1200,6 @@ FMT_CONSTEXPR inline auto is_locking() -> bool {
11891200
}
11901201

11911202
// An optimized version of std::copy with the output value type (T).
1192-
template <typename T, typename InputIt>
1193-
auto copy(InputIt begin, InputIt end, appender out) -> appender {
1194-
get_container(out).append(begin, end);
1195-
return out;
1196-
}
1197-
11981203
template <typename T, typename InputIt, typename OutputIt,
11991204
FMT_ENABLE_IF(is_back_insert_iterator<OutputIt>::value)>
12001205
auto copy(InputIt begin, InputIt end, OutputIt out) -> OutputIt {
@@ -1209,14 +1214,6 @@ FMT_CONSTEXPR auto copy(InputIt begin, InputIt end, OutputIt out) -> OutputIt {
12091214
return out;
12101215
}
12111216

1212-
template <typename T>
1213-
FMT_CONSTEXPR auto copy(const T* begin, const T* end, T* out) -> T* {
1214-
if (is_constant_evaluated()) return copy<T, const T*, T*>(begin, end, out);
1215-
auto size = to_unsigned(end - begin);
1216-
if (size > 0) memcpy(out, begin, size * sizeof(T));
1217-
return out + size;
1218-
}
1219-
12201217
template <typename T, typename V, typename OutputIt>
12211218
FMT_CONSTEXPR auto copy(basic_string_view<V> s, OutputIt out) -> OutputIt {
12221219
return copy<T>(s.begin(), s.end(), out);
@@ -1238,12 +1235,25 @@ constexpr auto has_const_formatter() -> bool {
12381235
return has_const_formatter_impl<Context>(static_cast<T*>(nullptr));
12391236
}
12401237

1238+
template <typename It, typename Enable = std::true_type>
1239+
struct is_buffer_appender : std::false_type {};
1240+
template <typename It>
1241+
struct is_buffer_appender<
1242+
It, bool_constant<
1243+
is_back_insert_iterator<It>::value &&
1244+
std::is_base_of<buffer<typename It::container_type::value_type>,
1245+
typename It::container_type>::value>>
1246+
: std::true_type {};
1247+
12411248
// Maps an output iterator to a buffer.
1242-
template <typename T, typename OutputIt>
1249+
template <typename T, typename OutputIt,
1250+
FMT_ENABLE_IF(!is_buffer_appender<OutputIt>::value)>
12431251
auto get_buffer(OutputIt out) -> iterator_buffer<OutputIt, T> {
12441252
return iterator_buffer<OutputIt, T>(out);
12451253
}
1246-
template <typename T> auto get_buffer(basic_appender<T> out) -> buffer<T>& {
1254+
template <typename T, typename OutputIt,
1255+
FMT_ENABLE_IF(is_buffer_appender<OutputIt>::value)>
1256+
auto get_buffer(OutputIt out) -> buffer<T>& {
12471257
return get_container(out);
12481258
}
12491259

@@ -1475,6 +1485,12 @@ template <typename Context> struct arg_mapper {
14751485

14761486
FMT_MAP_API auto map(void* val) -> const void* { return val; }
14771487
FMT_MAP_API auto map(const void* val) -> const void* { return val; }
1488+
FMT_MAP_API auto map(volatile void* val) -> const void* {
1489+
return const_cast<const void*>(val);
1490+
}
1491+
FMT_MAP_API auto map(const volatile void* val) -> const void* {
1492+
return const_cast<const void*>(val);
1493+
}
14781494
FMT_MAP_API auto map(std::nullptr_t val) -> const void* { return val; }
14791495

14801496
// Use SFINAE instead of a const T* parameter to avoid a conflict with the
@@ -1760,7 +1776,7 @@ template <typename Context> class basic_format_arg {
17601776
* `vis(value)` will be called with the value of type `double`.
17611777
*/
17621778
template <typename Visitor>
1763-
FMT_CONSTEXPR auto visit(Visitor&& vis) const -> decltype(vis(0)) {
1779+
FMT_CONSTEXPR FMT_INLINE auto visit(Visitor&& vis) const -> decltype(vis(0)) {
17641780
switch (type_) {
17651781
case detail::type::none_type:
17661782
break;

3rdparty/fmt/include/fmt/format-inl.h

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,12 +1443,26 @@ template <typename T> struct span {
14431443
size_t size;
14441444
};
14451445

1446-
#ifdef _WIN32
1447-
inline void flockfile(FILE* f) { _lock_file(f); }
1448-
inline void funlockfile(FILE* f) { _unlock_file(f); }
1449-
inline int getc_unlocked(FILE* f) { return _fgetc_nolock(f); }
1446+
template <typename F> auto flockfile(F* f) -> decltype(_lock_file(f)) {
1447+
_lock_file(f);
1448+
}
1449+
template <typename F> auto funlockfile(F* f) -> decltype(_unlock_file(f)) {
1450+
_unlock_file(f);
1451+
}
1452+
1453+
#ifndef getc_unlocked
1454+
template <typename F> auto getc_unlocked(F* f) -> decltype(_fgetc_nolock(f)) {
1455+
return _fgetc_nolock(f);
1456+
}
14501457
#endif
14511458

1459+
template <typename F = FILE, typename Enable = void>
1460+
struct has_flockfile : std::false_type {};
1461+
1462+
template <typename F>
1463+
struct has_flockfile<F, void_t<decltype(flockfile(&std::declval<F&>()))>>
1464+
: std::true_type {};
1465+
14521466
// A FILE wrapper. F is FILE defined as a template parameter to make system API
14531467
// detection work.
14541468
template <typename F> class file_base {
@@ -1619,7 +1633,15 @@ inline auto get_file(FILE* f, ...) -> fallback_file<FILE> { return f; }
16191633

16201634
using file_ref = decltype(get_file(static_cast<FILE*>(nullptr), 0));
16211635

1636+
template <typename F = FILE, typename Enable = void>
16221637
class file_print_buffer : public buffer<char> {
1638+
public:
1639+
explicit file_print_buffer(F*) : buffer(nullptr, size_t()) {}
1640+
};
1641+
1642+
template <typename F>
1643+
class file_print_buffer<F, enable_if_t<has_flockfile<F>::value>>
1644+
: public buffer<char> {
16231645
private:
16241646
file_ref file_;
16251647

@@ -1634,7 +1656,7 @@ class file_print_buffer : public buffer<char> {
16341656
}
16351657

16361658
public:
1637-
explicit file_print_buffer(FILE* f) : buffer(grow, size_t()), file_(f) {
1659+
explicit file_print_buffer(F* f) : buffer(grow, size_t()), file_(f) {
16381660
flockfile(f);
16391661
file_.init_buffer();
16401662
auto buf = file_.get_write_buffer();
@@ -1643,7 +1665,8 @@ class file_print_buffer : public buffer<char> {
16431665
~file_print_buffer() {
16441666
file_.advance_write_buffer(size());
16451667
bool flush = file_.needs_flush();
1646-
funlockfile(file_);
1668+
F* f = file_; // Make funlockfile depend on the template parameter F
1669+
funlockfile(f); // for the system API detection to work.
16471670
if (flush) fflush(file_);
16481671
}
16491672
};
@@ -1692,8 +1715,9 @@ FMT_FUNC void vprint_buffered(std::FILE* f, string_view fmt, format_args args) {
16921715
}
16931716

16941717
FMT_FUNC void vprint(std::FILE* f, string_view fmt, format_args args) {
1695-
if (!detail::file_ref(f).is_buffered()) return vprint_buffered(f, fmt, args);
1696-
auto&& buffer = detail::file_print_buffer(f);
1718+
if (!detail::file_ref(f).is_buffered() || !detail::has_flockfile<>())
1719+
return vprint_buffered(f, fmt, args);
1720+
auto&& buffer = detail::file_print_buffer<>(f);
16971721
return detail::vformat_to(buffer, fmt, args);
16981722
}
16991723

0 commit comments

Comments
 (0)