Commit Graph

898 Commits

Author SHA1 Message Date
Victor Zverovich
a5bacf3fef Remove custom_formatter 2023-12-31 12:34:18 -08:00
Victor Zverovich
e33c1568c3 Implement scan argument access 2023-12-31 08:49:29 -08:00
Victor Zverovich
23826669cf Cleanup error handling 2023-12-31 07:51:57 -08:00
Victor Zverovich
df62c86783 Mark grow as deprecated 2023-12-25 10:11:22 -08:00
Victor Zverovich
d5da9cc40e Apply clang-tidy 2023-12-19 17:52:50 -08:00
Vladislav Shchapov
9165434e5a
Enable consteval in MSVC VS2019 version 16.10 (#3757)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2023-12-18 13:00:11 -08:00
Vladislav Shchapov
923005bd4f
Add stdlib version check for C++20 (#3754)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2023-12-17 08:33:17 -08:00
Kefu Chai
6855bd532b Apply clang-format
* use clang-format v17.0.6 to reformat the tree
* tweak some places so that clang-format does not mutate the layout
  of code too much

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
2023-12-13 07:18:37 -08:00
Kefu Chai
274ba2645b
allow format_as() to format reference (#3739)
before this change, format_as() is unable to format a type which
has `auto format_as() -> const another_type&`, and `another_type`
is formattable. because `format_as_result` maps the result type
as it is, and the compiler refuses to compile
`static_cast<T*>(nullptr)`, where T is a reference type. but
it would be handy if we could use `format_as()` to format types
which, for instance, owns / inherit from a formattable type, and
delegate the formatter to these variables instead without creating
a copy of them.

in this change:

* instruct `format_as_result` to map the
  result type to the decayed type, so that `type` can be the decayed
  type of result type, and this also enables `type` to be formattable,
  as long as the decayed type is formattable.
* corresponding test is added to format-test.cc

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
2023-12-10 08:49:53 -08:00
Albert Santoni
9c3c107c8c
Fix compile with GCC 6.3.0 (bug #3738) (#3743) 2023-12-08 09:36:33 -08:00
js324
573d74395b
error on bool arg w/ char pres_type (#3734) 2023-12-05 13:45:10 -08:00
Victor Zverovich
8f83ee2ad1 Apply coding conventions 2023-11-30 08:24:02 -08:00
Victor Zverovich
6988be3878 Bump version 2023-11-25 09:11:53 -08:00
Victor Zverovich
06f1c0d725 Clarify that calling non-const format is deprecated 2023-11-24 10:21:57 -08:00
Peter Johnson
dd6f657a79
Remove this-> from decltype (#3723)
* Remove this-> from decltype

The latest version of MSVC doesn't like it, and removing it doesn't seem to harm anything.

* Add ifdef for GCC < 5
2023-11-22 09:46:04 -08:00
Victor Zverovich
f7542c5761 Apply clang-format 2023-10-14 06:52:43 -07:00
Victor Zverovich
0e01e46c11 Implement nested formatter 2023-09-18 14:21:21 -07:00
Victor Zverovich
bfdf50d183 Minor cleanup 2023-09-16 08:16:59 -07:00
Chloe
571a9b7b26
Replace usage of C++17 library feature with C++11 (#3638) 2023-09-16 08:07:03 -07:00
Victor Zverovich
6c088be8ec Cleanup handling of visibility 2023-09-16 07:40:08 -07:00
Victor Zverovich
28e2d3b640 Bump version 2023-08-26 08:29:50 -07:00
Mathew Benson
a992b3d1fc
Fix for Compilation Error When Using FMT_MODULE (#3597)
* FMT_EXPORT reorganization to fix compile error

- When compiling with FMT_MODULE, an error was being generated due to
  use of FMT_EXPORT on a declaration within FMT_BEGIN_EXPORT and
  FMT_END_EXPORT on `include/core.h`

- On `include/format.h` had to exclude the function vformat_to by ending
  the export block just before it and beginning a new one after it.
2023-08-20 07:32:36 -07:00
Victor Zverovich
bbb784fb1b Fix a gcc error about partial specialization after instantiation 2023-08-19 07:22:40 -07:00
Victor Zverovich
e1acd5f4d9 Bump version 2023-08-12 06:52:15 -07:00
Victor Zverovich
ebb10347c4 Merge branch 'master' of github.com:fmtlib/fmt 2023-08-07 08:18:13 -07:00
Victor Zverovich
1005720169 Clarify that visit_format_arg is deprecated 2023-08-07 08:17:55 -07:00
Vladislav Shchapov
aeb6ad4dd0
Added formatter for bit_reference-like types (#3570)
* Add test for std::vector<bool>::reference

Co-authored-by: Felix <felix-antoine.constantin@polymtl.ca>
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>

* Add test for std::bitset<N>::reference

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>

* Add test for const std::bitset<N>::reference and const std::vector<bool>::reference

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>

* Add bit_reference-like formatter

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>

* Use std::addressof

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>

---------

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
Co-authored-by: Felix <felix-antoine.constantin@polymtl.ca>
2023-08-06 11:36:30 -07:00
Victor Zverovich
aecf80d304
Update a comment 2023-07-26 15:10:12 -07:00
Martin Jeřábek
503d49286d
expose detail::throw_format_error (#3551)
This enables to only #include <fmt/core.h> when defining formatters.
2023-07-26 13:21:38 -07:00
Dmitry Alexeev
dbabb305c3
Turn off error-producing NVCC workaround when using c++20 (#3544) 2023-07-21 11:29:15 -07:00
Victor Zverovich
dd5a9691f9 Clarify that data is not null-terminated 2023-07-20 07:36:30 -07:00
Kieran Clancy
72dc4491ea
Fix format_string_checker initialisation order (#3542)
Linter (clang-tidy) complains about uninitialised fields in
format_string_checker since types_ is passed to context_ before being
initialised. Fixes #3541.
2023-07-20 07:30:45 -07:00
Victor Zverovich
661b23edeb Call parse on empty specs at compile time 2023-07-15 22:20:29 -07:00
Barry Revzin
de4705f84d
Trying to improve errors in the unformattable case (#3478) 2023-07-01 06:46:04 -07:00
Victor Zverovich
606f85f8b2 Workaround brain-damaged conversions 2023-06-26 16:06:24 -07:00
Victor Zverovich
1daae555b3 Optimize format string compilation 2023-06-15 10:28:23 +03:00
Dana Jansens
35547d6003 Use const_check to silence MSVC warning
The condition is constexpr, so the compiler warns if a runtime check
is used as there's no need to generate code for it.
2023-05-31 09:25:53 -07:00
Victor Zverovich
256a826d63 Consolidate formatters 2023-05-27 09:19:50 -07:00
Victor Zverovich
ef55d4f52e Suppress a bogus gcc warning 2023-05-22 11:27:20 -07:00
Victor Zverovich
6fe895410d Remove invalid_arg_index 2023-05-21 19:57:17 -07:00
Victor Zverovich
de8d0171a2 Simplify FMT_FORMAT_AS 2023-05-20 18:28:01 -07:00
timsong-cpp
08ef0d0842
fix formatter<char*> (#3432) 2023-05-20 06:32:21 -07:00
Victor Zverovich
0a1c27281a Detemplatize basic_printf_context 2023-05-17 09:29:20 -07:00
Victor Zverovich
3c6053c535 Cleanup basic_printf_context 2023-05-17 07:57:53 -07:00
Victor Zverovich
b14913fae5 FMT_MODULE_EXPORT -> FMT_EXPORT 2023-05-17 07:38:06 -07:00
Victor Zverovich
616a493786 Revert Char* formatter removal 2023-05-17 06:11:11 -07:00
Victor Zverovich
552c43aba9 Improve long formatters 2023-05-14 07:07:36 -07:00
Victor Zverovich
d6846f4ac8 Clarify why byte formatter is in core 2023-05-13 08:04:53 -07:00
Victor Zverovich
aeedac5884 Remove unneeded specialization 2023-05-13 07:46:47 -07:00
Victor Zverovich
697e76ba30 Don't call init_named_args unnecessarily 2023-05-12 11:53:22 -07:00