3340 Commits

Author SHA1 Message Date
Victor Zverovich
4eed488c66 Cleanup base API 2024-09-02 07:17:21 -07:00
Victor Zverovich
a6ecd25b80 Improve debug codegen 2024-09-02 06:54:45 -07:00
Victor Zverovich
9f29345ea0 Simplify mapped_type_constant 2024-09-02 06:41:44 -07:00
Victor Zverovich
4986b4c0ef Simplify arg_mapper 2024-09-01 21:59:39 -07:00
Victor Zverovich
a5f4d9820c Simplify arg_mapper 2024-09-01 21:47:41 -07:00
Victor Zverovich
bc3af51272 Reduce the number of instantiations 2024-09-01 19:54:09 -07:00
Victor Zverovich
60740b7c24 Cleanup base API 2024-09-01 19:35:00 -07:00
Victor Zverovich
9ef160d309 Cleanup base API 2024-09-01 19:02:47 -07:00
Victor Zverovich
0b80978c27 Cleanup base API 2024-09-01 18:31:41 -07:00
Victor Zverovich
4f39d88650 Cleanup base API 2024-09-01 18:24:24 -07:00
Victor Zverovich
a86b1acf6a Add mapped_t 2024-09-01 17:48:29 -07:00
Victor Zverovich
c9ef07bc4e Minor cleanup 2024-09-01 17:34:47 -07:00
Victor Zverovich
8c4cfab57a Detemplatize parse 2024-09-01 14:32:55 -07:00
Victor Zverovich
7e3aa6d982 Minor cleanup 2024-09-01 14:17:38 -07:00
Victor Zverovich
7c66216008 Minor cleanup 2024-09-01 12:53:09 -07:00
Victor Zverovich
1416edabbb Cleanup base API 2024-09-01 12:06:40 -07:00
Victor Zverovich
b310a0d48b Simplify parse_format_string 2024-09-01 11:09:26 -07:00
Victor Zverovich
985c3399d1 Make map static 2024-09-01 09:18:47 -07:00
Victor Zverovich
4a55b0d5fd Remove duplicate error in compile-time checks 2024-09-01 09:03:34 -07:00
Victor Zverovich
64a6c84592 basic_format_parse_context -> parse_context 2024-09-01 08:09:37 -07:00
Victor Zverovich
66920feeee Improve compile-time checks 2024-09-01 07:49:35 -07:00
Victor Zverovich
f4dad85c3a Improve handling of named arguments in compile-time checks 2024-09-01 07:07:14 -07:00
Victor Zverovich
db4becabed Reduce template instantiations 2024-08-31 20:29:58 -07:00
Victor Zverovich
fec2cc7af1 Improve handling of named arguments 2024-08-31 19:55:04 -07:00
Victor Zverovich
621e9c17c5 Clarify why we have TYPE in native_formatter 2024-08-31 17:50:21 -07:00
Victor Zverovich
bca7040556 Simplify compile-time checks 2024-08-31 15:01:25 -07:00
Victor Zverovich
8c4b17fe64 Simplify compile-time checks 2024-08-31 14:49:59 -07:00
Victor Zverovich
516a2e2049 Cleanup FMT_STRING 2024-08-31 14:13:57 -07:00
Victor Zverovich
6797f0c39a Cleanup compile-time checks 2024-08-31 11:26:27 -07:00
Victor Zverovich
db496b47c1 Remove old gcc hack 2024-08-31 09:22:49 -07:00
Victor Zverovich
8eda3c8e90 Cleanup compile-time check 2024-08-31 08:38:53 -07:00
Victor Zverovich
53316903e6 Move string_literal to format.h 2024-08-31 07:08:35 -07:00
Victor Zverovich
8a484ad577 Minor cleanup 2024-08-30 20:53:54 -07:00
Victor Zverovich
b446cc9e67 fwrite_fully -> fwrite_all 2024-08-30 18:43:56 -07:00
Victor Zverovich
0204dd359d Fix _BitInt formatter 2024-08-30 18:30:20 -07:00
Victor Zverovich
d8876b7787 Minor cleanup 2024-08-30 16:17:07 -07:00
Victor Zverovich
c0fab5e2f7 Reject modernity, embrace tradition 2024-08-30 11:26:29 -07:00
Victor Zverovich
64313e915c Move redundant initialization to compile time 2024-08-30 10:51:35 -07:00
Victor Zverovich
8e3da9da2c Improve binary size 2024-08-30 10:27:03 -07:00
Victor Zverovich
2a2f73f7c1 Improve binary size 2024-08-29 19:16:54 -07:00
Victor Zverovich
6dd9194abd Simplify format_to_result 2024-08-29 18:35:42 -07:00
Victor Zverovich
a017bba062 Minor cleanup 2024-08-29 18:22:09 -07:00
Victor Zverovich
5eb023cd56 Improve binary size 2024-08-29 17:31:30 -07:00
Victor Zverovich
f213d83306 Disable locale more 2024-08-29 16:35:15 -07:00
Victor Zverovich
b3ccc2d210 Disable locale more 2024-08-29 15:08:43 -07:00
Victor Zverovich
7477dda28d Simplify is_utf8_enabled 2024-08-29 14:39:26 -07:00
Victor Zverovich
e582d377c2 Simplify locale handling 2024-08-29 14:19:33 -07:00
Victor Zverovich
cd8d01d8cd Minor cleanup 2024-08-29 11:41:43 -07:00
Victor Zverovich
377cf203e3 Add opt out for built-in types 2024-08-29 11:21:29 -07:00
Justin Riddell
5a0a37340c
Add support for _BitInt on clang (#4072)
Issue #4007
Make _BitInt up to 128bits formattable
Note, libstdc++ is_signed doesn't work with _BitInt (so use own)
2024-08-28 18:57:52 -07:00
torsten48
bbf8b3bd01
insert else branch to avoid unreachable code warning (#4130)
at least MSC caused warning C4702: unreachable code
2024-08-28 16:43:12 -07:00
Justin Riddell
a3f3f2ec9a
Fix gcc 8.1 - 8.3 bug and compilation (#4131)
Fixes issue #4129
2024-08-28 11:25:39 -07:00
Maxwell
e3676ca309
Change std::copy to detail::copy in chrono to fix MSVC compile errors (#4132) 2024-08-28 08:25:40 -07:00
Victor Zverovich
0379bf3a5d Workaround -Wstringop-overflow 2024-08-24 07:56:09 -07:00
Anthony VH
c59ee969f3
Improve compile-time formatting (#4127) 2024-08-21 12:02:47 -07:00
Victor Zverovich
1a79bbfa83 Cleanup chrono formatting 2024-08-18 12:17:45 -07:00
Victor Zverovich
89af1ad77d Cleanup chrono formatting 2024-08-18 11:55:33 -07:00
Victor Zverovich
0e741e0daa Minor cleanup 2024-08-18 10:35:01 -07:00
Victor Zverovich
d1acc667c1 Minor cleanup 2024-08-18 09:33:29 -07:00
Victor Zverovich
4fb7008c90 Cleanup duration cast 2024-08-18 08:33:26 -07:00
Victor Zverovich
94b8bc8eae Add an experimental writer API 2024-08-17 09:54:09 -07:00
Victor Zverovich
020af729dd Simplify ostream 2024-08-17 08:38:10 -07:00
Victor Zverovich
3135421257 Minor cleanup 2024-08-12 07:59:42 -07:00
Victor Zverovich
993f56cff6 Make sign a proper enum class 2024-08-11 13:49:57 -07:00
Victor Zverovich
c6c830e203 Make align a proper enum class 2024-08-11 11:07:18 -07:00
Victor Zverovich
b906c321f0 Get rid of bit fields 2024-08-11 10:28:09 -07:00
Victor Zverovich
f8c0c8ee78 Cleanup public API 2024-08-11 07:29:17 -07:00
Victor Zverovich
50a8c3e9bf Reduce format specs size 2024-08-10 09:34:35 -07:00
Victor Zverovich
98314319ad Fix ambiguous overload 2024-08-09 15:01:40 -07:00
Victor Zverovich
bf870ae3d1 Fix back_inserter lookup for non-std containers 2024-08-09 07:10:15 -07:00
Hugo Sales
9f0c0c468b
Add 'n' specifier for tuple and pair (#4107) 2024-08-05 14:56:44 -07:00
Victor Zverovich
9f269062a7 Simplify default formatter 2024-08-05 14:24:07 -07:00
Victor Zverovich
15f939c3de Improve handling of dynamic specs 2024-08-04 09:25:50 -07:00
Victor Zverovich
928a07bb04 Simplify handling of dynamic specs 2024-08-04 09:09:01 -07:00
Victor Zverovich
7891699737 Simplify handling of dynamic specs 2024-08-04 08:47:07 -07:00
Vladislav Shchapov
5ee14d3508
Reintroduce constexpr fmt::formatted_size for C++20 (#4103)
* Reintroduce constexpr fmt::formatted_size for C++20

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

* Disable constexpr fmt::formatted_size on Visual Studio 2019

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

---------

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-08-03 07:13:32 -07:00
Victor Zverovich
b9c0e4dd82 Improve spec parsing 2024-08-02 11:57:02 -07:00
Victor Zverovich
8445327c84 Simplify spec handling 2024-08-01 19:59:21 -07:00
Victor Zverovich
8a06cee826 Optimize shortest float formatting 2024-08-01 18:54:56 -07:00
Victor Zverovich
1db2274966 Use us if Unicode is disabled 2024-08-01 10:24:43 -07:00
Vladislav Shchapov
d326c7298a
Fix conversion a surrogate pair (#4095)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-07-30 07:27:11 -07:00
Victor Zverovich
6e462b89aa Get rid of std::copy 2024-07-29 15:58:05 -07:00
Vladislav Shchapov
aff640c32f
Make fmt::appender implement std::output_iterator concept (#4093)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-07-29 09:18:20 -07:00
Victor Zverovich
e23fb6a8b4 Apply clang-format 2024-07-29 08:20:58 -07:00
Victor Zverovich
16b3542f7e Remove float_specs 2024-07-27 12:28:21 -07:00
Victor Zverovich
29d7e58059 Remove float_format 2024-07-27 12:07:19 -07:00
Victor Zverovich
919f7c5e7f Reduce float_specs usage 2024-07-27 11:38:55 -07:00
Victor Zverovich
a80d668a52 Diagnose invalid precision 2024-07-27 10:41:54 -07:00
Victor Zverovich
707d7d923a Apply coding conventions 2024-07-27 09:00:25 -07:00
Victor Zverovich
ffdc3fdbd9 Align digits table 2024-07-24 18:43:37 -07:00
Cameron Angus
31b3c325f6
Mark namespace scope constexpr variable 'buffer_size' inline. (#4084)
* Mark namespace scope constexpr variable 'buffer_size' inline.

* Use provided macro for inline variable.
2024-07-24 09:58:38 -07:00
Victor Zverovich
0b0b09f401 Constrain format_uint 2024-07-23 06:30:35 -07:00
Victor Zverovich
4173a6315a Improve format_decimal 2024-07-22 17:24:56 -07:00
Victor Zverovich
4239dfe081 Simplify format_decimal 2024-07-22 17:00:16 -07:00
Victor Zverovich
ba36a04811 Remove counting_iterator 2024-07-22 16:24:13 -07:00
Victor Zverovich
f6b4a23b83 Unbloat chrono 2024-07-22 15:46:58 -07:00
Victor Zverovich
7f157dca0a Workaround gcc stringop-overflow bug 2024-07-22 11:31:35 -07:00
Victor Zverovich
524ca1c715 Improve parsing 2024-07-21 09:57:18 -07:00
Victor Zverovich
bdc45eef76 Simplify on_text 2024-07-21 08:31:03 -07:00
Victor Zverovich
439b6d7212 Reenable print optimization 2024-07-21 08:05:07 -07:00
Victor Zverovich
3cc32fdc8b Mark more formatters nonlocking 2024-07-21 08:00:34 -07:00
Victor Zverovich
e84297f255 Bump version 2024-07-20 07:00:12 -07:00
Victor Zverovich
de684ef776 Make appender compatible with fill 2024-07-19 15:21:57 -07:00
Victor Zverovich
0f87d6ffa6 Improve sign processing 2024-07-17 16:13:27 -07:00
Victor Zverovich
9228f349a5 Inline visit 2024-07-14 15:34:53 -07:00
Victor Zverovich
f29a7e7970 Don't use memcpy in append 2024-07-14 13:02:21 -07:00
Victor Zverovich
f97deb0d7d Minor cleanup 2024-07-14 11:14:49 -07:00
Victor Zverovich
3541353512 Apply minor optimization 2024-07-14 09:52:44 -07:00
Justin Riddell
5ef93a9f80
Expand FMT_FORMAT_AS to include implicit conversions (#4055)
Allows (for example) types convertible to std::string_view to inherit
from the fmt::formatter<fmt::string_view> to work etc.
2024-07-14 09:51:49 -07:00
Victor Zverovich
c9102619da Avoid extra reserve 2024-07-14 08:41:35 -07:00
Victor Zverovich
58d792b6d3 Apply minor optimizations 2024-07-14 07:05:18 -07:00
Victor Zverovich
25adca5666 Remove redundant overload 2024-07-13 13:07:57 -07:00
Victor Zverovich
1408f1824d Simplify iterator detection 2024-07-13 11:11:47 -07:00
Tor Shepherd
3fe4641d3a
Add 2 more constexprs to fix compile error (#4065) 2024-07-13 08:23:49 -07:00
Victor Zverovich
33e7ed1eb5 Improve handling of back_insert_iterator that writes into a buffer 2024-07-13 07:56:11 -07:00
Justin Riddell
13038f37e8
Support printing (const) volatile void* (#4056)
Fixes #4049
2024-07-10 08:35:06 -07:00
Justin Riddell
e60ff504ea
Fix usage with std::generator (#4057)
Fixes #4053
2024-07-09 08:46:34 -07:00
Victor Zverovich
92227c77a4 Improve support for non-POSIX platforms more 2024-07-08 14:00:00 -07:00
Victor Zverovich
486838f26f Improve support for non-POSIX platforms 2024-07-08 11:18:44 -07:00
Victor Zverovich
7a8b54a0ef Don't confuse Glib::ustring with std::string 2024-07-06 13:27:06 -07:00
Vladislav Shchapov
a96259701e
Improve std::complex formatter (#4050)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-07-04 17:24:01 -07:00
Victor Zverovich
503e183b9e Bump version and add version validation 2024-07-04 07:49:58 -07:00
toge
9d946a2fc4
Fix compilation errors due to make_format_args in gcc 14.1.1 with c++20 (#4042) 2024-07-03 12:41:08 -07:00
Nebojša Cvetković
c4f6fa7135
fix: Make basic_format_arg::visit() const (#4043) 2024-07-01 14:43:52 -07:00
Vladislav Shchapov
24c1f886af
Remove double has_value check (#4040)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-07-01 09:24:33 -07:00
Victor Zverovich
686339f7c1 Minor cleanup 2024-06-30 10:29:50 -07:00
Victor Zverovich
53186535d5 Bump version 2024-06-29 08:54:52 -07:00
Victor Zverovich
7f951f2502 Optimize range formatter 2024-06-23 06:51:46 -07:00
Dix Lorenz
7ae102bd66
make format_int constexpr (#4032)
* make format_int constexpr

* format_int can only be constexpr in C++20

* apply clang-format

* drop constexpr for str()
2024-06-23 06:28:39 -07:00
Victor Zverovich
b1efe8516e Prevent silent data loss 2024-06-22 07:46:16 -07:00
Matt Stafford
2c0d9e9409 Add a define to force the use of fallback_file 2024-06-21 09:42:02 -07:00
Victor Zverovich
18a9676d95 Add an experimental path 2024-06-21 08:14:20 -07:00
Vladislav Shchapov
514b6955d2
Suppress a bogus warning in MSVC (#4023)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-06-19 08:49:43 -07:00
Matthias Moulin
ac96773230
Added missing std::declval for non-default-constructible types (#4024) 2024-06-18 11:27:40 -07:00
Victor Zverovich
c00149f5e2 Fix a typo 2024-06-17 06:58:33 -07:00
Victor Zverovich
71244e07de Cleanup includes 2024-06-16 11:10:38 -07:00
Victor Zverovich
febd8ed5fe Cleanup includes 2024-06-16 10:59:06 -07:00
Victor Zverovich
2a2048a785 Don't pass seconds as a double in examples 2024-06-15 09:26:49 -07:00
LoveSy
8687315e86
Guard more system headers by FMT_MODULE (#4006)
* Guard more system headers by `FMT_MODULE`

* Merge FMT_MODULE and FMT_IMPORT_STD
2024-06-14 10:53:51 -07:00
Victor Zverovich
e0b66e8f83 Remove dependency on <ranges> 2024-06-13 15:57:01 -07:00
Matthias Moulin
794df69c8c
Added range_format::(debug_)string formatter (#3973) 2024-06-13 15:43:29 -07:00
Victor Zverovich
1d9df9ce1c Remove a redundant comment 2024-06-13 15:41:35 -07:00
LoveSy
fad0222a0c
Export compiled_string so that user can customize one (#3999) 2024-06-09 10:58:58 -07:00
LoveSy
2bf811b1d9
Also allow compiled format for clang >= 12 (#4001) 2024-06-09 06:43:39 -07:00
LoveSy
0f6e716548
Fix missing includes in fmt.cc (#3994)
This causes duplicated std definitions in the fmt module
2024-06-08 13:50:29 -07:00
Victor Zverovich
7bd11b5cdf Remove a redundant extension to reduce divergence from std::format 2024-06-08 08:29:34 -07:00
LoveSy
94f96d112d Fix undefined reference when compiling with FMT_STATIC_THOUSANDS_SEPARATOR and chrono.h 2024-06-05 21:01:42 -07:00
LoveSy
a9b8517638 Use native c++ module support from CMake
also fix some clang compilation issues when using c++ modules
2024-06-05 21:01:42 -07:00
Victor Zverovich
9b12491c19 Migrate docs 2024-06-02 14:20:41 -07:00
Victor Zverovich
ab29ef37d9 Migrate docs and cleanup 2024-06-02 13:17:04 -07:00
Victor Zverovich
97117cbb51 Migrate to mkdocs 2024-06-02 12:21:11 -07:00
Victor Zverovich
38ba3d3993 Migrate to mkdocs 2024-06-02 08:26:56 -07:00
Victor Zverovich
0714113974 Add macro support to api doc extraction 2024-06-02 08:06:52 -07:00
Victor Zverovich
03d14c3beb Add support for multiple namespaces 2024-06-02 07:01:40 -07:00
Victor Zverovich
a10e032148 Improve docs 2024-06-01 20:08:41 -07:00
Victor Zverovich
febeb51bde Documentation improvements 2024-06-01 17:45:06 -07:00
Victor Zverovich
933d8ba352 Improve apidoc formatting 2024-06-01 09:24:32 -07:00
Victor Zverovich
91a859ee4a Switch to markdown 2024-06-01 08:56:26 -07:00
Victor Zverovich
a4d42c44f4 Cleanup comments 2024-06-01 07:00:56 -07:00
Eric Bryant
fcd3e1e19c
is_convertible_v -> is_convertible::value (#3983) 2024-05-31 10:02:59 -07:00
ZaheenJ
ca8eeb09ee
Add glibc ext for day of month and week of year (#3976) 2024-05-30 10:20:56 -07:00
Victor Zverovich
cf9833f40b Cleanup apidoc comments 2024-05-29 20:30:19 -07:00
Victor Zverovich
33eba1049d
Minor comment fix 2024-05-28 11:39:49 -07:00
Matthias Moulin
43ab964c47
MSVC 17.10.0 + modules cannot find definition (#3972)
MSVC regressed since the new 17.10.0 compiler update. node<> cannot be found for detail::dynamic_arg_list::typed_node.
2024-05-28 11:34:44 -07:00
Matthias Moulin
728f9bc388
Added std::type_info formatter (#3978)
* Added std::type_info formatter;
* Reused std::type_info formatter in std::exception formatters;
* Updated MSVC std::type_info outputting to exclude all class, struct and enum occurences.
2024-05-28 10:57:08 -07:00
Matthias Moulin
1752d7fbbb
Added formattable concept (#3974) 2024-05-26 07:47:56 -07:00
Matthias Moulin
1768bf9714
Added FMT_EXPORT for fmt::range_format and fmt::range_format_kind (#3970) 2024-05-24 07:08:07 -07:00
Justin Riddell
fc723fd6c7
Fix regression in #3710 (#3968)
Regression introduced in 11f2f30
Already have a test for this, but needed to make __cpp_lib_ranges
smaller to enable it
2024-05-23 12:39:11 -07:00
Justin Riddell
b81761068b
Check range_begin is dereferenceable (#3964)
Fixes issue #3839
An Eigen 3.4 2x2 matrix has a begin member function that returns void
Be more strict checking that the result of calling *begin() is valid
See input_or_output_iterator concept notes about void
2024-05-20 16:11:07 -07:00
Matthias Moulin
706eabd5e5
Resolved warning C4127: conditional expression is constant (#3967) 2024-05-20 11:59:19 -07:00
Edoardo Lolletti
028bffa083
Update checks for dynamic_cast usage when compiled with no rtti (#3963)
* Rename FMT_USE_TYPEID to FMT_HAS_RTTI and use it as check to enable dynamic_cast usage

* FMT_HAS_RTTI->FMT_USE_RTTI
2024-05-19 11:21:55 -07:00
Victor Zverovich
75e892420e Minor cleanup 2024-05-16 10:45:23 -07:00
Justin Riddell
8e728044f6
Fix format_as for non-const begin/end views (#3955)
base::format does not accept rvalues, using the result of format_as
directly means it is passed one. Doesn't matter for ranges with a const
begin and end, but filter_view caches, so it only has mutable begin/end.
Use auto&& to avoid copy if format_as returns const ref
2024-05-13 09:35:55 -07:00
Victor Zverovich
1f436c646e Cleanup locking/buffering 2024-05-12 09:34:17 -07:00
Victor Zverovich
db1ee420e0 Cleanup unicode check more 2024-05-11 20:02:22 -07:00
Victor Zverovich
7d6ae972b9 Cleanup unicode checks 2024-05-11 19:43:46 -07:00
Victor Zverovich
3460b30fd5 Improve utf-8 detection 2024-05-11 18:58:40 -07:00
Victor Zverovich
b7809f91e2 Enable Unicode support by default 2024-05-11 15:11:23 -07:00
Victor Zverovich
1dc71f21ea Enable Unicode by default 2024-05-10 18:27:45 -07:00
Victor Zverovich
8db8f22490 Optimize join_view 2024-05-09 17:26:26 -07:00
Victor Zverovich
d2473b7b73 Simplify join_view formatter 2024-05-08 15:42:49 -07:00
Victor Zverovich
328d256c60 Apply coding conventions 2024-05-06 15:10:29 -07:00
Victor Zverovich
57593a123b Simplify map formatter 2024-05-06 15:09:31 -07:00
Justin Riddell
10508a30ec
Enable fmt::join for uncopyable iterators (#3946)
If iterator not copyable mutate the underlying iterator
Notably std::ranges::basic_istream_view::__iterator
Addresses issue (#3802)
2024-05-05 15:44:23 -07:00
Victor Zverovich
16cec4f591 Make the map formatter correctly handle elements with custom formatters 2024-05-04 10:59:16 -07:00
Victor Zverovich
77bfd8499a Split range and map formatters 2024-05-04 09:41:02 -07:00
Victor Zverovich
3af8ac7a06 Privatize write_debug_string 2024-05-04 07:38:58 -07:00
Victor Zverovich
ceb406d06c Remove range_default_formatter 2024-05-04 07:20:40 -07:00
Victor Zverovich
7650ed04a3 Fix to_nonnegative_int 2024-05-03 07:49:16 -07:00
Alex Dewar
8a8f4825a3 Fix: isnan() shouldn't cause FP exceptions
Fixes #3948.
2024-05-02 09:36:21 -07:00
Marlene Cota
48c908453d
Fix CodeQL alert (#3945) 2024-04-30 12:41:29 -07:00
Diego Ramírez
cf1f55f798
Specialize formatter for all std::basic_string types (#3943)
* Specialize `formatter` for all `std::basic_string` types

* mock-allocator: add member types to make GCC 4.8 happy
2024-04-23 08:44:41 -07:00
Victor Zverovich
400f6a8ee2 Dedup ADL begin/end lookup 2024-04-22 16:09:07 -07:00
Jiwoo Park
f4b256c667 Fix warning C26439 2024-04-19 09:06:46 -07:00
Victor Zverovich
f746a59a5c Cleanup FMT_ASSERT 2024-04-19 08:36:16 -07:00
Hans-Martin B. Jensen
ee0c3351a4
Fix format_to + FMT_STRING for wide character type (#3931)
Added overload that takes a wformat_string.
Fixes issue #3925.
2024-04-17 08:30:48 -07:00
Justin Riddell
99735764ea
Fix FMT_USE_NONTYPE_TEMPLATE_ARGS define back (#3937)
Broken in refactor f1924d3
2024-04-16 13:29:30 -07:00
Matthias Moulin
116a9ce488
Added FMT_IMPORT_STD feature macro (#3928) 2024-04-10 11:48:32 -07:00
ShifftC
5eb68c0ef2
Fix mix-up of 'FMT_BEGIN_EXPORT' and 'namespace detail'. (#3924) 2024-04-08 09:46:20 -07:00
Matthias Moulin
550437b29e
Resolved warning C4127: conditional expression is constant (#3923) 2024-04-07 11:01:26 -07:00
Philippe Proulx
4e8640ed90
Fix: enable FMT_NORETURN without exception support too (#3917)
When building `format.cc` as such with GCC 13.2.1:

    $ g++ -c format.cc -DFMT_EXCEPTIONS=0 -Wmissing-noreturn -Werror

I get:

    In file included from format.cc:8:
    fmt/format-inl.h: In function ‘void fmt::v10::detail::assert_fail(const char*, int, const char*)’:
    fmt/format-inl.h:30:15: error: function might be candidate for attribute ‘noreturn’ [-Werror=suggest-attribute=noreturn]
       30 | FMT_FUNC void assert_fail(const char* file, int line, const char* message) {
          |               ^~~~~~~~~~~
    fmt/format-inl.h: In function ‘void fmt::v10::report_error(const char*)’:
    fmt/format-inl.h:129:15: error: function might be candidate for attribute ‘noreturn’ [-Werror=suggest-attribute=noreturn]
      129 | FMT_FUNC void report_error(const char* message) {
          |               ^~~~~~~~~~~~
    cc1plus: all warnings being treated as errors

Note that, with `FMT_EXCEPTIONS` defined to 0:

‣ report_error(const char *) uses FMT_THROW() which expands to calling
  assert_fail().

‣ assert_fail() calls std::terminate() which has the `[[noreturn]]`
  attribute since C++11 [1].

Therefore, with `FMT_EXCEPTIONS` defined to 0, both assert_fail() and
report_error() need to have the `[[noreturn]]` attribute too (if
available). In other words, `FMT_NORETURN` doesn't depend on
`FMT_EXCEPTIONS`.

Also adding `FMT_NORETURN` to two on_error() functions which call
report_error(const char *).

Other report_error() overloads eventually return, therefore they don't
need `FMT_NORETURN`.

[1]: https://en.cppreference.com/w/cpp/error/terminate

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
2024-04-04 17:15:18 -07:00
Victor Zverovich
c70e7b7473 Coding conventions and minor fixes 2024-04-05 08:36:45 +09:00
zivshek
71144eeaff
implement year_month_day (#3913)
* implement year_month_day, also changed weekday, day, month, year's formatter to use formatter<std::tm, Char> so they all support the format strings
* support ":L" for month and weekday
2024-04-03 15:35:53 -07:00
Vladislav Shchapov
ca9193983b
Replace std::fill_n with fmt::detail::fill_n (#3909)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-03-28 17:26:18 -07:00
zivshek
74a187288b
Implemented fmt::day, fmt::month, fmt::year and related unit tests (#3906) 2024-03-27 17:10:30 -07:00
Victor Zverovich
5d63e87d23 Add a formatter for float128 2024-03-22 15:41:50 +09:00
Victor Zverovich
aecec01b34 Initial support for extended FP types 2024-03-22 15:08:25 +09:00
Victor Zverovich
5af88653eb Cleanup 2024-03-22 13:46:03 +09:00
Vladislav Shchapov
45b772f85c
Improve std::complex formatter to be compatible with P2197R0 (#3900)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-03-20 13:31:32 -07:00
Victor Zverovich
53347891cf Make line buffering test less flaky 2024-03-20 16:45:50 +09:00
Vladislav Shchapov
6c7cc6a06f
Fix group_digits for negative integers (#3901)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-03-19 13:03:57 -07:00
Victor Zverovich
c0dac83982 Use p2197 format for complex by default 2024-03-19 07:55:45 +09:00
Victor Zverovich
bb882c03bc Simplify path formatting 2024-03-19 07:47:42 +09:00
Vladislav Shchapov
12acd7988b Fix ambiguous call
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-03-17 17:16:53 -07:00
Vladislav Shchapov
73f2b344b2 Add std::complex formatter
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-03-17 15:26:18 -07:00
Vladislav Shchapov
9f3fc6e38b Add XChar support into nested_formatter
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-03-17 15:26:18 -07:00
Victor Zverovich
e281749c5d Simplify range formatter 2024-03-10 08:19:26 -07:00
Victor Zverovich
11f2f30f0b Simplify range formatter 2024-03-09 08:23:12 -08:00
mtillmann0
13cfaa2ab0
Guard against usage of _isatty when header was not included (#3880)
* Guard against usage of _isatty when header was not included

* Rename FMT_WINDOWS_NO_WCHAR macro to FMT_USE_WRITE_CONSOLE
2024-03-08 13:34:46 -08:00
js324
0861db500f
Support character range formatting (#3863) 2024-03-07 10:51:46 -08:00
Victor Zverovich
3bc6cc1e63 Protect against locking formatters 2024-03-02 17:23:02 -08:00
Baardi
ae1e93d34d
Fix warning C4702 emitted from format.h (MSVC) (#3866) 2024-02-28 07:47:13 -08:00
Victor Zverovich
f68f452dea Workaround an ld warning on macOS 2024-02-25 11:41:52 -08:00
Gao Mingfei
ebea5736a2
Fix chrono locale format bug for RHEL gcc (#3859) 2024-02-25 07:09:33 -08:00
Baardi
ddf0b7d2b5
Fix warning C4365 emitted from printf.h (#3865) 2024-02-23 16:33:21 -08:00
prlw1
0166f455f6
std.h c++23 build fix (#3856)
Add ::value to is_formattable<...> as per suggestion by @vitaut in
https://github.com/fmtlib/fmt/issues/3854
2024-02-19 10:19:39 -08:00
Victor Zverovich
8e42eef495 Don't error on min time_point 2024-02-10 17:50:42 -08:00
Victor Zverovich
44c3fe1ebb Fix handling of static separator 2024-02-09 15:58:56 -08:00
Anders Dalvander
ae181cc93d
C++23 compatibility: basic_string_view cannot be constructed from nullptr (#3846)
Co-authored-by: Anders Dalvander <anders.dalvander@sartorius.com>
2024-02-09 07:39:43 -08:00
Bruce Mitchener
3a6fb2fcaf
Fix some typos. (#3843) 2024-02-08 10:59:52 -08:00
Bruce Mitchener
0879504796
Fix typo in typename. containter_type -> container_type. (#3844) 2024-02-08 06:24:55 -08:00
js324
34f415b56e
Fix %S formatting for chrono durations with leading zeroes (#3814) 2024-02-07 09:47:32 -08:00
Victor Zverovich
06311ed1ce Fix fixed rounding around zero in Dragon 2024-02-03 10:13:58 -08:00
Dominic Pöschko
e5bab8dab4
added formatter for std::expected (#3834) 2024-02-03 09:06:15 -08:00
Victor Zverovich
6321a97d6b Simplify color formatting 2024-01-31 18:30:23 -08:00
Victor Zverovich
4b6b32f388 Deprecate wide stream function 2024-01-31 18:10:52 -08:00
Afanasyev Ivan
1b54ba4b9d
Fix UB in format_arg_store implementation. (#3833) 2024-01-31 10:08:29 -08:00
Frank Richter
71a4a8d479
Really fix MSVC warning about <bit> only being available in C++20. (#3832)
* Really fix MSVC warning about <bit> only being available in C++20.

The warning states "The contents of <bit> are available only with C++20 or later.",
but the check was for C++17 and later.

* Change <bit> inclusion check per https://github.com/fmtlib/fmt/pull/3832#discussion_r1471144867
2024-01-30 10:42:35 -08:00
Victor Zverovich
8e62172ab6 Fix a warning 2024-01-29 07:48:48 -08:00
Victor Zverovich
28afff363c Improve buffering 2024-01-27 16:20:34 -08:00
Victor Zverovich
af44c29744 Separate buffer initialization from flush 2024-01-27 15:39:36 -08:00
Victor Zverovich
a1e1eedbb5 Minor cleanup 2024-01-27 14:00:13 -08:00
Victor Zverovich
ffce3632b7 Add glibc stream support 2024-01-27 11:00:45 -08:00
Victor Zverovich
6435b169ec Add support for line buffering 2024-01-27 08:57:21 -08:00
Beat Bolli
e1832bcf00
Consider ADL begin() and end() when joining ranges (#3824)
Closes #3813

Signed-off-by: Beat Bolli <dev@drbeat.li>
2024-01-22 07:39:33 -08:00
Edoardo Lolletti
06fc25f266
Don't always enable typeid usage under msvc (#3821) 2024-01-21 06:28:22 -08:00
Victor Zverovich
11ba1270ab Fix flush 2024-01-20 07:58:56 -08:00
Victor Zverovich
4c5b4af04d Improve name argument validation 2024-01-19 16:13:43 -08:00
Victor Zverovich
6b68dff901 Write directly to a stream buffer 2024-01-18 16:27:12 -08:00
Victor Zverovich
b2cde48de5 Reduce usage of float_specs 2024-01-17 08:27:03 -08:00
Victor Zverovich
8510838db1 Make format_specs not depend on code unit type 2024-01-17 07:50:52 -08:00
Victor Zverovich
090ee13595 Pass char type to write 2024-01-17 06:07:29 -08:00
Vladislav Shchapov
470c4e6ca8
Fix scope for glibc ext for sec, min, and hour (#3812)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-01-16 13:54:19 -08:00
The Phantom Derpstorm
13ec66bf78
🛠 Add basic array safety functions and backwards-compatible result type (#3805) 2024-01-16 07:01:15 -08:00
Victor Zverovich
64091b7a25 Fix naming 2024-01-15 15:17:46 -08:00
Victor Zverovich
e954823531 Make fill independent on code unit type 2024-01-15 15:00:28 -08:00
Victor Zverovich
83652dfee7 Restrict always inlining to the top-level API 2024-01-15 10:09:01 -08:00
Bruce Mitchener
73d91351b4
Mark iterator_buffer move constructors as noexcept. (#3808) 2024-01-15 08:46:35 -08:00
Victor Zverovich
fe0d910a7d Replace multiple error reporting mechanisms with report_error 2024-01-15 07:23:06 -08:00
Victor Zverovich
f9294f0e60 Improve handling of format specs 2024-01-15 06:31:24 -08:00
Victor Zverovich
c98a5a599f Remove unnecessary checks 2024-01-14 17:41:49 -08:00
Victor Zverovich
d70729215f Fix constness 2024-01-14 06:44:38 -08:00
Victor Zverovich
56fa4d61f6 Fix docs 2024-01-13 19:03:23 -08:00
Victor Zverovich
cacdf1439f Remove nonstandard alias 2024-01-13 15:56:16 -08:00
Victor Zverovich
4d766b1670 Invert dependencies 2024-01-13 10:30:44 -08:00
Victor Zverovich
c10859f15c Remove deprecated options 2024-01-13 10:25:11 -08:00
Victor Zverovich
d0963d4823 Make ranges only depend on fmt/base.h 2024-01-13 09:54:19 -08:00
Victor Zverovich
da0f84c42c Cleanup copy functions and move to base.h 2024-01-13 09:31:20 -08:00
Victor Zverovich
59baac522e Remove unused functions 2024-01-13 09:03:35 -08:00
Vladislav Shchapov
21b0458291
Use std::allocator_traits (#3804)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-01-13 08:48:37 -08:00
Vladislav Shchapov
df6a3564b0
Fix MSVC warning: "The contents of <bit> are available only with C++20 or later." (#3807)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-01-13 08:26:44 -08:00
Hans-Martin B. Jensen
7c163acfda
Fix conversion warning in filesystem::path formatter (#3806)
* Fix conversion warning in filesystem::path formatter

Use template character type to eliminate MSVC conversion warning when
formatting a wide chararacter path:

fmt\std.h(140,49): warning C4244: '=': conversion from 'const Char' to 'char', possible loss of data

* Review: use to_ascii instead

---------

Co-authored-by: Hans-Martin B. Jensen <haje@eposaudio.com>
2024-01-13 08:02:31 -08:00
Victor Zverovich
297b22f585 Remove <memory> dependency 2024-01-12 09:09:19 -08:00
Victor Zverovich
3c9608416a Remove redundant detection of experimental string_view 2024-01-12 07:45:07 -08:00
Victor Zverovich
0cdee904a4 Add a missing num_bits specialization 2024-01-12 07:20:12 -08:00
Victor Zverovich
7e58af4eaf Fix an ICE on clang <= 15 2024-01-12 06:48:03 -08:00
Victor Zverovich
f1924d3269 Cleanup macros 2024-01-12 06:35:25 -08:00
Victor Zverovich
52174953bc Cleanup conseval detection 2024-01-12 05:59:22 -08:00
Victor Zverovich
b71d98774b Reduce usage of FMT_COSTEXPR20 2024-01-11 21:27:00 -08:00
Victor Zverovich
810d1750f1 Cleanup constexpr detection 2024-01-11 21:08:01 -08:00
Victor Zverovich
170ffb1ff8 Simplify constexpr checks 2024-01-11 20:26:52 -08:00
Victor Zverovich
e470ba8b7b Simplify exception detection 2024-01-11 19:42:06 -08:00
Victor Zverovich
bf98e3e4c6 Cleanup macros 2024-01-11 19:16:35 -08:00
Victor Zverovich
fd87a23d34 Reduce memory dependency 2024-01-10 20:00:15 -08:00
Victor Zverovich
b71ef65b6e Remove iterator dependency 2024-01-10 18:52:53 -08:00
Victor Zverovich
c5340539f9 Remove unnecessary trait specialization 2024-01-10 18:11:37 -08:00
Victor Zverovich
971f7ae768 Minor cleanup 2024-01-10 16:43:00 -08:00
Victor Zverovich
da7a232b9e Cleanup contexts 2024-01-10 13:09:55 -08:00
Tristan Brindle
2595bf57b3 Fix formatting of ranges with begin()&/end()&
C++20 allows ranges to have lvalue-qualified begin() and end() member functions. fmt correctly handles this if begin() and end() are additionally const-qualifed (i.e. begin() const&), but not in the non-const case. For example:

https://godbolt.org/z/YfxaYz5r7

This patch fixes fmt's range detection to handle this case by testing calls to detail::ranges_begin()/end() with an lvalue T&, matching the behaviour in the const case.
2024-01-10 12:22:53 -08:00
Vladislav Shchapov
6f5d53ce08 Add fmt::is_contiguous<std::basic_string<Char, Traits, Allocator>>
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-01-10 10:47:39 -08:00
Vladislav Shchapov
961df829b9 Fix buffer overflow if output iterator is std::back_insert_iterator and value is escaped (debug format)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-01-10 09:15:16 -08:00
Victor Zverovich
401f087394 Fix write_uintptr_fallback 2024-01-10 09:09:57 -08:00
Victor Zverovich
3d84b45a22
Update core.h 2024-01-10 06:57:22 -08:00
Victor Zverovich
4331abed26 Move fmt::format to fmt/format.h 2024-01-10 06:43:12 -08:00
Victor Zverovich
fc8f6ba934 Separate compilation for println 2024-01-10 05:55:26 -08:00
Victor Zverovich
58a6bd48a8 Add core.h for compatibility 2024-01-09 20:10:30 -08:00
Victor Zverovich
79f1506fe3 Add base.h 2024-01-09 19:36:12 -08:00
Victor Zverovich
4d616479b5 Simplify make_format_args 2024-01-09 19:18:35 -08:00
Victor Zverovich
7ba6420540 Optimize debug codegen 2024-01-09 11:44:57 -08:00
Victor Zverovich
f7ed65fa4a Simplify format_arg_store 2024-01-09 06:29:16 -08:00
Victor Zverovich
f34f31b321 Move format_arg_store to detail 2024-01-08 21:44:56 -08:00
Victor Zverovich
fb66131efa Improve arg storage 2024-01-08 21:25:41 -08:00
Victor Zverovich
6af30d8f75 Remove legacy workaround 2024-01-08 20:13:50 -08:00
Victor Zverovich
c177324ba9 Simplify basic_format_args 2024-01-08 18:42:53 -08:00
Victor Zverovich
545d37a8b0 Remove extra level of indirection when building args 2024-01-08 17:58:07 -08:00
Victor Zverovich
a5ae9ae19d Split standard context into a separate class and optimize 2024-01-08 07:08:49 -08:00
Victor Zverovich
23e8109d8d Remove buffer_appender 2024-01-07 22:03:02 -08:00
Victor Zverovich
679af1f5cc Remove redundant get_container 2024-01-07 19:31:26 -08:00
Victor Zverovich
48d7fb265b Merge back_insert_iterator and appender 2024-01-07 18:43:27 -08:00
Victor Zverovich
f348d1a211 Reintroduce back_insert_iterator detection 2024-01-07 17:44:40 -08:00
Victor Zverovich
df67df7b4c Add is_back_insert_iterator 2024-01-07 16:44:42 -08:00
Victor Zverovich
17f79ac6cf Minor cleanup 2024-01-07 15:04:38 -08:00
Victor Zverovich
dbdfc99fa1 Don't crash if flush fails during unwinding 2024-01-07 14:55:16 -08:00
Victor Zverovich
c1d9e88402 Remove unnecessary final and apply clang-format 2024-01-07 13:08:17 -08:00
Victor Zverovich
7d73ef85f7 Cleanup ranges 2024-01-06 19:37:14 -08:00
Victor Zverovich
ae9b0b521b Disable transitive includes 2024-01-06 15:22:13 -08:00
Victor Zverovich
1b7d9db0ce Remove string dependency 2024-01-06 06:25:34 -08:00
Victor Zverovich
0641b844ac Cleanup string traits 2024-01-05 19:31:04 -08:00
Victor Zverovich
1e938dda20 Simplify char_t 2024-01-05 15:32:59 -08:00
Victor Zverovich
2e5b14bf60 Add compile-time checks to color formatting 2024-01-05 09:51:52 -08:00
Victor Zverovich
e0b604beb1 Remove a redundant function 2024-01-04 15:59:33 -08:00
Victor Zverovich
bee495c97f Remove dead code 2024-01-04 09:40:30 -08:00
Victor Zverovich
794e1b6145 Remove redundant overload 2024-01-04 09:21:19 -08:00
Victor Zverovich
c7061776ab Bump version 2024-01-04 05:50:54 -08:00
Victor Zverovich
dc52d176de Cleanup dependencies 2024-01-03 20:52:45 -08:00
Victor Zverovich
0e3e61cc0a Remove limits dependency 2024-01-03 19:14:30 -08:00
Victor Zverovich
800a0bb23f Remove dependency on string_view 2024-01-03 18:49:45 -08:00
Victor Zverovich
f2e43f967c Remove char_traits dependency 2024-01-03 13:16:28 -08:00
Victor Zverovich
c9287eb9f7 Reduce char_traits usage 2024-01-03 10:02:16 -08:00
Victor Zverovich
61f144bd61 Move copy_str for format.h 2024-01-03 09:05:09 -08:00
Victor Zverovich
4687f8e37e Remove dependency on <iterator> 2024-01-03 08:20:04 -08:00
Victor Zverovich
f2c55f6bb8 Remove dependency on back_insert_iterator 2024-01-03 06:16:00 -08:00
Victor Zverovich
c9d233c0a4 Decouple appender from back_insert_iterator 2024-01-03 06:16:00 -08:00
Victor Zverovich
4e43a46993 Clarify why we can't have nice things 2024-01-02 19:14:32 -08:00
Victor Zverovich
c36ed77ff0 Get rid of addressof 2024-01-02 18:44:27 -08:00
Victor Zverovich
e2ab9ab22b Add FMT_GLIBCXX_RELEASE 2024-01-02 16:15:23 -08:00
Victor Zverovich
0378d171f9 Replace remove_cvref_t with remove_const_t 2024-01-02 12:46:09 -08:00
Victor Zverovich
63ce170853 Replace virtual dispatch with normal functions in buffers 2024-01-02 07:02:20 -08:00
Victor Zverovich
74ffea0dcf Simplify to_ascii 2024-01-01 20:09:47 -08:00
Victor Zverovich
4ec9c2906b Apply coding conventions 2024-01-01 19:04:25 -08:00
Victor Zverovich
f4a7d40dca Dedup throw_format_error 2024-01-01 18:42:23 -08:00
Victor Zverovich
068bf9bad8 Make visitation compatible with std::format 2024-01-01 17:31:36 -08:00
Victor Zverovich
50565f9853 Move misplaced join overloads to fmt/ranges.h 2024-01-01 16:28:59 -08:00
Victor Zverovich
0b39d67103 Remove detail::error_handler 2024-01-01 16:10:13 -08:00
Victor Zverovich
c142385033 Improve the pipe API 2024-01-01 15:55:37 -08:00
Victor Zverovich
b0569451a7 Bump version 2024-01-01 10:06:52 -08:00
Bruce Mitchener
ebd5c8f994
Consistently use fmt:: when invoking format_to. (#3779)
This has been done partially in previous commits:

* 2ac6c5ca8b3dfbcb1cc5cf49a8cc121e3984559c
* 258000064d71a7d228d608a2e3d43bde3e32a658
* ba50c19e827383bd5dacb74189fb4852c8dcbdae
* 5ab9d39253b8bcb85a475dc058955b3916f3410a

A patch that includes the `std::error_code` changes here is
upstream in vcpkg, so that will be able to be removed when
updating to the next release.
2024-01-01 06:57:03 -08:00
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
8c520b4fdc Fix comment 2023-12-29 15:48:25 -08:00
Victor Zverovich
47a0eec2e8 Remove unnecessary alias 2023-12-29 09:59:55 -08:00
Victor Zverovich
d5823aae36 Ceci n'est pas une pipe 2023-12-29 08:11:29 -08:00
Victor Zverovich
47c8f63d02 Remove redundant specifier 2023-12-28 07:32:07 -08:00
Victor Zverovich
df62c86783 Mark grow as deprecated 2023-12-25 10:11:22 -08:00
Victor Zverovich
fc0f84d290 Move formatbuf to ostream.h 2023-12-23 15:00:28 -08:00
Victor Zverovich
86f2ec5de7 Fix a warning 2023-12-23 14:51:43 -08:00
Victor Zverovich
a537c39fdf Move conjunction to where it is used 2023-12-23 14:35:11 -08:00
Victor Zverovich
7c240d52c3 Remove unused symbol 2023-12-23 13:20:55 -08:00
Victor Zverovich
e7875ae0fa Fix formatting of some nested ranges 2023-12-23 09:35:32 -08:00
Victor Zverovich
3eb3aef575 Fix handling of set_debug_format 2023-12-23 08:32:36 -08:00
Vladislav Shchapov
9cd2b87e18
Fix wchar_t to char conversion warnings (#3764)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2023-12-20 08:59:26 -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
Victor Zverovich
afa85e46c3 Apply clang-format 2023-12-17 07:32:22 -08:00
js324
6025bd7c37
Add localized formatting to non-decimal presentation types of ints (#3750) 2023-12-15 07:51:25 -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
Victor Zverovich
bbee753579 Make clang-format happy 2023-12-13 06:54:51 -08:00
Mikael Simberg
89860eb901
Use void(*)(void*) instead of decltype(&std::free) to satisfy clang in CUDA mode (#3751)
clang can't resolve &std::free in decltype(&std::free) because std::free
is overloaded (for host and device).
2023-12-11 09:44:02 -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
Victor Zverovich
9048add999 Report out-of-range errors in chrono 2023-12-10 08:28:50 -08:00
Vladislav Shchapov
6392dba21c
Fix warning: identifier '_a' preceded by whitespace in a literal operator declaration is deprecated (#3748)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2023-12-09 08:16:57 -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
Ivan Shapovalov
71bd51e6c2
Implement %j specifier for std::chrono::duration (#3732)
This adds support for `%j` presentation type for duration types:

> "If the type being formatted is a specialization of duration, the decimal
number of days without padding."

Fixes #3643.
2023-12-03 07:29:58 -08:00
Félix-Antoine Constantin
99b9fbf8ef
Add formatter for std::source_location (#3730) 2023-11-30 10:05:56 -08:00
Victor Zverovich
8f83ee2ad1 Apply coding conventions 2023-11-30 08:24:02 -08:00
Victor Zverovich
2a8a694466 Clarify that mixing code unit types is deprecated 2023-11-30 08:20:01 -08:00
Victor Zverovich
04718008ab Minor cleanup 2023-11-30 07:43:31 -08:00
js324
b87ea22e29
Add native and generic representation for filesystem::path format spec (#3729) 2023-11-29 14:49:36 -08:00
Victor Zverovich
6988be3878 Bump version 2023-11-25 09:11:53 -08:00
Victor Zverovich
2d1e4bb35e Remove a useless comment 2023-11-25 09:05:20 -08:00
Corentin Schreiber
7f8d419115
Fix overflow in time_point formatting with large dates (#3727)
* Fix #3725 and rename fmt_safe_duration_cast to fmt_duration_cast
The function is now more generic and will handle all casts. It also
takes care of toggling safe vs unsafe casts using
FMT_SAFE_DURATION_CAST.

* Refactor fmt_duration_cast to put #ifdef inside the function

* Fix compilation error with FMT_USE_LOCAL_TIME
2023-11-25 08:36:55 -08:00
Victor Zverovich
06f1c0d725 Clarify that calling non-const format is deprecated 2023-11-24 10:21:57 -08:00
Victor Zverovich
8a39388516 Fix the default locale in ostream_formatter 2023-11-24 09:24:43 -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
c13753a70c Fix handling of invalid Unicode in precision 2023-11-18 08:36:11 -10:00
Ole Bøe
864a8b5f38
fix: support optional<T> with format_as(T) (#3713)
Formatting a std::optional<T> where T had a custom format_as(T) function failed to compile with clang,
due to set_debug_format being hidden by private inheritance. This fix makes the function available through a using clause.
2023-11-16 15:02:33 -08:00
Victor Zverovich
649fe0fc8b Fix handling of null strings with the s specifier 2023-11-15 17:03:01 -10:00
Kai Aoki
45e124ee43
Added workaround for old xcode compiler bug (#3716)
* Added macros to disable std::filesystem and std::variant as a workaround for old xcode bugs

* Change macro to positive logic
2023-11-15 09:19:08 -08:00
Victor Zverovich
6b0082e6c7 Improve OpenBSD workaround 2023-11-07 09:24:33 -10:00
Victor Zverovich
4548d1eae2 Make write_escaped_path more portable 2023-11-07 05:46:15 -10:00
Victor Zverovich
050d41e857 Make get_path_string more portable 2023-11-06 14:34:53 -10:00
hotwatermorning
b35d4e40fe fix: use FMT_HAS_INCLUDE instead of __has_include 2023-11-03 15:10:40 -07:00
hotwatermorning
acaf83f40f feat: enable building with gcc 4.8 2023-11-03 02:38:05 +09:00
hotwatermorning
05aa783779 feat: include xlocale.h only if exists 2023-11-03 02:38:05 +09:00
Carl Smedstad
e0d3e346d2
Wrap Char in array to avoid pointer arithmetic (#3695)
This resolves the following finding reported by Coverity Static Analysis
v2023.6.1 on line 1964 of fmt/include/fmt/format.h:

  ptr_arith: Using &v as an array. This might corrupt or misinterpret
             adjacent memory locations.
2023-10-31 14:05:46 -07:00
Victor Zverovich
19276d7325 Fix an inconsistentcy between to_string and format 2023-10-28 08:05:11 -07:00
Dimitrij Mijoski
2a2c6e676f
Fix flushing C++ iostreams before calling write_console() (#3689)
This change correctly implements https://wg21.link/P2539/ for both
C streams and C++ iostreams.

Fixes #3688.
2023-10-25 13:13:31 -07:00