Commit Graph

3457 Commits

Author SHA1 Message Date
Victor Zverovich 9d13c41ce6 Format null std::exception_ptr as "none"
Change the null exception_ptr representation from "nullptr" to "none" to
convey the "no exception" state more clearly, and update the test.
2026-07-11 08:21:32 -07:00
Jan 6dac6cad05 feat: add formatter for std::exception_ptr (#4808) (#4819) 2026-07-05 09:22:18 -07:00
Victor Zverovich cd67635a19 Suppress MSVC C4702 header-wide instead of restructuring code
Revert the explicit-else workaround from #4822 and instead disable the
"unreachable code" warning for all of base.h. Add an FMT_PRAGMA_MSVC
helper (mirroring FMT_PRAGMA_GCC/CLANG) and wrap the header in a single
warning(push)/disable:4702/pop pair, keeping the original control flow.
2026-07-04 10:01:11 -07:00
torsten48 b54093c658 avoid MSC warning C4702: unreachable code (#4822)
if FMT_CONSTEXPR is resolved to constexpr MSC warns about dead code
after 'return' instruction. Explicitly using 'else' in these cases
avoids the warning.
2026-07-03 10:39:09 -07:00
Victor Zverovich d24fef27d1 Minor cleanup 2026-06-26 15:57:41 -07:00
Jan Engelhardt 719823cc64 Turn libfmt-c into a shared library (#4812)
Linux distros don't like having static archives. Set fmt-c to shared
just like the main fmt library.
2026-06-26 06:55:44 -07:00
Yat Ho 0e601c34de fix: explicitly check operator[] in is_contiguous (#4825)
Prevent false positives when the container itself does not have `operator[](size_t)`, but the target type of one of the non-explicit user-defined conversion functions does.
2026-06-25 12:21:59 -07:00
Vinay Kumar 588b3a0f8f Fix fallback uint128 bitwise not (#4813) 2026-06-17 23:52:12 -07:00
Victor Zverovich 979c94dff8 Fix hang/assertion when printing to a pipe with closed read end (#4797) 2026-06-18 08:08:44 +02:00
aizu-m de4c6c502e fix out-of-range float to int conversion in to_nonnegative_int (#4802) 2026-06-16 23:14:58 -07:00
aizu-m 128ba144ab fix out-of-bounds read in basic_format_args::get (#4800) 2026-06-09 22:18:35 -07:00
Ferdi265 ffd8397db1 Add fmt_print to C API (#4789)
* Add FMT_FORMAT_ARGS(fmt, ...) macro to C API to simplify user-defined format wrappers

* Add fmt_print to C API
2026-06-05 06:40:30 -07:00
Victor Zverovich 70f794e395 Bump version 2026-06-02 15:16:15 -07:00
Jiami Lin a90ad5d6fd Fix formatting std::tm with null tm_zone (#4790) 2026-06-01 18:16:49 -07:00
Victor Zverovich 46cf422f54 Unify copyright notices 2026-05-31 08:54:06 -07:00
Victor Zverovich a823ba0699 Deconstexprify exception formatter 2026-05-31 08:24:38 -07:00
j4niwzis 029d543768 Fix compile time format for ranges, style, and std (#4759) 2026-05-31 08:21:35 -07:00
ahoarau 0acf106c52 Add println functions for formatted output with color support (#4782) 2026-05-25 08:30:36 -07:00
Victor Zverovich 93e26fa578 Cleanup is_contiguous 2026-05-22 08:04:50 -07:00
Vladislav Shchapov a30cf7d1ad Provide reasonable default definition for is_contiguous (#4770)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2026-05-21 07:19:19 -07:00
theflashwin 2f18a88e68 fix GCC PCH Breakage Triggered by fmt Scoped #pragma GCC optimize(0g) 2026-05-11 07:20:40 -07:00
Vladislav Shchapov 9cb8c0f92b Fix ambiguous formatter<std::optional<T>> between fmt/std.h and fmt/ranges.h on C++26 (P3168R2) (#4761)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2026-05-03 07:37:46 -07:00
Victor Zverovich 5a9a184448 Apply clang-format 2026-05-03 07:33:53 -07:00
Kağan Can Şit d0e3d20af8 chore(IWYU):Remove redundant includes (#4758) 2026-04-29 20:50:56 -07:00
Victor Zverovich 432fda7bfa Fix false positive in tsan (fixes #4755) 2026-04-29 17:16:36 -07:00
user202729 eeff8680ed Avoid dropping null byte in format string (#4732)
* Avoid dropping null byte in format string

* Add a test for null byte in format string
2026-04-23 09:34:27 -07:00
Victor Zverovich 27d0c03c4d Minor cleanup 2026-04-12 09:50:12 -07:00
Cazadorro 03cfb8645e Workaround a CUDA issue in handing UTF-32 literals (#4719) 2026-04-10 16:28:52 -07:00
Raúl Marín 4ccf1d4faf Fix out-of-bounds read in vprintf with trailing '%' (#4742) 2026-04-10 12:23:57 -07:00
Mike Vastola be98ea8add Fix bug re: return type of f(un)lockfile wrappers for Windows (#4739)
Just a tiny bugfix I spotted: The `f(un)lockfile` wrappers in
`format-inl.h` that wrap Windows's `_(un)lock_file` methods are
defined with a trailing return type derived by using decltype on a
hypothetical call to the underlying functions.

The wrappers don't contain a `return` in their bodies, however, so if
the return type of the underlying functions were to ever change from
`void`, there would be a compile error. This just adds `return` to each.
2026-04-10 08:01:13 -07:00
Victor Zverovich d2a159fbe7 Apply clang-format 2026-04-03 17:35:28 -07:00
Victor Zverovich 602df7dab8 Simplify copy 2026-03-28 09:33:45 -07:00
user202729 7b2c4d064b Speed up iterator_buffer (#4679) 2026-03-25 07:38:47 -07:00
Victor Zverovich dc05bee307 Don't assume nul termination in printf
Thanks ZUENS2020 for reporting.
2026-03-23 13:28:26 -07:00
sunmy2019 ea85b81ccd Support fmt::runtime with wchar_t in fmt::format_to_n (#4715) 2026-03-21 17:10:17 -07:00
Victor Chernyakin ae6fd83e2e Make fmt/fmt-c.h compile with Clang on Windows (#4712) 2026-03-13 17:51:48 -07:00
Aaron Gokaslan c0cd0fcfec Add missing moves to grouping std::string member (#4704) 2026-03-11 09:52:40 -07:00
Victor Zverovich c29b64dde7 Cleanup the C API 2026-03-08 14:33:23 -07:00
Ferdi265 eb03303099 Replace the dummy arg from compound initializers in the C API with more macro magic (#4696)
The dummy argument {fmt_int} was there as a workaround for MSVC and to
avoid needing to rely on another GCC extension for zero-size arrays. Use
macro magic similar to FMT_NARG() instead that replaces the problematic
zero-size array with NULL.

In order to avoid a quadratic number of expansions, defer creating the
mapped argument list until after selection of whether to use NULL or
the fmt_arg array.

Signed-off-by: Ferdinand Bachmann <ferdinand.bachmann@yrlf.at>
2026-03-07 07:55:51 -08:00
Victor Zverovich c8a6fd9177 Minor cleanup 2026-03-05 16:52:21 -08:00
Victor Zverovich d38881410a Deprecated initializer_list join 2026-03-05 16:42:07 -08:00
Yancey 8277ee6aa0 Update fmt::join to support more character types (#4686) 2026-03-04 08:14:08 -08:00
Victor Zverovich af9bb5c075 Mark detail::named_arg as deprecated 2026-03-03 08:22:10 -08:00
TPPPP db4bea83d6 Move named_arg to public API (#4687) 2026-02-28 15:34:39 -08:00
Bernd Petrovitsch 82553a7a5b wrap macro arguments in parentheses for robustness (#4681)
Co-authored-by: Bernd Petrovitsch <bernd@sysprog.at>
2026-02-24 10:20:12 -08:00
Aaron Gokaslan 8d3f731763 Mark static arrays as constexpr for binary opt (#4680) 2026-02-23 17:08:35 -08:00
Victor Zverovich 60d5d0cec6 Workaround broken _Generic in MSVC 2026-02-21 15:04:38 -08:00
Victor Zverovich 9e5bb7ef77 Cleanup the C API 2026-02-21 11:46:23 -08:00
Soumik15630m 1dc644e021 Add C11 API with type-safe formatting (#4663) (#4671) 2026-02-16 07:06:32 -08:00
Stéén b35de87ad9 std.h: Allow formatting std::unexpected type. (#4675)
In some cases, people might want to format the std::unexpected type itself,
independent of the value type, this commit makes it possible.

Co-authored-by: Robin Oger <robin.oger.work@gmail.com>
2026-02-11 15:06:59 -08:00