Commit Graph

1839 Commits

Author SHA1 Message Date
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
Vladislav Shchapov
65dd2ea52c Use write_escaped_string to std::filesystem::path.
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-05-28 07:48:02 -07:00
Vladislav Shchapov
03b1b2838e Improve std::filesystem::path formatter.
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-05-28 07:48:02 -07:00
Vladislav Shchapov
1f9eae7e31 Add xchar support for write_escaped_string.
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-05-27 08:36:38 -07:00
Victor Zverovich
ce246aaf74 Remove deprecated APIs 2022-05-22 07:10:09 -07:00
Victor Zverovich
440512f08d Remove deprecated APIs 2022-05-21 12:20:31 -07:00
Victor Zverovich
c6324009ba Add initial double-double support 2022-05-21 07:32:54 -07:00
Victor Zverovich
6bf039d750 Add std:🧵:id formatter 2022-05-17 16:37:19 -07:00
Victor Zverovich
9730fb0156 Fix path formatter 2022-05-17 14:29:49 -07:00
Victor Zverovich
f0903ad9df Add a path formatter 2022-05-16 17:32:25 -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
192f79aaae Fix handling of locale separators in FP formatting 2022-04-12 08:00:17 -07:00
Victor Zverovich
395cf0f03e Fix detection of unformattable pointers 2022-04-12 06:45:46 -07:00
Mattias Ljungström
a935ac3e60
MSVC CMake generation optimization (#2852) 2022-04-08 06:27:23 -07:00
Victor Zverovich
22d31b31f0 Add a __float128 test 2022-04-03 14:56:29 -07:00
Victor Zverovich
f607e3e970 Add __float128 support 2022-04-03 12:58:06 -07:00
Victor Zverovich
686de58886 Implement 128-bit constant mul in bigint 2022-04-03 07:24:18 -07:00
Victor Zverovich
b4dc7a1d34 Add 128-bit operations to bigint 2022-04-02 09:29:13 -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
Sean McBride
b591fc87dc Fixed all clang -Wreserved-id-macro warnings (on macOS at least)
Avoid defining various reserved identifiers (starting with underscore and capital letter).  Fortunately, they were all Windows-only, so it was easy to conditionalize them in Window-only preprocessor checks.
2022-03-24 07:33:43 -07:00
Victor Zverovich
4e39e13085 Remove xchar.h include from ostream.h 2022-03-18 10:53:15 -07:00
timsong-cpp
4ad90578f7 Fix #2818: diagnose unformattable arguments in unpacked case 2022-03-18 10:11:14 -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
72f487562d Simplify float_info 2022-03-14 13:37:03 -07:00
Victor Zverovich
f91f61cd13 Reuse num_significand_bits 2022-03-14 11:34:24 -07:00
Riccardo Brugo
a8fe8becf4
Fix compilation error for ranges with ADL begin/end (#2807)
* Use `range_begin`/`end` to get formatted range iterators

* Add test for adl `begin`/`end`

* Apply clang-format

* Simplify tests
2022-03-11 11:36:39 -08:00
Riccardo Brugo
8c9bc070f5
Implement styled arguments (#2793)
* Implement styled arguments

* Inherit from formatter<Arg> to get the underlying `parse` and `format`

* Move styled_arg definition into the previous detail block

* Change styled_arg ctor parameters names to avoid shadowing members

* Move const before auto

* Remove redundant constructor for styled_arg

* Use the iterator instead of the buffer in styled_arg::format

* Remove unnecessary `styled` overloads

* Remove defaulted text_style parameter in styled function
2022-03-08 09:50:14 -08:00
Boris Dalstein
e3d688e79a
Fix warning C4251: class fmt::v8::file needs to have dll-interface (#2797)
* Fix warning C4251: class fmt::v8::file needs to have dll-interface

* Add CMake target dependency between test-main and fmt
2022-03-07 12:09:48 -08:00
Barry Revzin
0cef1f819e
Fixing formatting of certain kinds of ranges of ranges. (#2787)
* Fixing formatting of certain kinds of ranges of ranges.

* Renaming const_range to range_type.
2022-03-04 16:21:00 -08:00
Victor Zverovich
4fcacea354 Parameterized fp on significand type 2022-02-21 07:25:13 -08: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
47da218cc3 Remove uintptr_fallback 2022-02-18 07:03:33 -08:00
Victor Zverovich
4ddab8901c Merge accumulator into int128_fallback 2022-02-18 06:17:28 -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
ce93a66dfb Implement a fallback uint128_t 2022-02-17 07:37:09 -08:00
Victor Zverovich
6a13464059 Include 128-bit with other signed integers in specifier check 2022-02-16 16:57:06 -08:00
Vladislav Shchapov
10e3b83a75
Replace `make_args_checked with make_format_args` (#2760)
* Replace make_args_checked to make_format_args

* Deprecate legacy make_args_checked
2022-02-13 20:13:35 -08:00
Victor Zverovich
afbcf1e8ea Remove legacy C locale wrapper 2022-02-05 12:37:21 -08:00
Victor Zverovich
17b362f78c Simplify ostream opt-in API 2022-02-04 18:33:59 -08:00
Victor Zverovich
f055ebbd25 Make ostream operators opt in to reduce the risk of ODR violations 2022-02-04 15:06:45 -08:00
Victor Zverovich
8a21e328b8 Remove problematic constructibility check 2022-02-04 12:20:02 -08:00
Victor Zverovich
31e743d06e Don't use ostream for types convertible to string_view 2022-02-04 11:00:00 -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
1557ab7644 Add format_as for enums 2022-01-28 06:38:02 -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
matrackif
5985f0a7d2
Fix overflow for chrono durations (#2722) 2022-01-17 12:14:59 -08:00
Victor Zverovich
8f8a1a02d5 Fix handling of formattable types implicitly convertible to pointers 2022-01-14 13:42:01 -08:00
Vladislav Shchapov
b02e5af52c
fmt::join support FMT_COMPILE (#2720) 2022-01-14 09:58:49 -08:00
Victor Zverovich
d9f045fba1 Fix a UB in chrono 2022-01-09 14:06:13 -08:00
Barry Revzin
6e0f1399d7
Supporting nested format specs for ranges. (#2673)
* Supporting nested format specs for ranges.

* I dedicate this commit to Eric Niebler.

* clang-format

* PR comments.

* throw -> FMT_THROW

* Need to map every element too.

* Clarifying uncvref_type

* Trying to add a workaround for MSVC.
2022-01-08 09:48:26 -08:00
Victor Zverovich
1b193e7b37 Deprecate more 2022-01-03 11:13:09 -08:00
Alexey Ochapov
c7f88180f6 add tests for format string compile-time checks 2021-12-27 20:55:06 -08:00
Alexey Ochapov
8a2c3fb88f add reverse tests to compile-error-test
to make sure that error tests do not fail because they become outdated
2021-12-27 20:55:06 -08:00
Alexey Ochapov
1164eda5af disable compile-error-test on Windows
since it takes too much time to complete, similar to other tests with additional
CMake invocation
2021-12-27 20:55:06 -08:00
Alexey Ochapov
4482f6f1f0 rewrite compile-error-test to use non-header-only library 2021-12-27 20:55:06 -08:00
Victor Zverovich
796662a612 Escape range items convertible to std::string_view 2021-12-27 09:38:06 -08:00
Vladislav Shchapov
33ee4cc516 Improve noexception test 2021-12-26 16:28:41 -08:00
Alexey Ochapov
817788fbf0
remove incorrect C++20 check from test/CMakeLists.txt (#2663)
It disables entire branch of tests declaration unconditionally because CXX_STANDARD
is not defined there. But even we use CMAKE_CXX_STANDARD here, these tests should
not be disabled with standard >= C++20.
2021-12-23 12:32:03 -08:00
Victor Zverovich
4511030af2 Minor code style tweaks for consistency 2021-12-23 11:55:58 -08:00
lucpelletier
7812813a32
Don't explicitly delete copy ctor of dynamic_format_arg_store (#2664)
* Don't explicitly delete copy ctor of dynamic_format_arg_store

Explicitly deleting the copy ctor causes the move constructor to not be
implicitly generated. This behaviour is different than what was in
v8.0.1 and causes code that relied on the move ctor of
dynamic_format_arg_store to break.

* Add test for dynamic_format_arg_store's move ctor

* include <memory>, don't use make_unique
2021-12-23 11:34:16 -08:00
Victor Zverovich
664cd6067d Remove std-format-test 2021-12-23 10:58:02 -08:00
Alexey Ochapov
e46392ea2c deprecate _format UDL in code using FMT_DEPRECATED 2021-12-18 08:33:20 -08:00
Victor Zverovich
c882790a2e Add a set formatter 2021-12-18 07:35:40 -08:00
Victor Zverovich
121002d700 Add a map formatter 2021-12-18 07:12:53 -08:00
Victor Zverovich
be51ee1ceb Disable broken copy ctor of dynamic_format_arg_store 2021-12-17 17:18:18 -08:00
Alexey Ochapov
51b14b6c0c remove commented out lines 2021-12-17 16:05:56 -08:00
Alexey Ochapov
223a0fa55d move gtest-specific check into gtest/CMakeLists.txt 2021-12-17 16:05:56 -08:00
Victor Zverovich
fd62fba985 Don't convert scoped enums to integers 2021-12-09 12:09:33 -08:00
Victor Zverovich
e4f0564aa6 Disable is_streamable for string[_view] 2021-12-09 10:02:18 -08:00
matrackif
0bbc9708f9
Implement c++20 std::chrono::duration subsecond formatting (#2623)
* Add support for subsecond printing for std::chrono::duration according to the c++20 standard

* Remove assert test that overflows intmax_t

* * Hopefully fix int64_t to int32_t conversion errors.
* Allow proper Duration::rep type to propagate via template argument deduction

* * Hopefully fix int64_t to int32_t conversion errors.
* Allow proper Duration::rep type to propagate via template argument deduction

* Fix sign conversion (-Wsign-conversion) warning treated as error in num_digits()

* Format chrono.h with clang-format

* Remove extra forward slash in doxygen style comment

Co-authored-by: Victor Zverovich <victor.zverovich@gmail.com>

* Apply all suggestions from GitHub, except for replacing the utility subsecond_helper class with a function

* * Move logic of handling subseconds from utility class to function with name write_fractional_seconds()
* Revert write(Rep value, int width) function to previous state

* Fix -Wshadow warning

* Remove unsued get_subseconds() function, its logic has been moved to write_fractional_seconds()

* Change comment from lowercase int to uppercase Int

* Simplify test check

* Integrate suggested changes

* Remove static from detail functions, they are no longer member functions of a class and static is unnecessary.
* Change comment from "amount" to "number"

Co-authored-by: Victor Zverovich <victor.zverovich@gmail.com>
2021-12-09 06:45:13 -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
Vladislav Shchapov
5abe9e8266 Add platform-specific 'z' formatter 2021-11-25 06:52:39 -08:00
Alex Guteniev
a3ab36c803
Formatting of function pointers, member function pointers, member object pointers... (#2610) 2021-11-23 12:55:22 -08:00
Victor Zverovich
5380ff4d88 Detect types convertible to unformattable pointers 2021-11-13 08:26:27 -08:00
lukester1975
12b1d8b14a
Fix precision 0 with std::chrono::duration and added additional tests. (#2588) 2021-11-06 08:57:22 -07:00
Victor Zverovich
028f227752 Handle implicit conversions in write 2021-10-31 08:58:54 -07:00
Victor Zverovich
5b0aa638cf Minor grammar fix 2021-10-30 09:14:13 -07:00
Vladislav Shchapov
1031eedf27
Replacing strftime with std::time_put (#2550)
* Fix unicode test

* Add xchar support to chrono formatter

* Replace strftime with std::time_put

* Add std::locale support to std::tm formatter

* Use predefined names and formats for C-locale

* Performance improvement

* Make locale-independent and C locale formats consistent among platforms
2021-10-30 08:25:45 -07:00
Vladislav Shchapov
90034e4c4b
Add FMT_ASSERT and validation of values of struct tm members (#2564)
Switch internal year calculations to long long
2021-10-27 13:29:07 -07:00
Daniela Engert
df40e94673
Upgrade module-test to msvc 16.11.5 and 17.0-pre5 (#2558) 2021-10-24 08:12:39 -07:00
Victor Zverovich
1266c2b600 Fix handling of exotic character types 2021-10-17 09:07:48 -07:00
Vladislav Shchapov
aeb54b0dd9 Fix bug on '%Y' and '%C' formats with negative years
Requested changes
2021-10-16 15:03:57 -07:00
Vladislav Shchapov
f88c020fc0 Generalization of strftime/wcsftime function calls in tests 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
2754546080 Fix errors in ISO week-base-year formatter 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
218cecb6d1 Fix error in test 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
5dc3dd3d4a New tests 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
4707373d33 Fix year formatter 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
79c00ad8f2 Improve ISO week-base-year formatter 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
cde44ddb72 Improve year formatter 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
b04601b918 Switch from std::strftime/std::wcsftime to internal implementation for locale independent formats 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
d3d30a46f0 New tests 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
509eac9575 Workarounds for implementation-defined std::strftime behavior 2021-10-16 15:03:57 -07:00
Vladislav Shchapov
85b38190d1 New tests for all C++11 std::strftime format specifiers 2021-10-16 15:03:57 -07:00
Barry Revzin
7aca36bca4
Extending fmt::join to support C++20-only ranges. (#2549) 2021-10-16 10:02:03 -07:00
Josh Essman
f56756986b fix: check to make sure both 'if constexpr' and return type deduction are available
fix: remaining ifdefs
2021-10-14 10:44:24 -07:00
Victor Zverovich
dcd282bb26 Namespace qualify calls to get 2021-10-09 07:15:14 -07:00
Victor Zverovich
e1bd6cc913 Refactor FP formatting 2021-09-26 10:25:46 -07:00
Victor Zverovich
ff7e73af66 Always run grisu_gen_digits before fallback_format 2021-09-26 07:54:25 -07:00
Victor Zverovich
2976e31ac9 Refactor format_float 2021-09-25 11:20:56 -07:00
Alexey Ochapov
b4d9d82e1d
make FP formatting available to be used at compile-time (#2426)
* works only with FMT_HEADER_ONLY
* works only with float and double types (not long double)
2021-09-18 08:03:23 -07:00
Vladislav Shchapov
d9fd695ac7 Fix wchar_t tm formatting 2021-09-15 07:33:24 -07:00
Vladislav Shchapov
92614ecbf9 Optimize %T in tm formatting 2021-09-15 07:33:24 -07:00
Victor Zverovich
67cb2dad37 Optimize %F in tm formatting 2021-09-10 07:48:50 -07:00
Victor Zverovich
894faf3fed Refactor presentation types 2021-09-06 13:32:33 -07:00
Victor Zverovich
6b55c83252 is_const_formattable -> has_const_formatter 2021-09-05 08:35:08 -07:00
Victor Zverovich
2fe94ad7e3 Make specifiers support in tuple_join an opt-in 2021-09-05 07:34:06 -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
60cd5ea3f2 Add support for more formattable types in ranges 2021-09-03 14:55:41 -07:00
Victor Zverovich
5681563898 Cleanup ostream interface 2021-09-03 10:35:19 -07:00
Victor Zverovich
20931baf1d Disable fallback_formatter for arrays 2021-09-03 08:59:36 -07:00
Pierre-Antoine Lacaze
d58d19ba32
Fix an odr violation in ranges.h (#2483)
* Add a testcase demonstrating ODR violation in ranges.h

* Fix ODR violation in ranges.h

* Fix comments

Co-authored-by: Pierre-Antoine Lacaze <pa.lacaze@gmail.com>
2021-09-02 08:47:44 -07:00
Victor Zverovich
ee0659f8b6 Fix formatting of abstract classes via ostream 2021-09-02 08:19:12 -07:00
Paul Dreik
4db5723525
add fuzzers for chrono timepoint and localtime,gmtime (#2469)
* add fuzzers for chrono timepoint and localtime,gmtime

* reorder cases to improve throughput

mutating the first byte of the input now always results in picking
on of the two paths. Before, two of the four possible outcomes resulted
in doit() not being invoked.

* drop the localtime fuzzer

* inline aliases

* only fuzz std::chrono::system_clock
2021-08-29 06:58:23 -07:00
Victor Zverovich
729a44e67d Depreate strtod and remove problematic tests 2021-08-28 09:20:36 -07:00
Victor Zverovich
043e3b3429 Remove static_assert from arg_mapper 2021-08-26 20:45:01 -07:00
Victor Zverovich
8b0cb944da Fix error reporting when mixing character types 2021-08-26 18:16:05 -07:00
Victor Zverovich
6d597e39c3 Fix overload ambiguity in arg_mapper 2021-08-26 16:54:27 -07:00
Victor Zverovich
f889e52a15 Improve error reporting 2021-08-26 15:47:44 -07:00
sunmy2019
a44c8f651b
reimplement formatter<tuple_join_view> (#2457)
* reimplement `formatter<tuple_join_view>`

1. completely reimplement `formatter<tuple_join_view<Char, T...>, Char>`
2. Add some tests

* use FMT_THROW
2021-08-23 09:51:19 -07:00
Paul Dreik
6b5e6119ee set clang in one place 2021-08-22 17:52:45 -07:00
Paul Dreik
7af1dc1d27 fix UB in fuzzer common (memcpy on nullptr) 2021-08-22 17:52:45 -07:00
Paul Dreik
e77686f7a8 clang format
using clang format 11
2021-08-22 17:52:45 -07:00
Victor Zverovich
2207ea0b36 More escaping 2021-08-22 16:54:26 -07:00
Victor Zverovich
a212ff757f Escape invalid code points 2021-08-22 15:51:33 -07:00
Victor Zverovich
07d033ecb4 Fix is_printable 2021-08-22 10:37:18 -07:00
Victor Zverovich
371d8e2ee0 Escape Unicode 2021-08-22 07:55:59 -07:00
Victor Zverovich
6397095ca4 More escaping 2021-08-21 16:36:25 -07:00
Victor Zverovich
11b07a56b2 We should escape 2021-08-19 14:50:59 -07:00
Victor Zverovich
b559cfd4c0 Implement basic escaping 2021-08-19 14:12:26 -07:00
Victor Zverovich
6ea6cf9464 Add decimal separator support to float 2021-08-14 09:16:26 -07:00
Vladislav Shchapov
07211701f4
Disable the -Wstringop-overflow warning from GCC 7 (#2442) 2021-08-02 14:20:18 -07:00
Victor Zverovich
bba0a9d962 Make flush public 2021-07-30 07:02:49 -07:00
Victor Zverovich
f1794a8853 Switch to threadsafe death test style 2021-07-29 06:56:38 -07:00
Victor Zverovich
5c222f0561 Add support for nonconst formattable types 2021-07-24 09:53:53 -07:00
Spiros Tsalikis
63fe2d5bd2 Add copy constructor for dynamic_format_arg_store, and test 2021-07-23 09:35:09 -07:00
Cameron DaCamara
00235d8a99
fix module test odr violations (#2414) 2021-07-17 09:16:49 -07:00
Victor Zverovich
2038bf6183 Update format_to usage 2021-07-13 07:56:24 -07:00
mwinterb
3d53d1539d
Warning removals in test code (#2399)
* Warning removals in test code.

Mostly 0 to nullptr and adding override to virtual function implementations.

* Fix module-test.
2021-07-09 08:05:02 -07:00
Daniela Engert
f2b03facd9
Include test sources to pick up functions and classes from the module rather than from the non-modular library which is baked into the test-main library. (#2356)
This averts linker problems:
 - strong ownership model: missing linker symbols
 - weak ownership model: duplicate linker symbols

Simplify `gtest-extra.cc` while at it.
2021-07-03 07:21:54 -07:00
Benoît Lormeau
02ad5e11da
Add faint, blink, reverse and conceal to the emphases (#2394) 2021-07-02 20:03:55 -07:00
Victor Zverovich
1d7384530e Add missing presentation type checks for std::string (#2402) 2021-07-02 07:51:04 -07:00
Daniela Engert
5221242f6e Instruct msvc to report the _true_ value in __cplusplus and force _full_ C++ conformance
* do this  in _some_ tests to improve test coverage and catch possible problems due to that
 * fix invalid export of `static constexpr` constant
 * fix msvc warnings about unreachable code in high warning levels
2021-06-24 09:10:08 -07:00
Victor Zverovich
e421d52713 Simplify error handling in parse_nonnegative_int 2021-06-14 16:05:37 -07:00
sunmy2019
f28cf3302d
adding a default format for std::chrono::time_point<std::chrono::syst… (#2345) 2021-06-11 10:52:39 -07:00
Daniela Engert
55010a9d3a Support non-char overloads (module) 2021-06-11 09:38:53 -07:00
Daniela Engert
0193e7c428 Support compile-time strings and compile-time format string compilation in module
Make just the necessary parts available for lookup from client context.
2021-06-11 09:38:53 -07:00
Владислав Щапов
f6b5cc9f84 Fix chrono_test.weekday on legacy glibc 2021-06-10 16:17:10 -07:00
Daniela Engert
59a298f124 Enable enforce-checks-test for MSVC, too 2021-06-10 12:54:54 -07:00
Victor Zverovich
2039dce75f Detect consteval 2021-06-07 06:57:43 -07:00
Victor Zverovich
d551b88a6d Move is_char specializations to xchar.h 2021-06-06 15:32:30 -07:00
Victor Zverovich
16c3514d01 wchar-test -> xchar-test 2021-06-06 07:59:18 -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
Владислав Щапов
f286139d22 Fix "undefined reference to `fmt::v7::detail::basic_data<void>::digits'"
Remove unused FMT_EXTERN_TEMPLATE_API
2021-06-02 14:33:17 -07:00
Victor Zverovich
d338d66324 Cleanup the printf implementation 2021-06-01 19:30:46 -07:00
Daniela Engert
70e67ae018 Re-enable module testing
Prepare for compilation with gcc (modules branch).
2021-06-01 14:49:56 -07:00
Victor Zverovich
ad97258915 Merge branch 'master' of github.com:fmtlib/fmt 2021-06-01 13:38:26 -07:00
Victor Zverovich
ed2a6377e7 Workaround msvc constexpr issues 2021-06-01 13:32:44 -07:00
Alexey Ochapov
9976869549 fix custom types formatting at compile-time, add test 2021-06-01 11:16:05 -07:00
Victor Zverovich
bf9904ee4d Workaround msvc bugs 2021-05-31 08:25:05 -07:00
Victor Zverovich
577bce9029 Apply clang-format 2021-05-31 08:09:10 -07:00
Daniela Engert
ba4c7f193b
Swap parameter order to match #2327 (#2329) 2021-05-31 07:44:33 -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
ff37e41625 wchar.h -> xchar.h because it handles other code unit types too 2021-05-29 09:37:17 -07:00
Victor Zverovich
a9a9018191 Move wmemory_buffer to wchar.h 2021-05-29 08:26:04 -07:00
Daniela Engert
272b0f36b3
More module tests (#2309)
core.h, format.h, args.h, chrono.h, color.h, printf.h, os.h
2021-05-28 15:49:39 -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
Alexey Ochapov
ee52a6dc40
add fmt::print() overload to support compiled format (#2304) 2021-05-25 14:54:56 -07:00
Victor Zverovich
35a2c2a743 Refactor chrono formatting 2021-05-25 06:57:47 -07:00
Victor Zverovich
883d9595c5 Support alternative locale names in tests 2021-05-24 14:09:19 -07:00
Victor Zverovich
1cd9899cf3 Add initial support for weekday formatting 2021-05-24 10:21:34 -07:00
Victor Zverovich
069131dc25 Add unicode-test 2021-05-24 06:20:51 -07:00
Victor Zverovich
703005c8ba Deprecate locale.h 2021-05-22 10:21:17 -07:00
Victor Zverovich
34b8acaef7 More wchar_t-specific API to wchar.h 2021-05-21 18:24:39 -07:00
Daniela Engert
5a0d99fa0b Add a test for the module 2021-05-20 10:26:31 -07:00
Victor Zverovich
63271a51c4 Fix ADL issues 2021-05-20 06:31:43 -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
Владислав Щапов
0036a1d195 Fix issue #2274. 2021-05-10 15:57:23 -07:00
Владислав Щапов
2a9b314627 Replace fmt::error_code to std::error_code 2021-05-09 12:26:19 -07:00
Владислав Щапов
4211d86539 Add a formatter specialization for std::error_code. 2021-05-09 06:29:39 -07:00
Victor Zverovich
39f28424ca Cleanup tests 2021-05-07 21:27:58 -07:00
Victor Zverovich
2665afb515 Cleanup add-subdirectory-test 2021-05-07 16:42:02 -07:00
Victor Zverovich
d0abe7c246 Make chrono formatting locale-independent by default 2021-05-07 16:14:10 -07:00
Victor Zverovich
16f2ef91ab Replace fmt::system_error with std::system_error 2021-05-07 08:33:39 -07:00
Victor Zverovich
4b885c8633 Replace windows_error with system_error 2021-05-07 06:19:03 -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
400b953fbb Use [] instead of {} in ranges for consistency with Python format 2021-05-04 21:04:21 -07:00
Victor Zverovich
38bcc04a11 Drop range limit and cleanup tests 2021-05-04 20:53:56 -07:00
Victor Zverovich
c738c3431f Cleanup tests 2021-05-04 17:23:13 -07:00
Victor Zverovich
ed7c4320f6 Cleanup tests 2021-05-02 09:28:38 -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
Victor Zverovich
c9c0e5077d Cleanup tests 2021-04-30 06:42:38 -07:00
Victor Zverovich
ccf4ccde23 Cleanup tests and format string compilation 2021-04-29 19:50:04 -07:00
Victor Zverovich
e96a92f869 Cleanup tests and format string compilation 2021-04-29 16:21:08 -07:00
Alexey Ochapov
fd43e4dcbc gtest: fix std::is_trivially_copy_constructible for GCC 4.8 & 4.9 properly
`std::is_pod<T>` was deprecated in C++20

original (pre `is_pod`) error on GCC 4.8:
```
/fmt/test/gtest/gtest.h: In static member function 'static constexpr bool testing::internal::MatcherBase<T>::IsInlined()':
/fmt/test/gtest/gtest.h:6512:12: error: 'is_trivially_copy_constructible' was not declared in this scope
            std::is_trivially_copy_constructible<M>::value &&
            ^
/fmt/test/gtest/gtest.h:6512:45: error: expected primary-expression before '>' token
            std::is_trivially_copy_constructible<M>::value &&
                                                  ^
/fmt/test/gtest/gtest.h:6512:46: error: '::value' has not been declared
            std::is_trivially_copy_constructible<M>::value &&
                                                   ^
```
2021-04-29 07:11:49 -07:00
Alexey Ochapov
3d51ccdaae gtest: remove obsolete GTEST_LANG_CXX11 compile definition setting 2021-04-29 07:11:49 -07:00
Alexey Ochapov
833377ff1e gtest: add .clang-format file into test/gtest directory to prevent formatting there 2021-04-29 07:11:49 -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
355be4b13f Make FMT_COMPILE fallback on runtime without if constexpr (#2261) 2021-04-28 09:11:47 -07:00
Victor Zverovich
847aac4315 Follow naming conventions in tests 2021-04-25 21:26:30 -07:00
Victor Zverovich
39818e7979 Cleanup core-test 2021-04-25 17:59:23 -07:00
Ilya Kurdyukov
0e6f989b0d
__THROW warning fix for e2k (#2253) 2021-04-25 08:51:37 -07:00
Alexey Ochapov
ca821982ee use named arg with static name in compile-time API
to get arg index by name at compile-time
2021-04-25 07:53:49 -07:00
Victor Zverovich
bb006f9735 Replace TYPED_TEST_CASE with TYPED_TEST_SUITE 2021-04-24 17:46:49 -07:00