Ashton Fagg
506ff320f2
Fix build failure when not using fcntl with -Werror ( #1990 )
2020-11-06 15:39:59 -08:00
Victor Zverovich
49544ea943
Fuzz fallback formatter
2020-11-03 19:34:35 -08:00
Victor Zverovich
6b7bfed40c
Fix fallback float formatter at assymetric bounds ( #1976 )
2020-11-03 19:19:10 -08:00
Jonathan Gopel
e904e891bd
🎨 🐛 Rename all shadowed types and variables
2020-11-03 07:30:27 -08:00
Jonathan Gopel
b3a4f28ad1
Fix implicit signedness conversion warning ( #1963 )
...
Problem:
- On Apple clang 11.0.3 (clang-1103.0.32.62), pedantic mode compilation
generates the following error:
test/std-format-test.cc:114:22: error: implicit conversion changes
signedness: 'int' to 'size_t' (aka 'unsigned long')
[-Werror,-Wsign-conversion]
width_arg_id = c - '0';
~ ~~^~~~~
Solution:
- Use a `to_unsigned` to make the conversion explicit. This is
guaranteed to be safe due to the check before the ASCII-to-int
conversion.
2020-10-29 06:26:18 -07:00
Vladislav Shchapov
97c8873214
Allocator::max_size support in basic_memory_buffer ( #1960 )
2020-10-29 06:17:00 -07:00
kitegi
f4ca065cfb
Range support
2020-10-28 05:35:37 -07:00
Victor Zverovich
86287b8d56
Optimize common case in parse_format_specs
2020-10-21 17:16:58 -07:00
Victor Zverovich
0ecb3d1829
Optimize alignment parsing
2020-10-21 12:45:11 -07:00
Victor Zverovich
e57ec7d563
Merge vformat_to overloads
2020-10-20 17:39:50 -07:00
Victor Zverovich
e3b4c22ec9
Simplify is_output_iterator
2020-10-20 14:09:57 -07:00
Victor Zverovich
20d4f2e836
Fix handling of weird character types when parsing sign ( #1932 )
2020-10-17 09:40:30 -07:00
Victor Zverovich
bd3c792507
Fix float fuzzer
2020-10-16 07:35:53 -07:00
Bart Siwek
271eff149f
Make classes derived from buffer<T> final to silence the virtual destructor warning. ( #1937 )
...
Co-authored-by: Bart Siwek <bsiwek@cisco.com>
2020-10-15 17:41:56 -07:00
Victor Zverovich
811c8b58c5
Add float fuzzer and cleanup
2020-10-14 07:39:51 -07:00
Victor Zverovich
82c4e2236a
Cleanup fuzzing
2020-10-13 09:08:04 -07:00
Victor Zverovich
63e40c9614
Fix naming of fuzzers
2020-10-12 16:48:25 -07:00
Victor Zverovich
af28305961
Cleanup
2020-10-11 10:13:42 -07:00
Victor Zverovich
48ea8193df
Explain why assert-test is a separate test
2020-10-11 10:13:42 -07:00
Victor Zverovich
1d112bdd1e
Remove old test
2020-10-11 10:13:42 -07:00
Victor Zverovich
7e56b6b6cb
Fix coding style and remove duplicate fuzzer
2020-10-11 08:07:52 -07:00
Victor Zverovich
a5e7e7db95
Fix handling of thousand separator ( #1927 )
2020-10-10 07:23:36 -07:00
Victor Zverovich
7eddbfed53
Cleanup exponent handling in write_float
2020-10-07 15:58:43 -07:00
Victor Zverovich
a18b3fbbdc
Fix fixed precision handling when rounding ( #1917 )
2020-10-07 07:42:23 -07:00
Victor Zverovich
af8a180aed
Make GetCachedPower test more precise
2020-10-04 08:00:47 -07:00
Victor Zverovich
90ef46df0b
Fix dragonbox integration
2020-09-28 18:10:46 -07:00
Victor Zverovich
79694d424c
Fix WriteConsole signature
2020-09-27 14:26:28 -07:00
Victor Zverovich
51f2e2ca27
Move nan test to where it belongs
2020-09-27 12:50:18 -07:00
Victor Zverovich
68555fdbd2
Make format-test not depend on color.h
2020-09-27 09:17:57 -07:00
Victor Zverovich
a905d8f704
Merge grisu-test into format-test
2020-09-26 08:23:16 -07:00
Victor Zverovich
c156093ffd
Fix carry in fallback_format
2020-09-25 10:12:44 -07:00
Victor Zverovich
6c025520aa
Test that max_k is correctly defined
2020-09-23 15:44:37 -07:00
Victor Zverovich
2d4fde3a2e
Don't emit trailing zero for consistency with std::format
2020-09-23 09:19:12 -07:00
Victor Zverovich
aa729bf25b
Remove dead code
2020-09-22 16:58:02 -07:00
jk-jeon
6bcde9aab2
https://github.com/fmtlib/fmt/pull/1882#issuecomment-696823912 ( #1894 )
2020-09-22 10:33:52 -07:00
Victor Zverovich
16410056bf
Optimize copy_str for counting_iterator
2020-09-22 07:56:09 -07:00
Victor Zverovich
2f7e08856b
Disable range formatter if value type is not formattable ( #1885 )
2020-09-20 08:37:49 -07:00
Victor Zverovich
c46a8de4e1
Simplify test
2020-09-20 07:24:24 -07:00
rimathia
2696dc9273
add forgotten template argument to make_format_args which made some u… ( #1877 )
...
* add forgotten template argument to make_format_args which made some uses of FMT_COMPILE not work anymore after 54daa0864a
, add more elaborate test cases to compile-test as regression tests
* fix old-style cast which gcc on travis thankfully doesn't accept anymore
* hopefully last forgotten (void*)
2020-09-20 06:51:11 -07:00
Victor Zverovich
7e6827521a
Remove trailing zeros when using fallback formatter ( #1873 )
2020-09-17 08:16:21 -07:00
Victor Zverovich
1d696dc280
Handle exotic character types in compilation
2020-09-17 07:12:34 -07:00
Alexey Ochapov
f674434a67
Add format_to_n overload that accepts FMT_COMPILE (from #1767 ) ( #1869 )
...
* Add format_to_n overload that accepts FMT_COMPILE
* add FormatToNWithCompileMacro test into CompileTest
Co-authored-by: Dmitriy Kurkin <Dmitriy.Kurkin@itiviti.com>
2020-09-15 07:28:06 -07:00
Victor Zverovich
5b5a597198
Fix handling of wide alignment
2020-09-15 06:53:06 -07:00
Victor Zverovich
dce8e49b4f
Handle float in fallback formatter
2020-09-13 09:28:40 -07:00
Victor Zverovich
4f2ee8921d
Use built-in FP formatter for any precision
2020-09-11 07:20:16 -07:00
Victor Zverovich
9f312fe87e
Implement fallback FP formatting with given precision ( #1526 )
2020-09-07 09:34:30 -07:00
Victor Zverovich
fb289cf56b
Fix coding conventions
2020-09-06 09:26:32 -07:00
Denis Blank
bff4d18efb
Add color format_to overloads
...
* Fix variable size basic_memory_buffer colorization
* Fix an unused arguments warning on GCC that blocks the CI otherwise
* Ref #1842
* Ref #1593
2020-09-06 08:24:15 -07:00
Victor Zverovich
6cccdc24bc
Fix move constructor ( #1844 )
2020-09-01 08:48:56 -07:00
Adam Burgess
f39e6fb617
Add formatters for chrono::time_point<system_clock> ( #1837 )
...
Add formatters for chrono::time_point and helper overloads for localtime/gmtime(time_point)
Fixes #1819
2020-08-28 07:41:38 -07:00
Victor Zverovich
5dff01d31b
Add complex tests
2020-08-26 11:48:50 -07:00
Alexey Ochapov
1651b2d433
Fix detail::write with fallback formatter ( #1829 )
...
* add support for fallback_formatter in detail::write
* add ToString test into OStreamTest
to check fmt::to_string() with class that has output stream operator
* add WithOstreamOperator test into CompileTest
to check fmt::format() with FMT_COMPILE() and class that has output stream operator
* use conditional_t inside detail::write instead of 2 overloads
* Revert "add WithOstreamOperator test into CompileTest"
* remove Context from template parameters in detail::write
2020-08-20 06:41:09 -07:00
Barry Revzin
6be6544668
Fixing buffer_appender's ++ slicing ( #1822 )
...
* Fixing buffer_appender's ++ slicing.
* This test requires C++14.
* Removing string_view dependency.
* Simplifying test case.
* Adding message to static_assert
2020-08-18 12:37:56 -07:00
medithe
f9f02df719
CMakeLists.txt: Clang-warnings: removed -Wno-sign-conversion ( #1817 )
...
* CMakeLists.txt: Clang-warnings: removed -Wno-sign-conversion
* test/ranges-test.cc: changed type of integer literals to unsigned
* test/format-test.cc: fixed implicit conversion changes signedness warning in clang
Co-authored-by: Martin Wührer <martin.wuehrer@artech.at>
2020-08-14 13:58:20 -07:00
Victor Zverovich
54daa0864a
Add dynamic width support to FMT_COMPILE ( #1809 )
2020-08-10 09:40:11 -07:00
Victor Zverovich
4fd95e4b4d
Don't remove trailing zeros with #
2020-08-08 08:14:39 -07:00
Victor Zverovich
065889a593
Use correct capacity in iterator_buffer ( #1807 )
2020-08-08 07:01:21 -07:00
Barry Revzin
d0dd678693
Adding convenience append(range)
2020-08-08 06:33:46 -07:00
Victor Zverovich
279d698e1b
Fix handling of default alignmment with locale ( #1801 )
2020-08-03 10:51:42 -07:00
Victor Zverovich
76cfb50b2d
Test complex formatter
2020-08-03 10:05:18 -07:00
Victor Zverovich
7c4c5c79d2
Make buffer size configurable
2020-08-01 10:53:58 -07:00
Victor Zverovich
21c8b5c142
Report error on missing named argument ( #1796 )
2020-07-30 07:16:15 -07:00
Victor Zverovich
d82fdcc9e2
Fix handling of iterators in locale-specific formatting ( #1782 )
2020-07-30 07:03:11 -07:00
Tony E Lewis
febffa4e64
Make join() handle non-const-only begin/end ranges ( #1786 )
...
See fmtlib/fmt#1784 .
Add tests that demonstrate the problem and check obvious variations.
2020-07-21 12:13:00 -07:00
Raul Tambre
26b47b6fb5
Bump tested CMake version to 3.18
...
Use the version range feature introduced in 3.12. On CMake <3.12 the extra dots are simply interpreted as extra version number separators.
The fallback for ancient CMake versions is kept.
2020-07-19 08:50:34 -07:00
Victor Zverovich
b17d5c4f5d
Fix a regression in handling digit separators ( #1782 )
2020-07-18 08:31:47 -07:00
Victor Zverovich
c26349f4d2
Improve error reporting
2020-07-14 12:06:12 -07:00
Dmitriy Vetutnev
a03bd3ddb0
Autodetect MSVC static runtime ( #1770 )
...
* Autodetect MSVC static runtime
* Update condition (MSVC)
2020-07-13 06:11:23 -07:00
Victor Zverovich
16cac46a09
Improve handling of streamable and convertible to bool types ( #1766 )
2020-07-12 08:34:45 -07:00
Victor Zverovich
415cd51913
direct_buffered_file -> ostream
2020-07-11 17:29:17 -07:00
Victor Zverovich
e1bfb59619
Fix handling of code units in compile
2020-07-11 09:03:21 -07:00
Victor Zverovich
e4f57bfd7f
Add an overload of write for buffer_appender
2020-07-11 08:20:30 -07:00
Victor Zverovich
d870468159
Make append work with fixed-size buffer
2020-07-11 07:27:20 -07:00
Victor Zverovich
e8ec09ae83
Cleanup core-test
2020-07-10 21:25:27 -07:00
Victor Zverovich
a2c4fed981
Double buffering no more
2020-07-10 20:35:14 -07:00
Victor Zverovich
60c43e8703
Apply clang-format
2020-07-09 09:06:24 -07:00
Victor Zverovich
b998e0f30b
Reduce symbol sizes and simplify iterator use
2020-07-09 08:51:43 -07:00
Victor Zverovich
01309a34ab
Deprecate arg_formatter
2020-07-04 07:29:11 -07:00
Victor Zverovich
56fed78149
FMT_NUMERIC_ALIGN -> FMT_DEPRECATED_NUMERIC_ALIGN
2020-07-03 08:53:01 -07:00
Victor Zverovich
56e63078ff
Make the n specifier an opt-in
2020-07-03 08:02:48 -07:00
Victor Zverovich
f69b6eaabd
Add a simple buffered stream with no sync
2020-06-28 09:55:29 -07:00
Victor Zverovich
98a7a8b405
Update changelog and disable internal
2020-06-26 19:07:33 -07:00
Victor Zverovich
4e94c649f9
Deprecate compile
2020-06-23 14:03:37 -07:00
Victor Zverovich
1a83443e6c
Add user-defined type support to compilation
2020-06-23 12:45:57 -07:00
Victor Zverovich
2cac8a9d2e
Reintroduce UDT support to fmt::to_string and test ADL
2020-06-21 09:21:07 -07:00
Victor Zverovich
9a4cc88426
Add FMT_COMPILE support to format_to
2020-06-20 15:15:41 -07:00
Victor Zverovich
397ad1bec3
Optimize common case
2020-06-15 18:30:31 -07:00
Victor Zverovich
ab2f8484e0
Finish text::format
2020-06-14 11:04:41 -07:00
Victor Zverovich
d702a68df2
Fix formatting of bool with FMT_COMPILE and add more tests
2020-06-14 07:16:50 -07:00
Victor Zverovich
8c88abde64
Fix sign handling in 'L'
2020-06-13 06:57:19 -07:00
Victor Zverovich
16637341b9
Enable compilation for all types
2020-06-12 13:27:21 -07:00
Victor Zverovich
936a1833c2
Add default_arg_formatter
2020-06-08 08:14:34 -07:00
Victor Zverovich
50bad7d62d
Optimize format string parsing
2020-06-06 10:15:19 -07:00
Victor Zverovich
f11e968708
Optimize format string parsing
2020-06-06 08:15:33 -07:00
rimathia
95c6ac0cc8
fix typo which caused the loss of the counting information when using a printf context with a truncating_iterator
2020-06-05 07:37:54 -07:00
Victor Zverovich
3245145a41
Remove undocumented buffer_range and output_range
2020-05-30 13:07:52 -07:00
Victor Zverovich
f095c67b6a
Remove uses of buffer_range
2020-05-29 18:14:03 -07:00
Victor Zverovich
19c5b5d159
Simplify arg_formatter
2020-05-29 16:53:12 -07:00
Victor Zverovich
519571edec
Simplify arg_formatter_base
2020-05-29 14:44:18 -07:00
rimathia
8c8f74a870
fix zero flag for char types and make zero flag ignored if a precision is specified
2020-05-23 12:46:26 -07:00
Victor Zverovich
943532fece
Make ostream formatter work with compile-time format strings ( #1692 )
2020-05-20 14:59:57 -07:00
Barry Revzin
c66aae1652
Adding sentinel support to fmt::join(). ( #1689 )
2020-05-18 06:31:01 -07:00
Victor Zverovich
6d66de3805
Add c specifier support to integral types ( #1652 )
2020-05-17 08:44:59 -07:00
rimathia
6b219a58db
fix interaction of space flag and '+' flag, as well as '-' flag and '0' flag ( #1687 )
2020-05-17 04:27:18 -07:00
rimathia
96c18b26c2
make plus flag for printf not be ignored for char argument ( #1683 )
...
* make plus flag for printf not be ignored for char argument
* clarify overwriting of alignment specifiers for printf with char argument
2020-05-15 06:45:51 -07:00
Vladimir Solontsov
922ea924bf
Make dynamic_format_arg_store reusable and add reserve() ( #1677 )
...
Implemented #1674 : make dynamic_format_arg_store reusable and add
reserve() for better memory menagement.
2020-05-12 11:00:42 -07:00
Victor Zverovich
8069265373
internal -> detail ( #1538 )
2020-05-10 07:34:30 -07:00
Victor Zverovich
02a6fe59fb
Named arguments go brrr
2020-05-09 13:22:38 -07:00
Vladimir Solontsov
68201831a5
Support named args in dynamic_format_arg_store ( #1655 ). ( #1663 )
...
Dynamic arguments storage. Implementation of enhancement from issue
#1170 .
2020-05-09 06:25:03 -07:00
Victor Zverovich
7f723fbcb8
Consistently namespace qualify size_t
2020-05-07 15:59:46 -07:00
Victor Zverovich
c06851456d
Purge basic_writer
2020-05-07 15:04:48 -07:00
Victor Zverovich
2f05054dd3
Purge basic_writer
2020-05-07 11:35:41 -07:00
Victor Zverovich
8f511fc12f
Make copyfmt not throw ( #1666 )
2020-05-06 17:38:46 -07:00
Victor Zverovich
d6cea50d01
Remove deprecated APIs
2020-05-05 20:03:48 -07:00
Victor Zverovich
bab3f58003
Refactor pointer formatting
2020-05-03 20:33:25 -07:00
Victor Zverovich
a71bc9c825
Use '0' fill with numeric align for consistency with std::format
2020-05-03 09:52:31 -07:00
asraa
e2ff910675
Replace FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION with fmt-specific macro ( #1650 )
...
Signed-off-by: Asra Ali <asraa@google.com>
2020-04-29 09:12:43 -07:00
Victor Zverovich
1e1ac6e964
Check dynamic width/precision id at compile time ( #1614 )
2020-04-25 08:36:24 -07:00
Victor Zverovich
e51c449fe6
Revert "Check dynamic widht/precision id at compile time ( #1614 )"
...
This reverts commit 7d748a6f82
.
2020-04-25 07:43:56 -07:00
Victor Zverovich
0463665ef1
Don't access a C string past precision in printf ( #1595 )
2020-04-22 17:10:23 -07:00
Victor Zverovich
7d748a6f82
Check dynamic widht/precision id at compile time ( #1614 )
2020-04-22 14:45:37 -07:00
Victor Zverovich
2b75bd7ce6
Get rid of do_check_format_string
2020-04-22 12:15:29 -07:00
Victor Zverovich
811b0f9054
Enable compile-time error tests
2020-04-22 11:00:20 -07:00
Victor Zverovich
5944fcad37
Remove remaining wchar_t instantiation
2020-04-19 16:48:15 -07:00
Victor Zverovich
c9a57b9a81
Fix incorrect assumptions about nul termination
2020-04-18 06:51:52 -07:00
Victor Zverovich
8a4630686e
Improve handling of named arguments
2020-04-14 11:56:55 -07:00
Victor Zverovich
e99809f29d
Fix ostream support in sprintf ( #1631 )
2020-04-12 07:53:17 -07:00
Victor Zverovich
bbb6b357c7
Add floating-point L specifier ( #1624 )
2020-04-10 07:16:20 -07:00
Victor Zverovich
7d01859ef1
Fix handling of unsigned char strings in printf
2020-04-08 13:05:42 -07:00
Victor Zverovich
d1d653d895
Implement the L specifier
2020-04-02 06:58:38 -07:00
Victor Zverovich
73c8437485
Follow naming conventions
2020-04-01 09:30:28 -07:00
Victor Zverovich
e588b02b17
Fix posix-mock-test
2020-04-01 08:42:14 -07:00
Victor Zverovich
80ce222ca6
Fix wide print overload ( #1609 )
2020-03-28 09:44:18 -07:00
Scott Ramsby
664dd88e31
Enable FMT_STRING() use with types other than string literals
2020-03-24 12:56:21 -07:00
Victor Zverovich
69779b4ed6
Fix handling of small precision in general format
2020-03-24 09:01:57 -07:00
Victor Zverovich
dd97f4920c
Improve exception safety in dynamic_format_arg_store
2020-03-21 08:58:50 -07:00
Spirrwell
2559983e7a
Color formatting fixed for wide strings (fixes issue #1594 ) ( #1596 )
...
* Use std::char_traits::length for ansi_color_escape::begin
-Fixes issue #1594 https://github.com/fmtlib/fmt/issues/1594
2020-03-17 06:24:42 -07:00
Victor Zverovich
9f70fc3e7a
Minor tweaks for dynamic_format_arg_store
2020-03-16 07:58:15 -07:00
Vladimir Solontsov
6012dc9ab4
Dynamic arguments storage. Implementation of enhancement from issue #1170 . ( #1584 )
2020-03-16 07:00:29 -07:00
Nikolay Rapotkin
85050aa2e6
Ability to join elements of std::initializer_list was added
2020-03-15 16:10:00 -07:00
Victor Zverovich
ff486a72a7
Allow leading zeros in precision ( #1579 )
2020-03-14 11:37:38 -07:00
Victor Zverovich
678341275b
Deprecate fmt::char8_t
2020-03-14 10:32:34 -07:00
Victor Zverovich
61c5a51604
Fix handling of empty tuples ( #1588 )
2020-03-14 07:41:08 -07:00
Victor Zverovich
f72a905eb3
Fix handling of volatile enums
2020-03-11 08:40:57 -07:00
Victor Zverovich
b1adaa9881
Remove gcc 4.4 workaround
2020-03-07 14:50:52 -08:00
Victor Zverovich
153f753bde
Deprecate undocumented _u suffix
2020-03-04 19:20:19 -08:00
Victor Zverovich
eafd079868
Improve width computation
2020-03-04 17:17:34 -08:00
Victor Zverovich
1e8493196e
Make compile-time checks in format_to handle references
2020-03-01 07:57:34 -08:00
Victor Zverovich
13d82e32bd
Don't use internal GTest API
2020-02-24 11:32:34 -08:00
Victor Zverovich
f733882b55
Remove misleading FMT_USE_WINDOWS_H
2020-02-14 14:09:27 +01:00
Victor Zverovich
1f1b50707c
Make formatter override implicit conversion to a C string
2020-02-07 19:24:36 -08:00
Victor Zverovich
b55ea58705
string_view::char_type -> value_type ( #1539 )
2020-02-01 12:27:44 -08:00
zeffy
1acb73f970
Fix formatting std::chrono::duration types to wide strings ( #1533 )
...
* Fix formatting chrono durations to wide strings
* Make format buffers const correct
* Add FormatWide chrono test case
* Fix incorrect wide encoding of 'µs'
I think might be a source file encoding issue, so I used \u00B5 instead.
* Update FormatWide test to use proper encoding of µs
* Revert changes to format_localized's parameters
* Use different overload of `std::time_put<T>::put` to avoid needing a format string
* Use utf8_to_utf16 instead of having redundant overloads of get_units
* Revert some minor changes
* Remove FMT_CONSTEXPR from expression
This should hopefully fix compilation on VS <2019
* Make suggested changes from code review
* Run clang-format on chrono.h
* Make sure unit isn't null before constructing a string_view from it
2020-01-23 18:48:36 -08:00
Victor Zverovich
09a13244c8
Disallow passing non-string-literals to FMT_STRING
2020-01-22 21:05:46 -08:00
Victor Zverovich
419db8baa1
Fix length computation of constexpr C strings
2020-01-22 18:25:07 -08:00
Victor Zverovich
b4218aa0f8
Test invalid fill
2020-01-19 16:52:36 -08:00
Victor Zverovich
e5f2f8ce7a
Add variable-width fill support ( #1109 )
2020-01-19 14:49:51 -08:00
Victor Zverovich
c8dd9cc99d
Use type_identity to block unnecessary template argument deduction (thanks Tim Song)
2020-01-15 10:27:50 -08:00
Victor Zverovich
9e3f3e8cff
Fix handling of output iterators in format_to_n ( #1506 )
2020-01-05 09:59:01 -10:00
Daniela Engert
cb8e7caf7c
Convert 'char8_t' character sequences to 'char' sequences
...
Otherwise, Google Test will insist on inserting 'char8_t' NTBS into 'char' streams, but basic_ostream<char>::operator<< overloads taking 'char8_t' arguments are defined as deleted by P1423.
Handling individual 'char8_t's is done inline.
This fixes the compilation errors seen in C++20 mode beginning with VS2019 Update 2.
Signed-off-by: Daniela Engert <dani@ngrt.de>
2020-01-04 07:01:48 -10:00
Victor Zverovich
c85efef312
More showpoint fixes and tests ( #1498 )
2019-12-30 13:08:35 -10:00
Victor Zverovich
f219dcd59b
Add fmt::bytes
2019-12-24 10:45:15 -08:00
Victor Zverovich
dea7fde8b7
Deprecate u8string_view
2019-12-24 09:44:57 -08:00
Victor Zverovich
e6b37b4aff
Handle block boundaries in utf8_to_utf16
2019-12-21 16:33:34 -08:00
Victor Zverovich
8cf4c52068
Apply clang-format
2019-12-21 13:10:45 -08:00
Victor Zverovich
74532c23a3
Make type a scoped enum
2019-12-21 12:22:17 -08:00
Victor Zverovich
b308159be5
Make round_direction a scoped enum
2019-12-21 09:24:42 -08:00
Victor Zverovich
1b1c70108a
trailing_zeros -> showpoint
2019-12-18 12:12:09 -08:00
Victor Zverovich
1afe201ae8
Handle block boundaries in utf8_to_utf16
2019-12-18 10:35:51 -08:00
Victor Zverovich
9ea42fb26e
Rename posix-test to os-test
2019-12-15 16:43:40 -08:00
Victor Zverovich
da2569827e
posix.cc -> os.cc
2019-12-15 12:36:15 -08:00
Victor Zverovich
35959a31d7
Move OS-specific APIs to a separate header
2019-12-15 11:46:45 -08:00
Victor Zverovich
ec2463c905
Implement utf8_to_utf16 using utf8_decode
2019-12-15 09:35:26 -08:00
Victor Zverovich
9e450911fa
Give an error on precision overflow
2019-12-14 07:45:27 -08:00
Victor Zverovich
9f2e7edaeb
Fix handling of types convertible to std::string_view
2019-12-09 13:25:08 -08:00
Victor Zverovich
fd52de0c6b
Add FMT_CUDA_TEST CMake option to enable cuda-test
2019-12-09 07:30:34 -08:00
Victor Zverovich
73a16b827f
Fix handling of int128_t in format-impl-test ( #1461 )
2019-12-08 17:07:20 -08:00
Florin Iucha
d3aa0c3a28
Clean-up sign-conversion warnings in test code
2019-12-08 16:07:43 -08:00
Victor Zverovich
31de9a1b80
Revert "Clean-up sign-conversion warnings in test code"
...
This reverts commit 227bfe62dd
.
2019-12-08 15:47:24 -08:00
Florin Iucha
227bfe62dd
Clean-up sign-conversion warnings in test code
2019-12-08 15:21:38 -08:00
Deniz Evrenci
1ab80aa92c
Fix handling of types with custom formatters that are convertible to std::string_view
2019-12-06 11:40:21 -08:00
Victor Zverovich
8bbe76af3a
Add a missing decimal point in exponent notation with trailing zeros
2019-12-02 11:36:33 -08:00
Victor Zverovich
6037b3cae9
Fix dangling else problem in FMT_ASSERT
2019-11-30 07:52:33 -08:00
Victor Zverovich
2f9acd1838
Remove dependency on <cassert>
2019-11-29 09:37:18 -08:00
Victor Zverovich
b994a0ab13
Fix handling of missing fraction in snprintf_float
2019-11-29 06:17:29 -08:00
Victor Zverovich
bb205d940d
Fix fallback pointer formatting on big endian
2019-11-29 05:15:59 -08:00
Victor Zverovich
9c7e2a6c6f
Add missing newline
2019-11-27 11:06:40 -08:00
Victor Zverovich
c3be0f593d
Refactor floating-point formatting
2019-11-27 08:08:22 -08:00
Victor Zverovich
c68703c9f4
float_spec -> float_specs
2019-11-26 15:53:24 -08:00
Victor Zverovich
3de36e9348
Enable -Wswitch-enum in CI
2019-11-26 10:17:48 -08:00
Victor Zverovich
0d07db1234
Fix handling of streamable and convertible to string types
2019-11-25 16:46:33 -08:00
Victor Zverovich
d19ed6716d
Fix hexfloat buffer reallocation
2019-11-25 15:54:04 -08:00
Victor Zverovich
99b6e928d4
Fix handling of types with deleted rvalue conversion to string ( #1421 )
2019-11-25 08:30:47 -08:00
Victor Zverovich
111fc127fe
Remove fp::operator-
2019-11-24 13:28:15 -08:00
Victor Zverovich
6003ec3f25
Simplify Grisu implementation
2019-11-24 13:24:28 -08:00
Victor Zverovich
28d7191c27
Don't print trailing zero with fixed, precision=0, and showpoint ( #1417 )
2019-11-24 08:23:10 -08:00
Victor Zverovich
43271ba8e8
Handle null terminator at the end of the buffer
2019-11-24 07:15:25 -08:00
Victor Zverovich
4cf59ce734
Integrate Grisu and sprintf digit generators
2019-11-23 06:56:29 -08:00
Victor Zverovich
7395472dde
Refactor floating-point formatting
2019-11-22 18:49:19 -08:00
Victor Zverovich
3e1f70fe02
Merge write_fp into write
2019-11-20 12:20:17 -08:00
Victor Zverovich
66d7746bb3
Use grisu for exponent notation
2019-11-19 16:55:11 -08:00
Victor Zverovich
57b6f2966d
Deprecate the fmt macro
2019-11-19 11:28:17 -08:00
Leon Klingele
78842ce0d6
test: add default constructor for a const value
...
This fixed a compilation error of the OS X 10.11.6 C++ compiler:
./fmt/test/format-test.cc:1861:16: error: default initialization of an object of const type 'const Answer' without a user-provided default constructor
const Answer const_answer;
^
{}
2019-11-19 08:32:35 -08:00
Victor Zverovich
5420bcce2d
Make % an opt-in to improve compatibility with std::format
2019-11-18 08:04:43 -08:00
Victor Zverovich
56a2e2075c
Refactor float spec parsing
2019-11-18 07:37:36 -08:00
Victor Zverovich
9b7fe2a4a1
Don't use POSIX API on UWP
2019-11-17 08:29:08 -08:00
Victor Zverovich
dcde089b4e
Improve POSIX API detection
2019-11-15 07:28:02 -08:00
David P. Sicilia
2145a7bdcc
Move has_formatter into the public fmt namespace. ( #1407 )
...
* Move has_formatter into the public fmt namespace.
This will allow users to do SFINAE-friendly checks for
the formattability of a type.
Fixes #1369
2019-11-14 07:08:24 -08:00
daniel
f1559e1d56
Use grouping() from locale for specifier 'n'
2019-11-05 07:22:12 +00:00
Attila Tajti
0889856d61
Fix UTF-8 truncation
2019-11-03 11:53:15 +00:00
Victor Zverovich
213e09644f
Workaround X11 madness ( #1388 )
2019-11-01 08:47:11 -07:00
Victor Zverovich
40414b3446
Don't emit trailing zeros in exponential notation ( #1376 )
2019-10-28 12:31:00 -07:00
Victor Zverovich
d39ebf3ff2
Optimize counting
2019-10-21 06:57:42 -07:00
Victor Zverovich
8498bc97dd
Initialize all the things
2019-10-20 17:53:18 -07:00
Victor Zverovich
e2ea940673
Handle assymetric boundaries
2019-10-20 07:55:05 -07:00
Victor Zverovich
2bc5585ff0
Fix computing lower boundaries for smallest normalized double
2019-10-18 17:56:52 -07:00
Victor Zverovich
36d1390e67
Implement round half to even
2019-10-18 07:21:12 -07:00
Orivej Desh
599e0aef45
Support single precision floats in grisu formatting
...
Fixes #1336
2019-10-18 07:08:41 -07:00
Victor Zverovich
a5abe5d95c
Handle negative exponent and nonnegative power
2019-10-13 13:16:09 -07:00
Victor Zverovich
1cbc5fa6cb
Handle negative exponent and rename value/pow10 to numerator/denominator
2019-10-13 12:50:48 -07:00
Victor Zverovich
f7a5748fd3
Partially implement (FPP)^2
2019-10-13 09:28:35 -07:00
Victor Zverovich
5e58eb97b1
Implement add_compare
2019-10-13 08:05:06 -07:00
Orivej Desh
3a15ea3ea5
Rename write_double to write_fp
...
It handles all floating point types, not just doubles.
2019-10-12 11:41:24 -07:00
Orivej Desh
b87ac4d840
Distinguish float from double
2019-10-12 11:41:24 -07:00
Victor Zverovich
b55551f900
Implement more comparison operators
2019-10-12 09:22:24 -07:00
Deniz Evrenci
96f91428c6
Add defaulted copy and move operations to format_error and system_error ( #1347 )
...
* Avoid weak vtables by providing a private virtual member function
* Add warning Wweak-vtables to clang when FMT_PEDANTIC is on
* Add defaulted copy and move operations to format_error and system_error
Compiler generated copy operations are deprecated and move operations
are not generated altogether.
* Add warning Wdeprecated to clang when FMT_PEDANTIC is on
2019-10-11 10:44:20 -07:00
Victor Zverovich
e4d6d9d7c8
Implement divmod
2019-10-09 13:40:50 -07:00
Orivej Desh
a1079e9fd6
Fix undefined in format-test ( #1349 )
...
When `MoveCtor` performs `check_move_buffer`, the buffer allocator becomes null,
but then `MoveCtor` attempts to use it to allocate a dynamic buffer. This
succeeds nevertheless because a typical `std::allocator<char>::allocate` does
not use `this`, so it does not crash when `this` is null.
Fixes #1344
2019-10-08 15:42:51 -07:00
Orivej Desh
b66bb6b71f
Fix undefined in core-test and printf-test ( #1345 )
...
* Fix undefined in core-test
Fixes "reference binding to null pointer" in BufferTest.Ctor
buffer.operator[] attempts to return a reference to `buffer.ptr_[0]` when `ptr_`
in `mock_buffer<int> buffer` is null.
* Fix undefined in printf-test
Fixes "signed integer overflow" in PrintfTest.Length
This occurs in `TestLength<long long>("ll")`, since its minimum value minus one
does not fit in long long.
* Fix undefined in printf %0$
Printf counts arguments from 1.
Fixes "shift exponent -4 is negative" in PrintfTest.InvalidArgIndex.
`do_get` is called with index -1 when `basic_printf_context.arg` is called with
id 4294967295 when basic_printf_context::get_arg subtracts 1 from arg_index 0 in
the format string "%0$d".
2019-10-08 06:28:39 -07:00
Victor Zverovich
b60114533f
Implement more bigint operations
2019-10-06 12:49:23 -07:00
Victor Zverovich
c41cea8b18
Initial implementation of square
2019-10-05 16:37:52 -07:00
Victor Zverovich
0c7650373c
Fix handling of types convertible to std::string_view
2019-10-05 06:58:37 -07:00
Victor Zverovich
0fc7bd1573
Fix ambiguity for types with dodgy conversions
2019-09-28 11:35:20 -07:00
Jeremy Ong
b4f1988c4b
Provide overload for fmt::join
that handles std::tuple
s
...
Address enhancement request #1322 .
The overload is provided in `ranges` (original `fmt::join` exists
currently in `format.h` for historical reasons.
Tests for prvalue and lvalue tuple arguments as well as the empty
tuple are provided in `ranges-test.cc`.
2019-09-27 14:05:35 -07:00
Richard Musil
3b2fc033d1
Making CUDA test work with CMAKE_MSVC_RUNTIME_LIBRARY
...
CMake 3.15 introduced a new way of handling MSVC CRT type definition for
the build: CMAKE_MSVC_RUNTIME_LIBRARY variable.
(https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html )
This is supposed to be the way to go with MSVC CRT selection in new
projects. Using this method however breaks the current CMake script for
CUDA test. The reason is the CUDA test uses "FindCUDA" CMake module to
detect and set up CUDA support in CMake, which is deprecated since CMake
version 3.10, and which does not support CMAKE_MSVC_RUNTIME_LIBRARY
selector correctly (i.e. it does not propagate the compiler option
related to the CRT).
I did not find a way to "patch" in the correct compiler options, so
(while knowing this feature is only available from CMake 3.15 on) I
decided to change also the way CUDA is handled and instead of using
FindCUDA, used enable_language. Apart from having some nice additional
side-effects, it also fixed the problem with CRT selection.
However, the propagation of the compiler options (and in particular the
options related to C++ standard selection) is still a bit flaky on
Windows+MSVC platform, so it had to be done manually.
The patch makes two things in parallel:
1) Introduces MSVC_BUILD_STATIC, which, together with CMake version >=
3.15, allows building static version of the 'fmt' lib (and all the
tests).
2) At the same time, for CMake >= 3.15 it switches handling of CUDA
support from (old) FindCUDA to (new) enable_language, to fix the
problems which the old method has with the new CRT selector for MSVC in
a new CMake.
Added a check for CUDA before enabling it.
Using VERSION_LESS instead of VERSION_GREATER_EQUAL
Since apparently VERSION_GREATER_EQUAL exists only from CMake 3.7, while
Android is using CMake 3.6.
Removed MSVC_RUNTIME_LIBRARY logic from the CMake file.
The static build can be set on the command line with CMake >= 3.15
by defining the policy and the CMAKE_MSVC_RUNTIME_LIBARY this way:
cmake -G <gen> <options>
-DCMAKE_POLICY_DEFAULT_CMP0091=NEW
-DMSVC_BUILD_STATIC=ON
-DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$<CONFIG:Debug>:Debug>"
When MSVC_BUILD_DEBUG is set the test 'posix-mock-test' is skipped as it
does not build with the static runtime.
2019-09-25 06:46:11 -07:00
Daumantas Kavolis
8f27ce4d8b
add test for multiple compilation types
2019-09-24 06:25:21 -07:00
Victor Zverovich
ccc8f5db02
Disable integral operator<< ( #1316 )
2019-09-23 20:34:08 -07:00
Victor Zverovich
20fdb88a1c
Remove redundant and nonportable test ( #1313 )
2019-09-23 13:36:12 -07:00
Victor Zverovich
f29901097f
Don't use const char* overload of operator<< ( #1309 )
2019-09-23 12:35:08 -07:00
Victor Zverovich
0656045d02
Fix format overload that takes text_style ( #1305 )
2019-09-08 18:41:02 -07:00
Victor Zverovich
c85ae23c73
Add max_value
2019-09-08 09:21:30 -07:00
Victor Zverovich
b3bf665764
Implement multiplication and part of assignment from pow of 10
2019-09-08 08:27:00 -07:00
Victor Zverovich
0887887e23
Implement left shift
2019-09-07 18:10:36 -07:00
Victor Zverovich
ac71d853be
Refactor normalize and clean up
2019-09-07 17:28:59 -07:00
Victor Zverovich
56b5c192a0
Add a bigint stub and reenable grisu
2019-09-07 13:50:22 -07:00
Victor Zverovich
f7a4b4ab91
Make numeric alignment optional
2019-09-06 09:43:53 -07:00
Victor Zverovich
611cf0b3c6
Format octal 0 as 0
2019-09-06 07:03:47 -07:00
Victor Zverovich
1882b9687b
Reduce the numer of ifdefs with an empty (u)int128_t fallback
2019-09-05 18:03:47 -07:00
Deniz Evrenci
6de0454b42
Add support for built-in __int128 when available
2019-09-04 07:05:08 -07:00
Victor Zverovich
a128b5b2cb
Simplify format string compilation
2019-09-02 06:48:19 -07:00