Commit Graph

501 Commits

Author SHA1 Message Date
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
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
d1d653d895 Implement the L specifier 2020-04-02 06:58:38 -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
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
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
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
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
74532c23a3 Make type a scoped enum 2019-12-21 12:22:17 -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
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
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
b994a0ab13 Fix handling of missing fraction in snprintf_float 2019-11-29 06:17:29 -08:00
Victor Zverovich
d19ed6716d Fix hexfloat buffer reallocation 2019-11-25 15:54:04 -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
66d7746bb3 Use grisu for exponent notation 2019-11-19 16:55:11 -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
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
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
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
Victor Zverovich
c85ae23c73 Add max_value 2019-09-08 09:21:30 -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
422e7b9d70 Fix compile-time checks for user-defined types (#1292) 2019-08-31 08:35:38 -07:00
Victor Zverovich
c76957565c FixedEnum -> StrongEnum and make it a regression test 2019-08-31 08:16:47 -07:00
Egor Seredin
bcd9b9331a Map not int enum to correct underlying_type (#1286)
* Map not int enum to correct underlying_type

* Use non-zero constant in TestFixedEnum
2019-08-31 06:25:38 -07:00
Victor Zverovich
3f75e2b69e Make buffer_range public and update custom formatting docs (#1281) 2019-08-28 06:50:20 -07:00
Victor Zverovich
c1e97392be Fix warnings 2019-08-11 08:44:12 -07:00
Jack Andersen
699fe8e711 Remove const qualification in compile-time checks 2019-07-15 09:20:16 +02:00
Victor Zverovich
e4f84ee1c6 Refactor format_specs for #1109 and #940
Refactor `format_specs` and related APIs to support variable-width fill
(#1109), improve naming consistency, remove legacy setters (#940), and
optimize layout.
2019-07-06 20:57:40 -07:00
Victor Zverovich
bc14c6ee20 Use the decimal point from locale 2019-07-03 17:55:00 -07:00
Victor Zverovich
c9d5a08ed8 Add the 'n' float format specifier 2019-07-03 16:36:23 -07:00
Victor Zverovich
ded0a3bb3d Internalize undocumented basic_writer 2019-07-03 10:01:03 -07:00
Victor Zverovich
ab0ba8a9d0 Don't emit decimal point if there are no trailing digits (#1210) 2019-06-30 08:44:59 -07:00
Victor Zverovich
260c115908 Fix formatting of 0.0 with (#1210) 2019-06-30 06:54:41 -07:00
Victor Zverovich
72e519a4bd Add formatter<std::string_view> 2019-06-22 20:26:28 -07:00
Victor Zverovich
f13906f408 back_insert_range<internal::buffer> -> buffer_range 2019-06-19 14:12:29 -07:00
Victor Zverovich
4912cff65d Fix handling of mapped types in compile checks (#1200) 2019-06-16 16:06:06 -07:00
Victor Zverovich
874d6727e4 Remove workarounds for pre-C++11 compilers 2019-06-13 20:56:08 -07:00
Victor Zverovich
cbbee1b385 Fix handling of hexfloat 2019-06-12 20:53:01 -07:00
Victor Zverovich
d05d42751c Remove old msvc workaround from arg_formatter_base and fix warning 2019-06-12 19:27:23 -07:00
Victor Zverovich
d32fe0f3f6 Fix hadling of nullptr 2019-06-12 09:22:36 -07:00
Victor Zverovich
cb4c59495e Deprecate convert_to_int 2019-06-07 13:38:08 -07:00
Victor Zverovich
40779749ac is_formattable -> has_formatter 2019-06-07 06:51:21 -07:00
Victor Zverovich
3fdba04924 Reduce the number of nontrivial formatter instantiations 2019-06-06 22:02:53 -07:00
Victor Zverovich
eddb84cfc0 Fix formatting of exotic characters 2019-06-03 17:08:00 -07:00
Victor Zverovich
d07cc2026b FMT_EXPLICIT -> explicit, FMT_NULL -> nullptr 2019-05-30 07:42:36 -07:00
Victor Zverovich
afc571aedc Document join and relax its compiler requirements 2019-05-29 11:21:05 -07:00
Victor Zverovich
67179dbc23 Remove deprecated format_decimal 2019-05-15 10:34:38 -07:00
denchat
f4dfd6e30f Suppress all clang-target-msvc test warning in CMake and other misc fixes (#1151)
* Fix conditional `char8_t` from `format.h` and fix `-Wunused-result` of [[no_discard]] begin() when in c++17

* Suppress `-Winconsistent-dllimport` when in clang-target-msvc

* Suppress warning _CRT_SECURE_NO_WARNINGS in MSVC and -Wdeprecated-declarations

Suppress warning _CRT_SECURE_NO_WARNINGS in MSVC and -Wdeprecated-declarations of POSIX functions in Clang target MSVC.
Those functions are used by gtest.

* Remove FMT_FUNC, mark FMT_API to export
2019-05-11 11:48:27 -07:00
Victor Zverovich
ea2976e6d5 Move internal::uintptr_t test to format-impl-test (#1152) 2019-05-11 06:58:22 -07:00
denchat
3fd134be03 Move test_count_digits to format-impl-test and disable gtest warnings (#1147)
* This translation unit includes `gtest.h` in which using something like `strncpy`

Suppress MSVC warnings from `gtest.h` included.

Warning sample:
fmt-master\test\gtest\gtest.h(2873,10): warning: 'strncpy' is deprecated: This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]

* Moving `test_count_digits` to format-impl-test then count_digits<4>(internal::uintptr_t) shall not be exported

* retaining _CRT_SECURE_NO_WARNINGS always defined should be no harms.
2019-05-07 12:09:11 -07:00
Victor Zverovich
40a7975640 Remove trailing zeros 2019-04-27 07:42:27 -07:00
Victor Zverovich
cb46397dfb Fix typo 2019-04-27 07:13:35 -07:00
Victor Zverovich
134904c886 Re-enabled constexpr tests 2019-04-26 17:07:37 -07:00
HE, Tao
6b20863918 fmt::ptr: support unique_ptr and shared_ptr. 2019-04-18 10:12:11 -07:00
Victor Zverovich
d306585a3f Don't inject internal names into std (#1120) 2019-04-17 13:25:31 -07:00
Victor Zverovich
dc94010fa5 Remove char_traits (#1117) 2019-04-16 17:08:24 -07:00
Victor Zverovich
5d755d0a4e Fix handling of volatile char (#1115) 2019-04-14 12:34:56 -07:00
Victor Zverovich
2808395481 basic_buffer -> buffer
This reduces symbol sizes and gets rid of shadowing warnings.
2019-04-07 20:32:28 -07:00
Victor Zverovich
f10a7e2e46 Test exotic pointer formatting 2019-04-06 09:04:44 -07:00
Victor Zverovich
bd8177177a Add support for platforms without uintptr_t 2019-04-06 08:11:03 -07:00
mwinterb
7ad3015f5b Added missing typename to FMT_STRING. (#1089)
* Added missing typename to FMT_STRING.

This is so that FMT_STRING can be used in a template.
2019-03-20 20:37:00 -07:00
Victor Zverovich
294fd7df96 Remove isinf workaround 2019-03-17 14:49:19 -07:00
Victor Zverovich
97619e27a2 More fixed precision tests 2019-03-15 10:20:20 -07:00
Victor Zverovich
a82b3680dc More tests and fixed precision fixes 2019-03-13 19:47:07 -07:00
Victor Zverovich
e28429ee73 Prevent overflow with zero precision 2019-03-13 10:46:25 -07:00