Commit Graph

1502 Commits

Author SHA1 Message Date
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
Victor Zverovich
6956b10b2d Fix gcc 4.8 build 2021-04-24 11:04:34 -07:00
Victor Zverovich
b4f9a05894 Update gtest 2021-04-24 11:03:40 -07:00
Victor Zverovich
8a040d187a Cleanup core-test 2021-04-23 20:07:48 -07:00
Victor Zverovich
5b2c740ad8 Remove deprecated APIs 2021-04-23 15:27:25 -07:00
Victor Zverovich
b9ab5c8836 Remove printf.h dependency on ostream.h 2021-04-23 10:42:57 -07:00
Alexey Ochapov
1d4199f46b
fix udl_compiled_string with non-byte chars (e.g. wchar) (#2242) 2021-04-19 08:29:35 -07:00
crbrz
9260114162
Ranges wide strings support (#2236)
* Ranges copy wchar_t

* arg_join formatter not working for wide strings

* Added ranges wide string tests

Co-authored-by: Cristi <cristi@emailaddressmanager.com>
2021-04-16 06:25:35 -07:00
denchat
24c9751558
Try to suppress MVSC warn of narrowing (#2230) 2021-04-13 07:30:43 -07:00
Alexey Ochapov
b441532396 CI linux: add clang++-11 C++20 (with LLVM libc++) build
* find-package-test fixed by passing CXX_FLAGS, i.e. -stdlib=libc++
 * std::array usage in compile-test.cc replaced with plain array, because
   <array> header was not included
2021-04-10 07:20:05 -07:00
denchat
273d8865e3
Suppress redef warning of _CRT_SECURE_NO_WARNINGS if any. (#2218) 2021-04-08 11:56:35 -07:00
Victor Zverovich
5a8bf1f6a3 Workaround hexfloat inconsistency on windows (#2205) 2021-04-07 11:20:08 -07:00
Victor Zverovich
06b3a1000c Add support for time points with arbitrary durations (#2208) 2021-04-02 11:17:14 -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
afe23e7f10 Don't call fileno on NULL file in tests (#2196) 2021-03-30 10:41:12 -07:00
vtta
14848875bf
Fix: fmt::ostream cannot be moved while holding buffered data #2197 (#2198)
* Add a test case: move ostream while holding data

* Fix moving ostream while holding data

Co-authored-by: Junliang HU <jlhu@cse.cuhk.edu.hk>
2021-03-30 08:43:26 -07:00
Vladislav Shchapov
4dc7170d21
Fix C++17 builds: (#2192)
- Fix C++17 Visual Studio builds.
- Use C++17 for `windows-2019` builds.
- Removed options for unsupported compiler (MSVC11).
- Removed options, not needed after enabling C++11+ features in gmock/gtest.
2021-03-26 06:19:43 -07:00
Victor Zverovich
417e1cee9e Stop using deprecated UDL templates 2021-03-19 08:34:55 -07:00
Victor Zverovich
14a2a64df4 Fix handling of formattable types with to_string_view (#2181) 2021-03-19 06:43:38 -07:00
Victor Zverovich
6ae402fd0b Fix handling of types with to_string_view and formatter specialization (#2180) 2021-03-18 11:25:43 -07:00
Victor Zverovich
a6408a3b09 Add args-test 2021-03-18 09:04:17 -07:00
Victor Zverovich
1147782c79 Fix an ambiguous call to check caused by ADL (#2184) 2021-03-17 20:59:36 -07:00
Victor Zverovich
6151d0dc1e Fix the comment 2021-03-14 09:26:18 -07:00
Victor Zverovich
5a1127b726 Don't wrap named arg in cref and clarify docs 2021-03-14 09:08:08 -07:00
Victor Zverovich
f9e0e90441 Apply clang-format 2021-03-10 12:08:02 -08:00
Victor Zverovich
60f5d24411 Simplify arg_formatter 2021-03-10 09:35:48 -08:00
Alexey Ochapov
6a9016ea60
fix formatted_size with "compiled format" as argument (#2161) 2021-03-07 06:44:36 -08: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
John Steele Scott
772aeca338
Don't include <cassert>. (#2148) (#2152)
* Don't include <cassert>. (#2148)

This commit replaces use of the assert() macro in format-inl.h with
FMT_ASSERT(). This allows us to drop the cassert include.

* FMT_GCC_VERSION is not defined when we include test-assert.h, use __GCC__ instead.

* Don't explicitly suppress GCC's -Wterminate in tests' FMT_ASSERT.

Throwing from a separate function is enough to silence the warning, no need to
explicitly suppress it.

* Remove messages from assertions added in 2f699d2.

* Correct formatting around throw_assertion_failure().
2021-03-04 07:28:04 -08:00
Alexey Ochapov
684b5b0e40
Fix fallback to runtime API from compile-time API (#2143)
* fix fallback to the runtime API, add FMT_ENABLE_FALLBACK_TO_RUNTIME_API define, add test

* remove `FMT_ENABLE_FALLBACK_TO_RUNTIME_API`

* pass format string to format_to() inside format_to_n() in compile-time API

instead of compiling it inside format_to_n(), to eliminate code duplication
2021-03-04 07:20:57 -08:00
Victor Zverovich
835b910e7d Add an is_formattable trait 2021-02-28 15:25:33 -08:00
Alexey Ochapov
29cc8282b1 update chrono duration formatter (constness), use it in compile-test for specs checks 2021-02-20 11:50:12 -08:00
Alexey Ochapov
499047e132 fix incorrect indexing mode for named args, update tests 2021-02-20 11:50:12 -08:00
Alexey Ochapov
78c67157c1 prepare tests, fix incorrect handling of named args with simple {} replacement fields 2021-02-20 11:50:12 -08:00
Alexey Ochapov
95e1aa2dc5 add support for manual indexing and named fields, add tests 2021-02-20 11:50:12 -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