./textproc/fmtlib, Formatting library

[ Image CVSweb ] [ Image Homepage ] [ Image RSS ] [ Image Required by ]


Branch: CURRENT, Version: 12.2.0, Package name: fmtlib-12.2.0, Maintainer: pkgsrc-users

fmt (formerly cppformat) is an open-source formatting library. It can be used
as a fast and safe alternative to printf and IOStreams.


Master sites:

Filesize: 721.05 KB

Version history: (Expand)


CVS history: (Expand)


   2026-06-22 21:28:41 by Thomas Klausner | Files touched by this commit (3) | Package updated
Log message:
fmtlib: update to 12.2.0.

# 12.2.0 - 2026-06-16

- Added a C11 API that brings fast, type-safe formatting to C. The new
  `fmt-c` library and `fmt/fmt-c.h` header use `_Generic` to dispatch on
  argument types and outperform `printf`/`sprintf`. For example:

  ```c++
  #include <fmt/fmt-c.h>

  fmt_print(stdout, "The answer is {}.\n", 42);
  ```

  (https://github.com/fmtlib/fmt/issues/4663,
  https://github.com/fmtlib/fmt/pull/4671,
  https://github.com/fmtlib/fmt/pull/4696,
  https://github.com/fmtlib/fmt/issues/4693,
  https://github.com/fmtlib/fmt/pull/4694,
  https://github.com/fmtlib/fmt/pull/4712,
  https://github.com/fmtlib/fmt/pull/4789).
  Thanks @Soumik15630m, @Ferdi265 and @localspook.

- Added a separate `fmt::fmt-module` CMake target for C++20 modules and a
  CI workflow that exercises module-based builds
  (https://github.com/fmtlib/fmt/issues/4684,
  https://github.com/fmtlib/fmt/pull/4685,
  https://github.com/fmtlib/fmt/issues/4707,
  https://github.com/fmtlib/fmt/pull/4708,
  https://github.com/fmtlib/fmt/pull/4702,
  https://github.com/fmtlib/fmt/pull/4709).
  Thanks @MathewBensonCode.

- Enabled the full Dragonbox lookup cache by default for floating-point
  formatting unless optimizing for binary size (`__OPTIMIZE_SIZE__`),
  giving a ~10–25% speedup. Thanks Matthias Kretz for the suggestion.
  Average time per `double` on Apple M1 Pro (clang 17, random digits,
  smaller is better) measured with
  [dtoa-benchmark](https://github.com/fmtlib/dtoa-benchmark):

  | Method                  | Time (ns) |
  | ----------------------- | --------: |
  | fmt (full)              |     22.07 |
  | fmt (compact)           |     29.55 |
  | ryu                     |     35.21 |
  | double-conversion       |     81.81 |
  | `sprintf`               |    726.27 |
  | `ostringstream`         |    864.34 |

- Improved integer formatting performance by ~3%
  (https://github.com/fmtlib/fmt/pull/4630). Thanks @user202729.

- Optimized formatting into back-insert iterators by using bulk container
  append/insert methods (e.g. on `std::vector<char>` and custom string
  types) (https://github.com/fmtlib/fmt/pull/4679). Thanks @user202729.

- Reduced binary size of debug builds (~200k to ~85k in the bloat test) and
  improved compile speed when `consteval` is unavailable.

- Made path formatting lossless, preserving ill-formed UTF-16
  sequences when converting `std::filesystem::path` to a narrow string.

- Added support for formatting `std::unexpected`
  (https://github.com/fmtlib/fmt/pull/4675). Thanks @17steen.

- Added overloads of `fmt::println` that take a `fmt::text_style`
  (https://github.com/fmtlib/fmt/pull/4782). Thanks @ahoarau.

- Added support for positional arguments as width and precision specifiers
  in `fmt::printf` (https://github.com/fmtlib/fmt/pull/4643).
  Thanks @KareemOtoum.

- Made `FMT_STRING` a no-op when `FMT_USE_CONSTEVAL` is enabled, since the
  consteval format-string constructor already provides compile-time
  validation
  (https://github.com/fmtlib/fmt/issues/4611,
  https://github.com/fmtlib/fmt/pull/4612). Thanks @friedkeenan.

- Promoted `fmt::detail::named_arg` to the public API as `fmt::named_arg` and
  deprecated the detail alias
  (https://github.com/fmtlib/fmt/issues/4683,
  https://github.com/fmtlib/fmt/pull/4687). Thanks @TPPPP72.

- Moved the `std::byte` formatter from `fmt/format.h` to `fmt/std.h`.

- Provided a default definition for `fmt::is_contiguous`
  (https://github.com/fmtlib/fmt/pull/4731,
  https://github.com/fmtlib/fmt/pull/4770). Thanks @user202729 and @phprus.

- Added the `FMT_USE_FLOCKFILE` macro to disable the use of `flockfile`
  (https://github.com/fmtlib/fmt/issues/4646,
  https://github.com/fmtlib/fmt/pull/4666). Thanks @mvastola.

- Added `include_guard(GLOBAL)` so that {fmt} can be used in multiple
  submodules of the same project
  (https://github.com/fmtlib/fmt/pull/4672). Thanks @torsten48.

- Improved `constexpr` support
  (https://github.com/fmtlib/fmt/pull/4659,
  https://github.com/fmtlib/fmt/pull/4591).
  Thanks @elbeno and @17steen.

- Deprecated the implicit conversion from `fmt::format_string` and
  `fmt::basic_fstring` to `string_view` to align with `std::format_string`;
  use `format_string::get()` instead.

- Opted out `std::complex` from tuple formatting so that the dedicated
  `std::complex` formatter is always used.

- Removed the `fmt::say` function.

- Deprecated the `std::initializer_list` overload of `fmt::join` and the array
  overload of `fmt::vformat_to`.

- Made the `<fmt/core.h>` header equivalent to `<fmt/base.h>` by
  default. Code that relied on `<fmt/core.h>` pulling in `<fmt/format.h>`
  must now either include `<fmt/format.h>` directly or define
  `FMT_DEPRECATED_HEAVY_CORE` to opt back in.

- Improved `wchar_t` support: `fmt::join` now accepts `wchar_t` and other
  non-`char` separators, and `fmt::format_to_n` now works with `fmt::runtime`
  on `wchar_t`
  (https://github.com/fmtlib/fmt/pull/4686,
  https://github.com/fmtlib/fmt/issues/4714,
  https://github.com/fmtlib/fmt/pull/4715).
  Thanks @Yancey2023 and @sunmy2019.

- Fixed formatting of `std::tm` with a null `tm_zone`
  (https://github.com/fmtlib/fmt/pull/4790). Thanks @Carmel0.

- Fixed compile-time formatting in `fmt/ranges.h`, `fmt/style.h` and
  `fmt/std.h` (https://github.com/fmtlib/fmt/pull/4759). Thanks @j4niwzis.

- Fixed an ambiguity between `formatter<std::optional<T>>` in `fmt/std.h`
  and `fmt/ranges.h` on C++26 (P3168R2)
  (https://github.com/fmtlib/fmt/pull/4761). Thanks @phprus.

- Fixed a GCC PCH breakage triggered by a scoped `#pragma GCC optimize`.

- Fixed a TSAN false positive in the locale handling code
  (https://github.com/fmtlib/fmt/issues/4755).

- Fixed compile-time format string checks truncating string literals at
  an embedded null byte
  (https://github.com/fmtlib/fmt/pull/4732). Thanks @user202729.

- Fixed out-of-bounds reads in `printf` formatting
  (https://github.com/fmtlib/fmt/issues/4741,
  https://github.com/fmtlib/fmt/pull/4742,
  https://github.com/fmtlib/fmt/pull/4800).
  Thanks @Algunenano and @aizu-m.

- Fixed the return type of the `f(un)lockfile`   wrappers on Windows
  (https://github.com/fmtlib/fmt/pull/4739). Thanks @mvastola.

- Worked around a CUDA issue when handling UTF-32 literals
  (https://github.com/fmtlib/fmt/pull/4719). Thanks @Cazadorro.

- Fixed missing named-argument validation for compiled format strings
  (https://github.com/fmtlib/fmt/pull/4638). Thanks @JaeheonShim.

- Fixed `fmt::format_to_n` in `<fmt/compile.h>` failing to compile when
  `<iterator>` is not transitively included
  (https://github.com/fmtlib/fmt/issues/4615).

- Fixed handling of pointers in format string compilation with
  `FMT_BUILTIN_TYPES=0`.

- Stopped assuming nul termination of the format string in `fmt::printf`.
  Thanks @ZUENS2020 for reporting.

- Fixed a build error when locale support is disabled
  (https://github.com/fmtlib/fmt/pull/4627). Thanks @marcel-behlau-elfin.

- Fixed a fallback range formatter for types with a `container_type` member
  (https://github.com/fmtlib/fmt/issues/4123,
  https://github.com/fmtlib/fmt/pull/4660). Thanks @Soumik15630m.

- Fixed C++20 concept detection
  (https://github.com/fmtlib/fmt/pull/4653). Thanks @tearfur.

- Fixed a clang compilation failure
  (https://github.com/fmtlib/fmt/pull/4718). Thanks @mccakit.

- Fixed various MSVC warnings, including C4305 and conversion warnings on
  x86 (https://github.com/fmtlib/fmt/pull/4668,
  https://github.com/fmtlib/fmt/pull/4594).
  Thanks @kanren3 and @blizzard4591.

- Updated the Android Gradle Plugin to 9.x
  (https://github.com/fmtlib/fmt/issues/4651,
  https://github.com/fmtlib/fmt/pull/4658). Thanks @Soumik15630m.

- Made various code, build and test improvements
  (https://github.com/fmtlib/fmt/pull/4625,
  https://github.com/fmtlib/fmt/pull/4639,
  https://github.com/fmtlib/fmt/pull/4644,
  https://github.com/fmtlib/fmt/pull/4656,
  https://github.com/fmtlib/fmt/pull/4680,
  https://github.com/fmtlib/fmt/pull/4681,
  https://github.com/fmtlib/fmt/pull/4704,
  https://github.com/fmtlib/fmt/pull/4710,
  https://github.com/fmtlib/fmt/pull/4713,
  https://github.com/fmtlib/fmt/pull/4729,
  https://github.com/fmtlib/fmt/pull/4751,
  https://github.com/fmtlib/fmt/pull/4758,
  https://github.com/fmtlib/fmt/pull/4799).
  Thanks @ZephyrLykos, @togunchan, @kagancansit, @BerndPetrovitsch,
  @Skylion007, @st0rmbtw, @localspook and @EXtremeExploit.

- Improved documentation, including a rewrite of the format string syntax,
  better handling of doxygen tags, documenting `output_file`, fixing CSS so
  that whitespace is displayed properly, and various smaller fixes
  (https://github.com/fmtlib/fmt/pull/4622,
  https://github.com/fmtlib/fmt/pull/4626,
  https://github.com/fmtlib/fmt/pull/4631,
  https://github.com/fmtlib/fmt/pull/4667,
  https://github.com/fmtlib/fmt/pull/4616,
  https://github.com/fmtlib/fmt/pull/4748).
  Thanks @heavywatal, @ZephyrLykos, @user202729, @ssszcmawo, @bigmoonbit
  and @Powerbyte7.

- Added building of release artifacts and SLSA provenance in CI, added a
  CodeQL workflow, and added the security policy in `.github/SECURITY.md`.
   2025-11-02 14:50:46 by Thomas Klausner | Files touched by this commit (2) | Package updated
Log message:
fmtlib: update to 12.1.0.

# 12.1.0 - 2025-10-29

- Optimized `buffer::append`, resulting in up to ~16% improvement on spdlog
  benchmarks (https://github.com/fmtlib/fmt/pull/4541). Thanks @fyrsta7.

- Worked around an ABI incompatibility in `std::locale_ref` between clang and
  gcc (https://github.com/fmtlib/fmt/issues/4573).

- Made `std::variant` and `std::expected` formatters work with `format_as`
  (https://github.com/fmtlib/fmt/issues/4574,
  https://github.com/fmtlib/fmt/pull/4575). Thanks @phprus.

- Made `fmt::join<string_view>` work with C++ modules
  (https://github.com/fmtlib/fmt/issues/4379,
  https://github.com/fmtlib/fmt/pull/4577). Thanks @Arghnews.

- Exported `fmt::is_compiled_string` and `operator""_cf` from the module
  (https://github.com/fmtlib/fmt/pull/4544). Thanks @CrackedMatter.

- Fixed a compatibility issue with C++ modules in clang
  (https://github.com/fmtlib/fmt/pull/4548). Thanks @tsarn.

- Added support for cv-qualified types to the `std::optional` formatter
  (https://github.com/fmtlib/fmt/issues/4561,
  https://github.com/fmtlib/fmt/pull/4562). Thanks @OleksandrKvl.

- Added demangling support (used in exception and `std::type_info` formatters)
  for libc++ and clang-cl
  (https://github.com/fmtlib/fmt/issues/4542,
  https://github.com/fmtlib/fmt/pull/4560,
  https://github.com/fmtlib/fmt/issues/4568,
  https://github.com/fmtlib/fmt/pull/4571).
  Thanks @FatihBAKIR and @rohitsutreja.

- Switched to global `malloc`/`free` to enable allocator customization
  (https://github.com/fmtlib/fmt/issues/4569,
  https://github.com/fmtlib/fmt/pull/4570). Thanks @rohitsutreja.

- Made the `FMT_USE_CONSTEVAL` macro configurable by users
  (https://github.com/fmtlib/fmt/pull/4546). Thanks @SnapperTT.

- Fixed compilation with locales disabled in the header-only mode
  (https://github.com/fmtlib/fmt/issues/4550).

- Fixed compilation with clang 21 and `-std=c++20`
  (https://github.com/fmtlib/fmt/issues/4552).

- Fixed a dynamic linking issue with clang-cl
  (https://github.com/fmtlib/fmt/issues/4576,
  https://github.com/fmtlib/fmt/pull/4584). Thanks @FatihBAKIR.

- Fixed a warning suppression leakage on gcc
  (https://github.com/fmtlib/fmt/pull/4588). Thanks @ZedThree.

- Made more internal color APIs `constexpr`
  (https://github.com/fmtlib/fmt/pull/4581). Thanks @ishani.

- Fixed compatibility with clang as a host compiler for NVCC
  (https://github.com/fmtlib/fmt/pull/4564). Thanks @valgur.

- Fixed various warnings and lint issues
  (https://github.com/fmtlib/fmt/issues/4565,
  https://github.com/fmtlib/fmt/pull/4572,
  https://github.com/fmtlib/fmt/pull/4557).
  Thanks @LiangHuDream and @teruyamato0731.

- Improved documentation
  (https://github.com/fmtlib/fmt/issues/4549,
  https://github.com/fmtlib/fmt/pull/4551,
  https://github.com/fmtlib/fmt/issues/4566,
  https://github.com/fmtlib/fmt/pull/4567,
  https://github.com/fmtlib/fmt/pull/4578,).
  Thanks @teruyamato0731, @petersteneteg and @zimmerman-dev.
   2025-09-21 20:15:09 by Thomas Klausner | Files touched by this commit (56)
Log message:
*: recursive bump for fmtlib 12
   2025-09-21 20:14:08 by Thomas Klausner | Files touched by this commit (3) | Package updated
Log message:
fmtlib: update to 12.0.0.

# 12.0.0 - 2025-09-17

- Optimized the default floating point formatting
  (https://github.com/fmtlib/fmt/issues/3675,
  https://github.com/fmtlib/fmt/issues/4516). In particular, formatting a
  `double` with format string compilation into a stack allocated buffer is
  more than 60% faster in version 12.0 compared to 11.2 according to
  [dtoa-benchmark](https://github.com/fmtlib/dtoa-benchmark):

  ```
  Function  Time (ns)  Speedup
  fmt11        34.471    1.00x
  fmt12        21.000    1.64x
  ```

  <img width="766" height="609" \ 
src="https://github.com/user-attachments/assets/d7d768ad-7543-468c-b0bb-449abf73b31b" \ 
/>

- Added `constexpr` support to `fmt::format`. For example:

  ```c++
  #include <fmt/compile.h>

  using namespace fmt::literals;
  std::string s = fmt::format(""_cf, 42);
  ```

  now works at compile time provided that `std::string` supports `constexpr`
  (https://github.com/fmtlib/fmt/issues/3403,
  https://github.com/fmtlib/fmt/pull/4456). Thanks @msvetkin.

- Added `FMT_STATIC_FORMAT` that allows formatting into a string of the exact
  required size at compile time.

  For example:

  ```c++
  #include <fmt/compile.h>

  constexpr auto s = FMT_STATIC_FORMAT("{}", 42);
  ```

  compiles to just

  ```s
  __ZL1s:
        .asciiz "42"
  ```

  It can be accessed as a C string with `s.c_str()` or as a string view with
  `s.str()`.

- Improved C++20 module support

- Switched to using estimated display width in precision. For example:

  ```c++
  fmt::print("|{:.4}|\n|1234|\n", "🐱🐱🐱");
  ```

  prints

  \ 
![](https://github.com/user-attachments/assets/6c4446b3-13eb-43b9-b74a-b4543540ad6a)

  because `🐱` has an estimated width of 2

- Fix interaction between debug presentation, precision, and width for strings

- Implemented allocator propagation on `basic_memory_buffer` move

- Fixed an ambiguity between `std::reference_wrapper<T>` and `format_as`
  formatters

- Removed the following deprecated APIs:

  - `has_formatter`: use `is_formattable` instead,
  - `basic_format_args::parse_context_type`,
    `basic_format_args::formatter_type` and similar aliases in context types,
  - wide stream overload of `fmt::printf`,
  - wide stream overloads of `fmt::print` that take text styles,
  - `is_*char` traits,
  - `fmt::localtime`.

- Deprecated wide overloads of `fmt::fprintf` and `fmt::sprintf`.

- Improved diagnostics for the incorrect usage of `fmt::ptr`

- Made handling of ANSI escape sequences more efficient

- Fixed a buffer overflow on all emphasis flags set

- Fixed an integer overflow for precision close to the max `int` value.

- Fixed compatibility with WASI (https://github.com/fmtlib/fmt/issues/4496,

- Fixed `back_insert_iterator` detection, preventing a fallback on slower path
  that handles arbitrary iterators

- Fixed handling of invalid glibc `FILE` buffers

- Added `wchar_t` support to the `std::byte` formatter

- Changed component prefix from `fmt-` to `fmt_` for compatibility with
  NSIS/CPack on Windows, e.g. `fmt-doc` changed to `fmt_doc`

- Added the `FMT_CUSTOM_ASSERT_FAIL` macro to simplify providing a custom
  `fmt::assert_fail` implementation

- Switched to `FMT_THROW` on reporting format errors so that it can be
  overriden by users when exceptions are disabled

- Improved master project detection and disabled install targets when using
  {fmt} as a subproject by default

- Made various code improvements

- Added Conan instructions to the docs

- Removed Bazel files to avoid issues with downstream packaging

- Added more entries for generated files to `.gitignore`

- Fixed various warnings and compilation issues
   2025-05-06 15:35:04 by Thomas Klausner | Files touched by this commit (2) | Package updated
Log message:
fmtlib: update to 11.2.0.

# 11.2.0 - 2025-05-03

- Added the `s` specifier for `std::error_code`. It allows formatting an error
  message as a string. For example:

  ```c++
  #include <fmt/std.h>

  int main() {
    auto ec = std::make_error_code(std::errc::no_such_file_or_directory);
    fmt::print("{:s}\n", ec);
  }
  ```

  prints

  ```
  No such file or directory
  ```
  (The actual message is platform-specific.)

- Fixed formatting of `std::chrono::local_time` and `tm`
  For example ([godbolt](https://www.godbolt.org/z/8o4b1PPn5)):

  ```c++
  #include <fmt/chrono.h>

  int main() {
    std::chrono::zoned_time zt(
      std::chrono::current_zone(),
      std::chrono::system_clock::now());
    fmt::print("{}", zt.get_local_time());
  }
  ```

  is now formatted consistenly across platforms.

- Added diagnostics for cases when timezone information is not available.
  For example:

  ```c++
  fmt::print("{:Z}", std::chrono::local_seconds());
  ```

  now gives a compile-time error.

- Deprecated `fmt::localtime` in favor of `std::localtime`.

- Fixed compilation with GCC 15 and C++20 modules enabled

- Fixed handling of named arguments in format specs

- Added error reporting for duplicate named arguments

- Fixed formatting of `long` with `FMT_BUILTIN_TYPES=0`

- Optimized `text_style` using bit packing

- Added support for incomplete types

- Fixed a flush issue in `fmt::print` when using libstdc++

- Fixed `fmt::println` usage with `FMT_ENFORCE_COMPILE_STRING` and legacy
  compile-time checks

- Removed legacy header `fmt/core.h` from docs

- Worked around limitations of `__builtin_strlen` during constant evaluation

- Worked around a bug in MSVC v141

- Removed the `fmt_detail` namespace

- Removed specializations of `std::is_floating_point` in tests

- Fixed a CMake error when setting `CMAKE_MODULE_PATH` in the pedantic mode

- Updated the Bazel config
   2025-02-26 22:28:41 by Adam Ciarcinski | Files touched by this commit (2) | Package updated
Log message:
fmtlib: updated to 11.1.4

11.1.4 - 2025-02-26

- Fixed ABI compatibility with earlier 11.x versions on Windows
- Improved the logic of switching between fixed and exponential format for
  `float`
- Moved `is_compiled_string` to the public API
- Simplified implementation of `operator""_cf`
- Fixed `__builtin_strlen` detection
- Fixed handling of BMI paths with the Ninja generator
- Fixed gcc 8.3 compile errors
- Fixed a bogus MSVC warning
   2025-01-27 11:00:57 by Adam Ciarcinski | Files touched by this commit (2) | Package updated
Log message:
fmtlib: updated to 11.1.3

11.1.3

Fixed compilation on GCC 9.4
Worked around an internal compiler error when using C++20 modules with GCC 14.2 \ 
and earlier
Worked around a bug in GCC 6
Fixed an issue caused by instantiating formatter<const T>
Fixed formatting into std::ostreambuf_iterator when using format string compilation
Restored a constraint on the map formatter so that it correctly reports as \ 
unformattable when the element is
Reduced the size of format specs
Readded args() to fmt::format_context
Fixed a bogus MSVC warning
Fixed a pedantic mode error in the CMake config
   2025-01-13 10:53:59 by Adam Ciarcinski | Files touched by this commit (2) | Package updated
Log message:
fmtlib: updated to 11.1.2

11.1.2

Fixed ABI compatibility with earlier 11.x versions
Added wchar_t support to the std::bitset formatter
Prefixed CMake components with fmt- to simplify usage of {fmt} via add_subdirectory
Updated docs for meson
Fixed a compilation error in chrono on nvcc
Fixed various warnings