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
Roman Koshelev
3b7f58a8b3
add buffer flush before direct write
2023-10-24 16:02:37 -07:00