Commit Graph

1970 Commits

Author SHA1 Message Date
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
Victor Zverovich
19276d7325 Fix an inconsistentcy between to_string and format 2023-10-28 08:05:11 -07:00
June Liu
2ac6c5ca8b
Fix error C2668 on Windows with option /std:c++latest (#3680)
* Namespace-qualify to avoid ambiguity with std::format_to for format-test.cc

When build fmt with MSVC under option /std:c++latest, it failed due to `error 2668: 'std::format_to': ambiguous call to overloaded function`, so add namespace to qualify the call to format_to to avoid this issue.
2023-10-16 09:54:02 -07:00
Victor Zverovich
130cf54cbc Use a more sensible locale in tests 2023-10-08 10:49:21 -07:00
Victor Zverovich
8e0ca0589f Use a more sensible locale in tests 2023-10-08 09:21:02 -07:00
Victor Zverovich
bf497ac068 Cleanup test 2023-10-08 07:30:08 -07:00
Richard Kellnberger
bb8d50f04b
add a suffix for days and fix the one for minutes (#3664) 2023-10-07 12:45:34 -07:00
Giel van Schijndel
f76603f21e
fix: make std::bitset formattable again (#3660)
* fix: make std::bitset formattable again

It used to be formattable via operator<<(ostream&) implicitly. Make it
formattable again, but this time via formatter specialization.

* fix: make nested_formatter constexpr default constructible
2023-10-03 09:53:47 -07:00
Vladislav Shchapov
492a99c964
Fix error: 'char_traits<custom_char>' is deprecated: char_traits<T> for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided for a temporary period. It will be removed in LLVM 18, so please migrate off of it. [-Werror,-Wdeprecated-declarations] (#3634)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2023-09-18 15:46:17 -07:00
Victor Zverovich
0e01e46c11 Implement nested formatter 2023-09-18 14:21:21 -07:00
Dana Jansens
f6ca4ea199
Avoid a space in the UDL definition (#3610)
* Avoid a space in the UDL definition except on GCC before 4.9

Clang 18 has grown a warning about the space being deprecated which
is enabled by default in their nightly binaries. However GCC before 4.9
will reject the UDL definition unless there is a space there, so we need
to keep the space conditionally for it.

* Remove UDLs on GCC before 4.9 to simplify things

GCC before 4.9 rejects the syntax that is now
rejected on more modern compilers.

* Disable compile-error-test on GCC < 4.9

This avoids the UDL tests failing as GCC < 4.9 can not parse UDLs
without a space, but the space is malformed in modern compilers.
2023-09-18 08:09:42 -07:00
Gleb Mazovetskiy
a8a73da7e4
Add an option to avoid wchar APIs on Windows (#3636)
With this, fmt can be used on Windows 98 and the Original Xbox with:

    set(FMT_OS OFF)

It is not exposed as a CMake option but one can define it manually
in the fmt subproject, e.g.:

    target_compile_definitions(fmt PUBLIC FMT_WINDOWS_NO_WCHAR)

Fixes #3631
2023-09-17 08:49:51 -07:00
Vladislav Shchapov
016b1faede
Fix symbol leak (#3627)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2023-09-16 07:26:36 -07:00
Victor Zverovich
d4987546a4 Add an experimental nested formatter 2023-09-10 11:56:55 -07:00
Victor Zverovich
ca608547e5 Workaround a C++11 issue 2023-09-04 10:07:14 -07:00
Victor Zverovich
a79a979828 Cleanup ranges test 2023-09-04 09:19:40 -07:00
Victor Zverovich
457bb6a98f Merge the copyright comment since there are many contributors 2023-09-04 09:09:01 -07:00
Alex Guteniev
9b74160817
atomic_flag formatting (#3594) 2023-08-25 08:06:10 -07:00
Ben Deane
6c845f57e5
Fix formatted_size with FMT_COMPILE and format specs (#3588)
Addresses issue #3586
2023-08-15 06:45:48 -07:00
Zhanwei Wang
5a866fe852
Add formatter for std::atomic (#3574) 2023-08-14 08:34:31 -07:00
Vladislav Shchapov
e150ea0cc2 to_string supports types with format_as
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2023-08-13 08:39:52 -07:00
Victor Zverovich
d424862319 Fix fixed precision handling during rounding in long double 2023-08-07 13:56:53 -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
5chmidti
8a4bec5cf5
fix ambiguous formatter lookup for flat_set (#3561) 2023-07-31 09:26:33 -07:00
Victor Zverovich
3dec65b7fd Use replacement character in path 2023-07-22 09:07:28 -07:00
Victor Zverovich
ac0ab8eff3 Improve path formatter 2023-07-20 17:49:12 -07:00
Victor Zverovich
e475859042 Fix overspecified tests 2023-07-20 14:09:22 -07:00
Victor Zverovich
436c131d4c Optimize compiled format_to_n 2023-07-20 12:35:01 -07:00
Victor Zverovich
388bc296b7 Fix fixed formatting of small long doubles 2023-07-20 12:06:05 -07:00
Victor Zverovich
9bea6ec04a Don't use deprecated checked_array_iterator 2023-07-20 07:12:06 -07:00
Victor Zverovich
661b23edeb Call parse on empty specs at compile time 2023-07-15 22:20:29 -07:00
Victor Zverovich
606f85f8b2 Workaround brain-damaged conversions 2023-06-26 16:06:24 -07:00
Victor Zverovich
9158bea1e1 Remove old grisu tests 2023-06-18 18:15:09 +03:00
Victor Zverovich
0b8404918e Remove get_cached_power 2023-05-27 09:19:50 -07:00
Nico Rieck
171a020c82
Pass correct Char to base format_as formatter (#3457) 2023-05-24 14:50:47 -07:00
Victor Zverovich
d8f04e3995 Simplify ceil 2023-05-24 11:51:34 -07:00
Vladislav Shchapov
5e988f8dfa Remove is_constant_evaluated() check
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2023-05-24 09:07:12 -07:00
Vladislav Shchapov
19b17618a9 Make constexpr ceil
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2023-05-24 09:07:12 -07:00
Victor Zverovich
858e528abd Use dragon in constexpr 2023-05-23 06:30:09 -07:00
timsong-cpp
08ef0d0842
fix formatter<char*> (#3432) 2023-05-20 06:32:21 -07:00
Victor Zverovich
821f8cdb45 Detemplatize printf more 2023-05-17 12:34:12 -07:00
Victor Zverovich
2f605cc896 Deprecate wide printf 2023-05-17 08:58:55 -07:00
Victor Zverovich
616a493786 Revert Char* formatter removal 2023-05-17 06:11:11 -07:00
Victor Zverovich
aeedac5884 Remove unneeded specialization 2023-05-13 07:46:47 -07:00
Vladislav Shchapov
eaa6307691
Make hex float test more stable (#3434)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2023-05-13 06:34:33 -07:00
Victor Zverovich
ea49c91cd1 Cleanup argument construction 2023-05-11 18:43:39 -07:00
Patrick Geltinger
d7592ad8bf
Fix time_point formatting for durations with certain ratios (#3430)
* Fix time_point formatting

* Add timestamps_ratios tests
2023-05-11 15:25:21 -07:00
Victor Zverovich
ebfb2e6779 Remove unused alias 2023-05-11 10:51:32 -07:00
Victor Zverovich
5780269d57 Improve API safety 2023-05-11 10:19:56 -07:00
Victor Zverovich
93a30a0746 unicode_to_utf8 -> to_utf8 since both sides of conversion are Unicode 2023-05-10 16:26:02 -07:00
Victor Zverovich
1e0ce567ef Fix formatting of paths containing invalid Unicode 2023-05-07 10:05:15 -07:00
Vladislav Shchapov
dde8cf3bb7 Unification utf16/utf32 to utf8 conversion
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2023-05-06 08:32:51 -07:00
Vladislav Shchapov
e84b00e014 Workaround to error: variable 'n' set but not used [-Werror,-Wunused-but-set-variable]
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2023-05-06 08:32:51 -07:00
Victor Zverovich
b12ffea4fb Add filesystem_error test back 2023-05-06 07:49:46 -07:00
Daniela Engert
d7a8e50cb5
Improve module testing (#3397)
* use the standard `test-main.cc` component instead of injected test infrastructure sources
 * undo now obsolete commit `00235d8a` from July 2021
 * Clang cannot import user-defined literals as it seems -> disable test
 * Clang emits duplicate, non-mergeable copies of `detail::buffer`'s vtable, causing linker errors -> disable test
2023-05-03 07:56:24 -07:00
Victor Zverovich
02cae7e48a Improve handling of Unicode in paths 2023-04-30 09:58:59 -07:00
Kevin Hwang
e7d6eb6794
Update tests to use recommended MOCK_METHOD (#3395) 2023-04-20 13:16:21 -07:00
Victor Zverovich
d97d8cea67 Push module check to test 2023-04-14 11:42:01 -07:00
June Liu
33f7150778
Fix error C2668 on msvc (#3378) 2023-04-11 06:27:28 -07:00
Victor Zverovich
fce74caa15 Disable problematic implicit conversions 2023-04-09 09:08:46 -07:00
Victor Zverovich
02bf4d1c1c Disable to_string_view ADL 2023-04-09 08:49:05 -07:00
Vladislav Shchapov
97aedeab48
Workaround a double-double hexfloat format (#3366)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2023-04-01 07:19:23 -07:00
Victor Zverovich
41cfc739fe Generalize format_as 2023-03-26 07:37:51 -07:00
Vladislav Shchapov
f6276a2c2b
Force use a signed char (On ARM char is unsigned by default) (#3362)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2023-03-22 11:34:59 -07:00
Victor Zverovich
6549ffde8e Improve format_as safety 2023-03-19 12:09:54 -07:00
Barry Revzin
93bfa05382
%T is %H:%M:%S (#3349) 2023-03-18 07:16:22 -07:00
TheOmegaCarrot
d8e1c4265a
fix case of variant which is valueless by exception (#3347)
Co-authored-by: theomegacarrot <theomegacarrot@gmail.com>
2023-03-18 07:07:06 -07:00
Vladislav Shchapov
050293646f
Path is not escaped twice in the debug mode (#3321)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2023-03-05 08:01:06 -08:00
Victor Zverovich
e0748e61dd Fix recursion check in range formatting 2023-03-04 08:20:32 -08:00
Victor Zverovich
98699719f8 Make # handling consistent with std::format 2023-02-26 10:15:16 -08:00
tom-huntington
5b8302079d
Add optional support (#3303) 2023-02-25 06:45:56 -08:00
luzpaz
3a69529e8b
Fix various typos (#3312)
Found via `codespell -q 3 -S ./test/gtest -L "fo,pres,seh,wronly"`
2023-02-21 15:14:41 -08:00
Victor Zverovich
76f520835f Call element parse in tuple parse 2023-02-20 12:54:20 -08:00
Victor Zverovich
1741e90dec Always call parse in range formatter 2023-02-18 09:58:37 -08:00
Froster
b5c2f74f45
change sopen_s to wsopen_s (fmtlib#3234) (#3293) 2023-02-16 11:17:55 -08:00
Victor Zverovich
655046d24f Fix container adaptor formatting 2023-02-10 09:45:37 -08:00
Shawn Zhong
581c6292c9
Add formatters for container adapters (#3279) 2023-02-08 17:25:41 -08:00
Shawn Zhong
7718eeeacc
Implement glibc ext for sec, min, and hour (#3271) 2023-02-08 09:22:58 -08:00
Barry Revzin
05e3a9233a
Allowing formatting non-copyable ranges. (#3290) 2023-01-27 12:29:57 -08:00
Shawn Zhong
87c066a35b
Implement println (#3267) 2023-01-24 12:30:00 -08:00
Shawn Zhong
dfbb952b2c
Fix empty spec for time point (#3275) 2023-01-16 11:48:00 -08:00
Shawn Zhong
39971eb336
Fix localized format for float-point numbers (#3272) 2023-01-15 11:47:24 -08:00
jk-jeon
0f42c17d85
Implement a new formatting algorithm for small given precision (#3269)
Implement the formatting algorithm for small given precision discussed in https://github.com/fmtlib/fmt/issues/3262 and https://github.com/fmtlib/fmt/pull/2750
2023-01-14 11:30:20 -08:00
Shawn Zhong
676c2a107e
Fix negative subsec for time_point (#3261) 2023-01-11 11:36:50 -08:00
Shawn Zhong
dda53082be
Support fill, align & width for time point (#3260) 2023-01-09 11:25:31 -08:00
Victor Zverovich
9e4a54fa6e Disable remaining implicit conversions 2023-01-03 12:08:42 -08:00
Victor Zverovich
9121f9b1d3 Enable format_as for classes 2023-01-03 08:58:23 -08:00
Victor Zverovich
b7535365b2 Enable format_as for non-integral types 2023-01-02 13:37:13 -08:00
Victor Zverovich
09ed1ddb9c Cleanup tests 2023-01-02 09:58:12 -08:00
Victor Zverovich
71e4e02722 Cleanup vprintf 2023-01-02 08:37:00 -08:00
Victor Zverovich
a73a9b6a84 Refactor format string checks 2022-12-30 16:03:41 -08:00
Victor Zverovich
a05ba44df8 Simplify format string parsing 2022-12-30 11:23:42 -08:00
Victor Zverovich
ffb9b1d13c Improve handling of signed types 2022-12-30 10:31:39 -08:00
Victor Zverovich
32190859ec Fix handling of char 2022-12-30 09:11:42 -08:00
Victor Zverovich
8fe4d97d5e Reduce template instantiations 2022-12-30 08:44:23 -08:00
Victor Zverovich
bd12aaa98e Simplify format string parsing 2022-12-25 12:31:38 -08:00
Vladislav Shchapov
4841784e82 Simplify C99 strftime detection conditions
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-12-25 10:16:19 -08:00
Vladislav Shchapov
cb72c23e9e Improve timezone tests
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-12-25 10:16:19 -08:00
Victor Zverovich
dfb857ebef Refactor format spec parsing 2022-12-25 07:25:32 -08:00
Victor Zverovich
9ea9b6bcb1 Cleanup arg id parsing 2022-12-24 16:33:57 -08:00
Victor Zverovich
d1745084e0 Simplify parse context 2022-12-24 15:20:24 -08:00
Victor Zverovich
407e7b7b6d basic_format_specs -> format_specs 2022-12-24 14:34:50 -08:00
Victor Zverovich
934c8e5f76 Refactor precision parsing 2022-12-24 13:29:23 -08:00
Victor Zverovich
9660e5b956 Remove redundant tests 2022-12-24 07:28:13 -08:00
Shawn Zhong
a585571e90 Ignore 0 character with align 2022-12-23 19:36:05 -08:00
Victor Zverovich
840ec8569d Cleanup width handlers 2022-12-23 19:18:35 -08:00
Victor Zverovich
1dadeb8a33 Refactor width parsing 2022-12-23 18:29:59 -08:00
Vladislav Shchapov
e004f1d699 Fix for issue #3241
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-12-23 12:26:20 -08:00
Victor Zverovich
bde1a6070d Simplify fill and alignment parsing 2022-12-23 10:52:56 -08:00
Shawn Zhong
8c56919bd2 Check chrono spec starts with % 2022-12-21 14:40:30 -08:00
Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com)
115001a3b1 Formatting of system clocks ought to be to UTC, not to local time.
This improves standards conformance of fmt.
2022-12-21 14:23:02 -08:00
Victor Zverovich
b90895412f Fix formatting of named arguments with locale 2022-12-15 09:59:40 -08:00
Victor Zverovich
3999fd193a Workaround an ADL issue 2022-12-11 09:32:17 -08:00
Vladislav Shchapov
1bf302a4ea Implement %Ez, %Oz for chrono formatter
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-12-10 10:13:53 -08:00
Radek Brich
62ceb181b1 fix #3105 - Compile-time error when mixing named argument with automatic indexing 2022-12-04 08:13:26 -08:00
Vladislav Shchapov
d24be2e95c Add countl_zero function
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-11-30 12:25:01 -08:00
Vladislav Shchapov
115ca96e0e Bump tested CMake version to 3.25
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-11-30 08:09:32 -08:00
Vladislav Shchapov
886491625d Remove workaround for GTest bug
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-11-30 07:16:37 -08:00
Vladislav Shchapov
74c51ff37e Skip only strptime dependent test in scan-test
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-11-27 08:59:30 -08:00
Chris Thrasher
69ffedfe52 Use target_compile_features to specify C++ standard requirement 2022-11-26 11:03:17 -08:00
Vladislav Shchapov
31364732dc Replace snprintf-based hex float formatter with internal implementation
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-11-24 07:15:46 -08:00
Vladislav Shchapov
8276f1a204 Fix warning: the implicit by-copy capture of "this" is deprecated (EDG frontend)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-11-22 10:51:00 -08:00
thesmurph
c7980542d3
Skip the scan-test if strptime isn't defined (#3184)
cygwin and embedded systems. By default newlib doesn't provide strptime
in time.h because it was added in a later X/Open versions. Issue: #3178
2022-11-16 09:42:01 -08:00
Hans-Martin B. Jensen
7df30f91ae
Format unique_ptr with custom deleter (#3177)
* Format unique_ptr with custom deleter

Added deleter type to fmt::ptr unique_ptr overload. Deleter type is
part of the unique_ptr type.

* Review: apply clang-format

Co-authored-by: Hans-Martin B. Jensen <haje@eposaudio.com>
2022-11-13 21:54:32 -08:00
Stepan Ponomaryov
795ed8abf5
Add precision modifier for seconds in chrono format (#3148)
Co-authored-by: Stepan Ponomarev <stepan.ponomarev@itiviti.com>
2022-11-02 11:58:51 -07:00
Barry Revzin
66d71a1b35
Fixing formatting of range of range of char. (#3158) 2022-11-02 11:04:54 -07:00
Vladislav Shchapov
cd7202e039
Fix overflow error (#3143)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-10-16 14:04:55 -07:00
Patrick Roocks
9254cfa6f0
Support formatting of subseconds (#3115)
* Timestamp formatting shall print also subseconds, fixed a bug for fractional durations
2022-10-12 14:33:53 -07:00
Tinson Lai
5ad7b71381
Fix options for C++20 experimental module in CMake (#3134)
* Fix options for C++20 experimental module in CMake

* Replace `FMT_CAN_MODULE` by `FMT_MODULE` in test/CMakeLists.txt
2022-10-12 08:23:12 -07:00
Vladislav Shchapov
662adf4f33
Move formatter<std::error_code> from fmt/os.h to fmt/std.h (#3125)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-10-01 17:46:09 -07:00
Vladislav Shchapov
ad91cab374
Normalization of stdlib inline namespace names (#3119)
* Normalization of stdlib inline namespace names

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

* Remove all subnamespaces with names matching "__*" mask

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

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-09-29 09:52:38 -07:00
Patrick Roocks
ad719619cc
Support formatting of std time_point with utc_clock (#3110) 2022-09-28 07:31:53 -07:00
Victor Zverovich
0b5cb18b71 Use buffering in to_string to avoid bloat 2022-09-21 17:11:43 -07:00
Sergiu Deitsch
e2f6d7665b fix gcc <= 7.1 compile errors 2022-09-12 10:43:16 -07:00
Victor Zverovich
94ceb38a09 Improve locale API 2022-09-11 09:33:31 -07:00
Vladislav Shchapov
21c2137e77
Add class name output to formatter for std::exception (#3076)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-09-10 08:04:00 -07:00
Victor Zverovich
ecffca6726 Don't parse '}' as fill 2022-09-07 17:33:31 -07:00
gerboengels
3176e0fad7
Add locale overload for formatted_size (#3084) (#3087)
Co-authored-by: Gerbo Engels <gerbo.engels@ortec-finance.com>
2022-09-07 14:15:12 -07:00
Victor Zverovich
b98ffb7dbd Improve locale handling 2022-09-04 21:07:30 -07:00
Vladislav Shchapov
bac53951b8
Add starts_with to basic_string_view. (#3080)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-09-04 11:41:16 -07:00
Victor Zverovich
d59b89e9cd More locale 2022-09-04 11:23:45 -07:00
Victor Zverovich
58a5563a9f Implement grouping 2022-09-04 09:01:26 -07:00
Victor Zverovich
1b94271ff6 Add support for UTF-8 digit separators 2022-09-03 11:01:05 -07:00
Victor Zverovich
91ecb38a34 Localize negative integers 2022-09-03 07:01:11 -07:00
Victor Zverovich
aec3bb5d0a Workaround C complex.h idiocy 2022-09-03 06:35:55 -07:00
NewbieOrange
29c6000137
Simplify is_variant_like_ check, fix compile error before GCC 11 (#3072)
Co-authored-by: Vladislav Shchapov <vladislav@shchapov.ru>

Co-authored-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-09-02 21:08:07 -07:00
Victor Zverovich
fec5515c55 num_format_facet -> format_facet 2022-09-02 18:55:08 -07:00
Victor Zverovich
f187274d36 Add loc_value 2022-09-02 13:45:23 -07:00
Victor Zverovich
fc5e59fe4a Don't use stringstream 2022-09-02 13:05:26 -07:00
Victor Zverovich
d6a8704605 Improve locale support 2022-09-02 11:52:19 -07:00
Victor Zverovich
56c72a671c Reduce locale dependency 2022-09-02 10:22:11 -07:00
Zach Toogood
4191477b98
Add formatter for std::exception (#3062)
Co-authored-by: fekir <federico.kircheis@gmail.com>
Co-authored-by: Alexey Ochapov <alexez@alexez.com>
Co-authored-by: Vladislav Shchapov <vladislav@shchapov.ru>

Co-authored-by: fekir <federico.kircheis@gmail.com>
Co-authored-by: Alexey Ochapov <alexez@alexez.com>
Co-authored-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-09-02 08:33:37 -07:00
Victor Zverovich
64e29893cf Improve locale support 2022-09-01 14:48:43 -07:00
Vladislav Shchapov
33b4c33c5b Requires FMT_CONSTEXPR20 support
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-08-29 13:33:48 -07:00
Vladislav Shchapov
a07411c2b9 Disable compile-time checks for dynamic width/precision test for LCC and compiler without std::is_constant_evaluated()
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-08-29 13:33:48 -07:00
Vladislav Shchapov
f98048b621
Fix bugs in utf8 decoder (#3056)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-08-26 15:37:15 -07:00
Victor Zverovich
4a8e2949bb Fix formatting of ranges of code unit types
Thanks Nicole Mazzuca.
2022-08-26 13:48:58 -07:00
Vladislav Shchapov
3a3b0709e2
Disable bogus -Wstringop-overflow on GCC 11 (#3054)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-08-24 12:37:34 -07:00
Victor Zverovich
e724bbea16 Fix wchar_t corner cases 2022-08-24 12:23:10 -07:00
Victor Zverovich
dc59d3df3f Fix a warning in gtest 2022-08-24 07:18:14 -07:00
Vladislav Shchapov
489dabbd31
Fix decoder on broken utf8 sequences. (#3044)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-08-24 07:13:27 -07:00
Victor Zverovich
541cd21838 Fix locale name (thanks Mikhail Paulyshka) 2022-08-20 08:06:20 -07:00
Victor Zverovich
1f95c34381 Fix sign handling with large code units 2022-08-20 07:46:58 -07:00
Victor Zverovich
779449fd99 Belarusify test 2022-08-20 07:37:15 -07:00
Dimitrij Mijoski
fc23cfbf4e Fix testsuite on MinGW + MSVCRT
Fixes #2952. The testsuite indirectly called strftime() with conversion
specifiers defined only in C99. In MSVCRT this function conforms only to
C89. Only in the updated UCRT this functon provides the functionality of
C99.
2022-08-14 08:40:38 -07:00
Mark Santaniello
fd93b633b8
Constexpr formatted_size (#3026)
* Constexpr formatted_size

* Add C++20 tests for gcc 9 and 10

* Adjust unit test to require __cpp_lib_bit_cast
2022-08-10 09:35:30 -07:00
Victor Zverovich
7fb8d33f9d Fix compile-time width/precision type check 2022-08-09 16:10:02 -07:00
Victor Zverovich
5f774c0aed I shouldn't be there 2022-08-02 16:35:50 -07:00
Barry Revzin
0b2862a1e4
Range formatter (#2983)
* Implement range_formatter and format_kind

* Attempted gcc 4.8 fix

* gcc 4.8 interprets inaccessible as a hard error (instead of... not available)

* Attempting to delete set_debug_format.

* clang-format

* Different implementation of FMT_STATICALLY_WIDEN

* Renaming copy_str_range to copy_str.

* I guess I need a definition

* Forgot to delete these.

* Other PR comments.
2022-07-29 13:55:16 -07:00
Dimitrij Mijoski
bbcb129e02
Reduce filesize of the tests on MinGW (#2995)
This patch removes the workaround applied here
1acfd07f1e.
MinGW is not tested on Appveyor anymore.
2022-07-22 20:11:33 -07:00
Victor Zverovich
48e0a59222 Implement compile-time checks for dynamic width/precision type 2022-07-22 17:00:40 -07:00
Victor Zverovich
00adc7120d Add a regression test for here be dragons 2022-07-22 11:08:00 -07:00
Barry Revzin
92d36e82c4
The n specifier for ranges (#2981)
* The n specifier for ranges.

* Flipping flag polarity.
2022-07-12 10:08:38 -07:00
Victor Zverovich
05be7a0764 Use FMT_USE_FLOAT128 instead of __SIZEOF_FLOAT128__ 2022-07-10 08:54:34 -07:00
Victor Zverovich
2a1b3ac629 Fix large shift in uint128_fallback 2022-07-10 08:27:21 -07:00
Daniel Krügler
e1d3d3a326
Exclude recursive ranges from the formatter specialization for ranges (#2974)
* 2954: Add test case

* Eliminate extra-test and merge it into existing std-test instead. Add conditionals for filesystem::path testing that does not run into the ambiguity problem.

* #2968: Introduce additional compile-time predicate to detect recursive ranges and reject them in formatter specialization for ranges. In addition, introduce additional wrapper traits for the individual logical operands of the complete range constraints

* #2968: Eliminate preprocessor condition that enables the formatter specialization for std::filesystem::path

* #2968: Eliminate preprocessor condition that enables the test for the formatter specialization for std::filesystem::path

* Use own bool_constant, which is available for all C++ versions

* Reintroduce previous workaround but restrict to VS 2015 for now

* Comma fix

* - Rename is_not_recursive_range to is_nonrecursive_range and add comment that explains it being depending on is_range being true
- Merge has_fallback_formatter_delayed into is_formattable_delayed and add comment that explains it being depending on is_not_recursive_range being true
- Replace disjunction in formatter specialization by has_fallback_formatter_delayed
- Get rid of unneeded detail:: prefixes within namespace detail
2022-07-10 06:26:23 -07:00
Vladislav Shchapov
b31d1a75a0 Add xchar support for fmt::streamed().
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-07-05 19:07:06 -07:00
Vladislav Shchapov
831132293b Workaround for Microsoft Visual Studio 2022 Internal compiler error.
D:\a\fmt\fmt\test\compile-test.cc(362,3): fatal error C1001: Internal compiler error. [D:\a\fmt\build\test\compile-test.vcxproj]
(compiler file 'D:\a\_work\1\s\src\vctools\Compiler\CxxFE\sl\p1\c\constexpr\constexpr.cpp', line 8635)

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-07-04 07:18:21 -07:00
Vladislav Shchapov
115e00e0b9 Replace __cplusplus with FMT_CPLUSPLUS.
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-07-04 07:18:21 -07:00
Daniel Krügler
d2a2320820
Fix partial specialization problem for filesystem for Visual Studio (#2957)
* #2954: Provide std::conjunction and std::disjunction substitutes

* #2954: Use conjunction and disjunction substitute to make formatter specializations for ranges and maps more robust (especially for Visual Studio compiler family)

* #2954: As workaround for older MSVC compilers split formatter<std::filesystem::path> partial template specialization into two explicit specialization.

* 2954: Add test case

* Provide simplified implementations of conjunction and disjunction

* Remove workaround explicit specializations if the partial specialization would cause an ambiguity error

* Eliminate extra-test and merge it into existing std-test instead. Add conditionals for filesystem::path testing that does not run into the ambiguity problem.
2022-07-03 11:06:54 -07:00
Victor Zverovich
0c06c81da8 Deprecated implicit conversion of enums to ints for consistency with scoped enums 2022-07-03 09:02:22 -07:00
Vladislav Shchapov
99bb5b1d17 Fix std::variant, std::filesystem::path tests on GCC-8, Clang-7,8.
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-07-02 08:34:52 -07:00
jehelset
6a775e9560
Add support for 'std::variant' in C++17 (#2941)
Add support for 'std::variant' in C++17.

For C++17, if all the alternatives of a variant are formattable
the variant is now also formattable. In addition 'std::monostate'
is now formattable.

Moves implementation into 'std.h', and tests into 'std-test.cc'.

Avoid fold-expression since MSVC was crashing.

Add section for 'fmt/std.h' in API-docs.
2022-06-26 07:28:01 -07:00
Victor Zverovich
9cb02aaaad Fix UDLs 2022-06-25 08:52:10 -07:00
Victor Zverovich
2d931b1497 Add fmt::streamed 2022-06-24 09:26:24 -07:00
jehelset
5682338891
Fix is_formattable for tuple-like types. (#2940) 2022-06-19 08:25:58 -07:00
Vladislav Shchapov
f0de128449 Remove /source-charset:utf-8 compile option.
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-06-19 07:37:39 -07:00
Victor Zverovich
eaa8efb950 Fix ofstream handling in msvc 2022-06-16 15:02:33 -07:00
David Chisnall
2471875867 Make the tests pass on a CHERI system. 2022-06-10 07:02:03 -07:00
Victor Zverovich
b135f1c014 Refactor handling of argument types 2022-06-09 17:03:33 -07:00
Vladislav Shchapov
232e21d51f Add utf-8 test for std::filesystem::path formatter.
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-06-04 10:10:21 -07:00
Victor Zverovich
9d60395953 Fix compilation on ppc64 2022-05-31 13:53:15 -07:00
Victor Zverovich
798d09bb70 Debug ppc failure 2022-05-30 13:06:34 -07:00
Victor Zverovich
926ddd0631 Move compile string to detail 2022-05-30 07:06:36 -07:00
Victor Zverovich
cb682f36f4 Move to_string_view to detail 2022-05-29 22:51:31 -07:00
Victor Zverovich
e927149f8e Cleanup macros 2022-05-29 17:23:02 -07:00
Victor Zverovich
1761e2666a Remove FMT_CONSTEXPR_DECL 2022-05-29 16:42:58 -07:00
Victor Zverovich
c83a5d42bb FMT_MSC_VER -> FMT_MSC_VERSION 2022-05-29 15:39:08 -07:00
Victor Zverovich
7e63b600b6 Make to_string work with __float128 2022-05-29 12:23:57 -07:00