Commit Graph

662 Commits

Author SHA1 Message Date
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
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
Victor Zverovich
0b5cb18b71 Use buffering in to_string to avoid bloat 2022-09-21 17:11:43 -07:00
Victor Zverovich
94ceb38a09 Improve locale API 2022-09-11 09:33:31 -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
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
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
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
Victor Zverovich
7fb8d33f9d Fix compile-time width/precision type check 2022-08-09 16:10:02 -07:00
Victor Zverovich
48e0a59222 Implement compile-time checks for dynamic width/precision type 2022-07-22 17:00:40 -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
Vladislav Shchapov
115e00e0b9 Replace __cplusplus with FMT_CPLUSPLUS.
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-07-04 07:18:21 -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
David Chisnall
2471875867 Make the tests pass on a CHERI system. 2022-06-10 07:02:03 -07:00
Victor Zverovich
9d60395953 Fix compilation on ppc64 2022-05-31 13:53:15 -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
Victor Zverovich
ce246aaf74 Remove deprecated APIs 2022-05-22 07:10:09 -07:00
Victor Zverovich
ae963e444f Implement constexpr isfinite to avoid producing NaN 2022-05-11 08:43:22 -07:00
Victor Zverovich
358f5a7e50 Make precision computation consistent with width 2022-05-11 06:34:51 -07:00
Vladislav Shchapov
ffb5e6a732
Suppress a -Wliteral-range warning on Apple M1 (#2861) 2022-04-19 11:10:18 -07:00
Victor Zverovich
5d804ee7fe Fix handling of subnormals in exotic FP 2022-04-17 08:56:35 -07:00
Victor Zverovich
f607e3e970 Add __float128 support 2022-04-03 12:58:06 -07:00
Victor Zverovich
96930161f9 Implement 128-bit operator+= for uint128_fallback 2022-03-27 08:07:54 -07:00
Victor Zverovich
db5b8993ac Fix formatting of std::byte via format_as 2022-03-26 09:01:30 -07:00
timsong-cpp
3d19be282a Fix #2816: strip named argument wrappers for compile-time checking 2022-03-18 10:11:14 -07:00
Victor Zverovich
ed18ca3eae Implement isnan 2022-03-14 20:37:46 -07:00
Victor Zverovich
a204b8dde7 Add initial __float128 support 2022-03-14 19:34:41 -07:00
Victor Zverovich
b6b003b073 Cleanup test 2022-03-14 15:48:38 -07:00
Victor Zverovich
cbc59ca893 Clear moved from memory buffer 2022-02-20 08:12:59 -08:00
Vladislav Shchapov
ea3d326c63
Fix clang -Wliteral-range warning (#2779) 2022-02-19 10:52:33 -08:00
Victor Zverovich
aad44f2839 Add fmt::enums::format_as 2022-02-19 08:03:42 -08:00
Victor Zverovich
a0b43bfae2 Add support for 96-bit long double 2022-02-18 18:01:49 -08:00
Victor Zverovich
2c8cd2db34 Fix handling of zero precision 2022-02-18 12:38:30 -08:00
Victor Zverovich
d38f72aff2 Refactor fallback ints 2022-02-17 20:24:42 -08:00
Victor Zverovich
15c2a3bacc int128_t -> int128_opt 2022-02-17 20:03:25 -08:00
Victor Zverovich
6a13464059 Include 128-bit with other signed integers in specifier check 2022-02-16 16:57:06 -08:00
Barry Revzin
a34a97cc1d
Supporting ? as a string presentation type (#2674)
* Supporting ? as a string presentation type.

* Supporting ? as a char presentation type.

* Adding iterator_category to counting_iterator.
2022-01-30 08:55:28 -08:00
Victor Zverovich
09fde7f4b8 Add fmt::underlying for enum classes 2022-01-22 08:06:22 -08:00
Victor Zverovich
c28500556a FMT_NOEXCEPT -> noexcept 2022-01-20 16:55:47 -08:00
Victor Zverovich
1b193e7b37 Deprecate more 2022-01-03 11:13:09 -08:00
Alexey Ochapov
e46392ea2c deprecate _format UDL in code using FMT_DEPRECATED 2021-12-18 08:33:20 -08:00
Victor Zverovich
215f21a038 Detect overflow on large precision 2021-12-05 07:26:58 -08:00
Victor Zverovich
c472a27818 Fix handling of very large precision in fixed format 2021-11-27 08:23:05 -08:00
Florin Iucha
acad8cfab1 Reformat all source code; no functional changes
Before adding the format checker, the mainline should be clean, to
avoid false failures.
2021-11-25 09:15:25 -08:00
Florin Iucha
491ba2dda5 Annotate fmt::format and fmt::formatted_size as [[nodiscard]]
This prevents accidentally writing fmt::format when fmt::print was
intended. Other than running tests, there's not a good use case for
discarding the formatted output.
2021-11-25 07:30:30 -08:00
Victor Zverovich
028f227752 Handle implicit conversions in write 2021-10-31 08:58:54 -07:00
Victor Zverovich
894faf3fed Refactor presentation types 2021-09-06 13:32:33 -07:00
Victor Zverovich
3940de5952 thousands -> group_digits 2021-09-05 06:47:18 -07:00
Victor Zverovich
c4d0f96a6d Implement format specs in fmt::thousands 2021-09-04 06:56:51 -07:00
Victor Zverovich
3b9c442689 Implement thousands separators without locales 2021-09-04 06:32:46 -07:00
Victor Zverovich
1d7384530e Add missing presentation type checks for std::string (#2402) 2021-07-02 07:51:04 -07:00
Victor Zverovich
e421d52713 Simplify error handling in parse_nonnegative_int 2021-06-14 16:05:37 -07:00
Victor Zverovich
2039dce75f Detect consteval 2021-06-07 06:57:43 -07:00
Victor Zverovich
206000a017 Workaround pathological conversion (#2343) 2021-06-06 07:18:44 -07:00
Victor Zverovich
76ee490468 Move wchar/custom char overloads to xchar.h 2021-06-05 22:57:45 -07:00
Victor Zverovich
e77b22d6da Deprecate memory buffer overload of format_to 2021-06-05 14:58:36 -07:00
Victor Zverovich
11a14db286 Update format_to taking a buffer and remove undocumented vformat_to overload 2021-05-30 07:57:51 -07:00
Victor Zverovich
486a80e8ef Move wchar_t overloads to xchar.h 2021-05-30 06:41:39 -07:00
Victor Zverovich
a9a9018191 Move wmemory_buffer to wchar.h 2021-05-29 08:26:04 -07:00
Matthias Liedtke
98b9ff47a1
Align hex floats right as default (#2317) 2021-05-28 09:21:01 -07:00
Liedtke
a70a4ae053
Ignore zero-padding for non-finite floating points (#2310)
* Ignore zero-padding for non-finite floating points

* keep width for non-finite formatting with 0-padding

* clang-format

* preserve alignment

* align code-style
2021-05-27 14:13:05 -07:00
Victor Zverovich
34b8acaef7 More wchar_t-specific API to wchar.h 2021-05-21 18:24:39 -07:00
Victor Zverovich
61b4c923d7 Reduce code bloat 2021-05-20 05:51:45 -07:00
Victor Zverovich
95c358f721 Improve separation between code unit types 2021-05-19 09:06:57 -07:00
Victor Zverovich
e9c1c415b8 Improve compile-time checks 2021-05-19 07:57:57 -07:00
Victor Zverovich
0dd91e20d5 Add wchar.h for wide char overloads 2021-05-17 21:59:10 -07:00
Victor Zverovich
d35f1ad5c1 Cleanup core 2021-05-16 10:02:33 -07:00
Alexey Ochapov
54f22a3eef add support for statically named arguments with FMT_STRING 2021-05-14 16:31:10 -07:00
Victor Zverovich
16f2ef91ab Replace fmt::system_error with std::system_error 2021-05-07 08:33:39 -07:00
Victor Zverovich
9c3af11a92 Cleanup tests 2021-05-05 18:31:41 -07:00
Victor Zverovich
f0095ccd34 Add support for ranges of types without formatters to join (#2262) 2021-05-05 07:43:46 -07:00
Victor Zverovich
9155e2de4c Cleanup tests 2021-05-01 17:11:45 -07:00
Victor Zverovich
38127d9ec0 Cleanup tests 2021-04-30 15:50:03 -07:00
Alexey Ochapov
53ca0cbe75 gtest: move GTest/GMock files to separate directory, update GTest/GMock usages
* all GTest/GMock files moved to `test/gtest` directory
* `CMakeLists.txt` created in `test/gtest` from `CMakeLists.txt` in `test`
* GTest/GMock target in CMake renamed to `gtest` (was `gmock`)
* CMake `gtest` target updated to export includes as "gtest/gtest.h" or "gmock/gmock.h" only
* includes in tests updated: "gtest.h" -> "gtest/gtest.h", "gmock.h" -> "gmock/gmock.h"
* removed duplications of `target_include_directories` for GTest/GMock directories (CMake manages them)
2021-04-29 07:11:49 -07:00
Victor Zverovich
5b2c740ad8 Remove deprecated APIs 2021-04-23 15:27:25 -07:00
denchat
24c9751558
Try to suppress MVSC warn of narrowing (#2230) 2021-04-13 07:30:43 -07:00
Victor Zverovich
5a8bf1f6a3 Workaround hexfloat inconsistency on windows (#2205) 2021-04-07 11:20:08 -07:00
Jason Cobb
c62e4c30f4 Make buffer_appender default-constructible when back_insert_iterator is 2021-04-01 09:52:44 -07:00
Victor Zverovich
6e1fc01752 Move detail::truncating_iterator to fmt/compile.h 2021-03-06 08:35:36 -08:00
Jason Cobb
e718ec3e93
Make truncating_iterator an output_iterator (#2158) 2021-03-04 15:53:08 -08:00
Victor Zverovich
7e72673d87 Improve width estimation (#2033) 2021-02-13 09:30:29 -08:00
Victor Zverovich
13b117b5bc Improve code point computation 2021-02-13 08:46:19 -08:00
Mike Crowe
e6ef927e6b
fmt::ptr: Support function pointers (#2131)
Passing a function pointer to fmt::ptr results in:

 In file included from /home/mac/git/fmt/test/gmock/gmock.h:238,
                  from /home/mac/git/fmt/test/format-test.cc:31:
 .../fmt/test/format-test.cc: In member function ‘virtual void FormatterTest_FormatPointer_Test::TestBody()’:
 .../fmt/test/format-test.cc:1486:56: error: no matching function for call to ‘ptr(void (&)(int, double, std::__cxx11::string))’
              format("{}", fmt::ptr(function_pointer_test)));

with GCC and Clang. Let's add an overload to support that usage.

Unfortunately, MSVC would
consider the overload to be ambiguous for unknown reasons:

 D:\a\fmt\fmt\test\format-test.cc(1485,1): error C2668: 'fmt::v7::ptr': ambiguous call to overloaded function [D:\a\fmt\build\test\format-test.vcxproj]
 D:\a\fmt\fmt\include\fmt/format.h(3742,60): message : could be 'const void *fmt::v7::ptr<void,int,double,std::string>(T (__cdecl *)(int,double,std::string))' [D:\a\fmt\build\test\format-test.vcxproj]
           with
           [
               T=void
           ]
 D:\a\fmt\fmt\include\fmt/format.h(3735,42): message : or       'const void *fmt::v7::ptr<void(int,double,std::string)>(T (__cdecl *))' [D:\a\fmt\build\test\format-test.vcxproj]
           with
           [
               T=void (int,double,std::string)
           ]
 D:\a\fmt\fmt\test\format-test.cc(1486,1): message : while trying to match the argument list '(overloaded-function)' [D:\a\fmt\build\test\format-test.vcxproj]

but luckily this means that the overload is unnecessary in that case
anyway, so we can just make it conditional.
2021-02-09 07:35:16 -08:00
Victor Zverovich
ce519e939b Fix exception propagation from iterators (#2097) 2021-01-23 17:27:24 -08:00
Ivan Polyakov
8bf28e6bb1
Add support for s format specifier to bool (#2094) (#2109) 2021-01-23 07:32:41 -08:00
Victor Zverovich
7fd535c6ae Cleanup 'L' handling 2021-01-18 07:57:38 -08:00
Victor Zverovich
e4f2cf455e Make 'L' a modifier 2021-01-17 09:28:46 -08:00
Victor Zverovich
532e846b86 Fix width computation in float formatter 2021-01-15 11:07:55 -08:00
Victor Zverovich
f8c2f8480a Fix handling of width when formatting int as char 2021-01-14 08:41:17 -08:00
Victor Zverovich
0fe0b15e71 Fix handling of # in width computation 2021-01-13 16:48:07 -08:00
Alexey Ochapov
d09b5c1453
Fix std::byte formatting with compile-time API (#2072)
* add test for byte formatting with `FMT_COMPILE`

* fix byte formatting with `FMT_COMPILE`, use `__cpp_lib_byte` macro

* use is not custom mapped type check

* workaround MSVC bug
2020-12-27 07:23:28 -08:00