866 Commits

Author SHA1 Message Date
Victor Zverovich
ce039d14fe Move migration guidance to documentation 2026-09-04 09:37:28 -07:00
Victor Zverovich
cbb264122a Simplify nested_formatter context handling
Format nested values directly through the stored formatter so dynamic
specifications resolve against the enclosing operation.
2026-09-02 10:14:09 -07:00
way4sahil
b039e624c0
Document C++20 module usage with CMake (#4891)
* Document C++20 module usage with CMake

* Added Change log

* Addressed review comments

---------

Co-authored-by: Sahil Sinha <sahil.sinha@stryker.com>
2026-08-30 10:17:00 -07:00
Victor Zverovich
9375eb3792 Simplify enum identifier handling and tidy reflection docs
Use std::string_view directly for enumerator identifiers, dropping the
identifier wrapper and inlining count_enumerators. Update the fmt/enum.h
documentation to point at cppreference and drop an inaccurate note. Also
remove the no-longer-needed -Wno-sfinae-incomplete option for format-test.
2026-08-29 15:11:31 -07:00
Avi Kivity
e27cc20bd9
Format enums annotated with fmt::as_identifiers (requires C++26 reflection) (#4885)
* Format enums annotated with fmt::as_identifiers (requires C++26 reflection)

Format an enum as the identifier of the matching enumerator if the enum is
annotated with fmt::as_identifiers:

  enum class [[=fmt::as_identifiers]] color { red, green, blue };
  fmt::format("{}", color::green);  // "green"

Values that don't match any enumerator are represented as their underlying
value in decimal before applying string formatting.

Identifiers are retrieved via C++26 reflection (P2996) and the annotation
via P3394. FMT_USE_REFLECTION is autodetected and can be overridden by the
user; without reflection the header is empty.

The header is also part of the fmt module, but, unlike with headers, whether
it provides anything is decided when the module is compiled, so the module
build detects reflection and enables it if the configured standard allows.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Look up enum identifiers by index when the values are dense

The formatter for enums annotated with fmt::as_identifiers did a linear
search over all enumerators. Build a table indexed by the distance from
the smallest enumerator value instead, with empty string views in the
holes, which reduces the lookup to a bounds check and one load.

The table is only used if at least 70% of its elements are identifiers,
limiting its size to 10/7 of the number of enumerators. Sparser enums
keep using the linear search. Distances are computed in uint64_t so that
enums with negative values and values spanning the whole range of the
underlying type are handled without overflow.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Suppress -Wsfinae-incomplete in format-test on GCC 16

GCC 16 warns when a type is completed after it failed to be complete in a
SFINAE context. format-test does this deliberately to check that formatting
of incomplete types works, so the warning is a false positive there and
breaks the build with -Werror.

* Test GCC 16 on CI

GCC 16 is the first compiler with C++26 reflection support, which is needed
by fmt/enum.h, so add a job that builds with it in C++26 mode. It comes from
the ubuntu-toolchain-r/test PPA since Ubuntu 24.04 only ships GCC 14.

Also report when reflection is not detected to make it visible that
enum-test was skipped.

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-23 09:31:28 -07:00
rimathia
17500e457b
doc extension concerning format_as and general implementations (#4857) 2026-07-29 09:43:31 -07:00
Yoshi
bcaa44d055
Document that hexfloat 'a'/'A' always emits the 0x prefix (#4862) 2026-07-20 16:24:55 -07:00
Brooklyn widz
62abc0f30a
fix extra closing paragraph tag in doc/index.md (#4826) 2026-06-25 16:09:46 -07:00
Victor Zverovich
ebb9f0807a Consistent plurality 2026-06-02 11:02:57 -07:00
Victor Zverovich
f577c1f11d Improve docs 2026-06-02 10:30:08 -07:00
Victor Zverovich
889da4274e Improve docs 2026-06-02 10:05:34 -07:00
Victor Zverovich
dea98ad228 Improve docs 2026-06-02 09:27:47 -07:00
Victor Zverovich
d04adde254 Improve docs 2026-06-02 09:04:13 -07:00
Victor Zverovich
f53c0408a3 Remove Python license attribution
The syntax documentation no longer derives from Python's string
module documentation, so the PSF license no longer applies.
2026-06-01 15:45:52 -07:00
Victor Zverovich
ab92191553 Rewrite syntax.md from scratch
Only reuse the BNF syntax.
2026-06-01 14:51:45 -07:00
Victor Zverovich
0f133953fb Tweak docs 2026-03-03 08:20:51 -08:00
Mathew Benson
4e1b170b44
Add Separate CMake Target for C++20 Modules (#4685)
* Add Separate CMake Target for C++20 Modules

In the same vein as there is the `fmt::fmt-header-only`, `fmt::fmt` and
`fmt::fmt_c` targets, I propose the addition of a new target
`fmt::fmt-module` which will be for the compilation of the FMT_MODULE
library option.

The new target will have the properties requried for Compiling,
Installing and using the C++20 functionality in CMake

The `add_module_library` function is marked as deprecated as its
functionality is superseded.

Updated the logic for setting the FMT_USE_CMAKE_MODULE flag to check the
versions for Ninja and MSVC according the CMAKE Documents and setting
the FMT_MODULE flag based on this

* Add Separate CMake Target for C++20 Modules

In the same vein as there is the `fmt::fmt-header-only`, `fmt::fmt` and
`fmt::fmt_c` targets, I propose the addition of a new target
`fmt::fmt-module` which will be for the compilation of the FMT_MODULE
library option.

The new target will have the properties requried for Compiling,
Installing and using the C++20 functionality in CMake

Updated the logic for setting the FMT_USE_CMAKE_MODULE flag to check the
versions for Ninja and MSVC according the CMAKE Documents and setting
the FMT_MODULE flag based on this

Fixed the test/CMakeLists.txt file which used the FMT_MODULE flag to
separate the module and non-module library testing, in particular
disableing the module version.

The module testing still needs to be fixed, but the expected behavior of
testing the non-modular version is working.

---------

Co-authored-by: Mathew Benson <mathew@benson.co.ke>
Co-authored-by: ClausKlein <claus.klein@arcormail.de>
2026-03-02 09:11:31 -08:00
ssszcmawo
28b082cc2b
Cleanup documentation (#4667)
* Cleanup documentation

* Fix comment typo in fmt::formatter struct

* Fix formatting and grammar in api.md

Corrected formatting and grammar in the API documentation.
2026-02-04 18:47:47 -08:00
Victor Zverovich
48967e1b6f Cleanup named args 2026-02-02 11:08:01 -08:00
Victor Zverovich
91d1aced0a Split exception into a separate file not to confuse openssf 2025-12-17 10:31:12 -08:00
user202729
2e819a11f2
Some documentation improvements (#4631) 2025-12-17 06:53:01 -08:00
Watal M. Iwasaki
e137db699a
Fix doc CSS to display white-space properly (#4622)
See fmtlib/fmt.dev#25
2025-12-03 11:35:04 -08:00
bigmoonbit
2727215c11
chore: minor improvement for docs (#4616)
Signed-off-by: bigmoonbit <bigmoonbit@outlook.com>
2025-11-28 12:55:25 -08:00
Victor Zverovich
a0571f3f59 Document output_file 2025-11-03 10:11:31 -10:00
John Zimmerman
656d14db8b
docs: format two unescaped printf references with backticks (#4578) 2025-10-16 11:27:51 -07:00
Victor Zverovich
beefc1c14f Tweak wording 2025-10-12 10:54:28 -07:00
Victor Zverovich
81fe170849 Update docs 2025-10-12 10:42:12 -07:00
Victor Zverovich
491dc16a6d Cleanup docs 2025-10-12 10:33:05 -07:00
Victor Zverovich
41326207c7 Cleanup docs 2025-10-12 10:20:16 -07:00
Victor Zverovich
c4f70ab69e Cleanup docs 2025-10-12 09:34:46 -07:00
Victor Zverovich
5e214f0c43 Cleanup docs 2025-10-12 09:24:58 -07:00
Peter Steneteg
eb44d87b52
docs: range formatter grammar fix (#4567) 2025-10-07 11:34:00 -07:00
teruyamato0731
4801f54e59
docs: Add compile-time options to API documentation (#4551) 2025-09-30 14:03:11 -07:00
Victor Zverovich
bfdef8b15d Remove deprecated functions 2025-09-13 09:25:53 -07:00
Uilian Ries
36390db094
Add Conan instructions in getting-started page (#4537)
Signed-off-by: Uilian Ries <uilianries@gmail.com>
2025-09-10 11:04:48 -07:00
Victor Zverovich
20e0d6d8dd Update docs 2025-09-01 10:15:54 -07:00
Victor Zverovich
8ba99c0f05 Update docs 2025-09-01 10:04:54 -07:00
Victor Zverovich
656228fbee Update docs 2025-09-01 09:50:45 -07:00
Victor Zverovich
a75e8af487 Update docs 2025-08-31 10:51:29 -07:00
Victor Zverovich
489fd7ca4b Simplify locale handling 2025-08-31 09:33:43 -07:00
Victor Zverovich
a77efa4b4a Move is_*char to detail 2025-08-24 09:16:18 -07:00
Victor Zverovich
02de29e003 Remove a reference to a compromised account 2025-05-30 18:24:56 -07:00
Victor Zverovich
3ba3c390fb Clarify that formatting of pointers is disallowed 2025-05-17 10:16:58 -07:00
Victor Zverovich
102752ad45 Update docs 2025-05-11 09:13:12 -07:00
Victor Zverovich
eb9a95d426 Clarify that formatting of pointers is disallowed 2025-05-05 10:55:59 -07:00
Victor Zverovich
9f6c12c3dc Remove deprecated localtime from docs 2025-04-25 11:58:58 -07:00
krzysztofkortas
db405954cd
Remove fmt/core.h from docs (#4421) 2025-04-20 07:40:18 -07:00
Victor Zverovich
dd780fde44 Add clang-3.4 2025-03-15 12:22:10 -07:00
Victor Chernyakin
b776cf66fc
Optimize text_style using bit packing (#4363) 2025-03-01 11:18:19 -08:00
Victor Zverovich
373855c1b0 Clarify difference in FP representation 2025-01-26 13:49:54 -08:00