Skip to content

Replace libfmt with std::format#8618

Open
glebm wants to merge 7 commits into
diasurgical:masterfrom
glebm:std-format
Open

Replace libfmt with std::format#8618
glebm wants to merge 7 commits into
diasurgical:masterfrom
glebm:std-format

Conversation

@glebm

@glebm glebm commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Based on top of #8616

  • fmt::format with literal format strings -> std::format.
  • fmt::format(fmt::runtime(...)) -> FormatRuntime in the new utils/format.hpp, an std::vformat wrapper that is also safe under the P2905 lvalue requirement of std::make_format_args.
  • fmt::dynamic_format_arg_store (Lua logging) -> a small hand-rolled per-field formatter over std::variant, returning std::expected.
  • fmt::format_int -> std::to_chars.
  • fmt::join -> manual joins at the two call sites.
  • SDL_audiolib: new patch that rewrites aulib_log.h to use std::format and drops the fmt dependency from its CMakeLists.
  • The -static-libstdc++ guard now keys off DEVILUTIONX_STATIC_SDL_AUDIOLIB instead of DEVILUTIONX_STATIC_LIBFMT.
  • libfmt removed from CMake, vcpkg, Brewfile, CI workflows, Dockerfiles, packaging scripts, UWP project, and docs.
  • macOS minimum version bumped to 13.3+, iOS to 16.3+ (required for <format>)

@glebm
glebm force-pushed the std-format branch 6 times, most recently from 2cb5161 to 5d7acaf Compare July 13, 2026 16:59
@glebm
glebm marked this pull request as ready for review July 13, 2026 17:09
@glebm
glebm enabled auto-merge (rebase) July 13, 2026 17:09
glebm and others added 7 commits July 15, 2026 22:02
Now that the project targets C++23, use the standard library's
std::expected instead of the vendored tl::expected polyfill:

- tl::expected -> std::expected, tl::unexpected/tl::make_unexpected -> std::unexpected
- .map()/.map_error() -> .transform()/.transform_error()
- #include <expected.hpp> -> #include <expected>, grouped with std headers
- Remove 3rdParty/tl/expected.hpp (the tl target remains for function_ref.hpp)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
These toolchains haven't updated their libcxx in years.
Disables these CI builds in order to avoid being stuck on old language level support.

Once / if the toolchains are updated, we can re-enable these platforms.

Toolchain update bugs:
* PS4: OpenOrbis/OpenOrbis-PS4-Toolchain#262
* Xbox nxdk: XboxDev/nxdk-libcxx#3
Includes
diasurgical/asio@112f011,
which fixes a C++23 deprecation warning
- `fmt::format` with literal format strings -> `std::format`.
- `fmt::format(fmt::runtime(...))` -> `FormatRuntime` in the new
  `utils/format.hpp`, a std::vformat wrapper that is also safe under the
  P2905 lvalue requirement of `std::make_format_args`.
- `fmt::dynamic_format_arg_store` (Lua logging) -> a small hand-rolled
  per-field formatter over `std::variant`, returning `std::expected`.
- `fmt::format_int` -> `std::to_chars`.
- `fmt::join` -> manual joins at the two call sites.
- SDL_audiolib: new patch that rewrites aulib_log.h to use std::format
  and drops the fmt dependency from its CMakeLists.
- The `-static-libstdc++` guard now keys off
  `DEVILUTIONX_STATIC_SDL_AUDIOLIB` instead of `DEVILUTIONX_STATIC_LIBFMT`.
- libfmt removed from CMake, vcpkg, Brewfile, CI workflows,
  Dockerfiles, packaging scripts, UWP project, and docs.
- macOS bumped to 13.3+, iOS to 16.3+ (required for `<format>`)
- Amiga m68k: provide `__cmpdf2`, which is missing from the hard-float
  libgcc multilib but referenced via libstdc++'s long double paths.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant