1919 Commits

Author SHA1 Message Date
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
Victor Zverovich
561834650a Improve digit count 2021-07-18 09:14:56 -07:00
Johnathan
f20f50368f
Replace throw with FMT_THROW (#2427)
Using `throw` results in compile errors with `-fno-exceptions`. gcc seems fine with it, but arm-gcc and clang would complain.
2021-07-18 07:08:24 -07:00
Victor Zverovich
e41ac1f875 Don't use deprecated API in docs 2021-07-10 13:42:51 -07:00
Victor Zverovich
8465869d7b Move ignore_unused to detail 2021-07-09 08:24:11 -07:00
Victor Zverovich
20e4ef8b4c Pass significand_size by value 2021-07-05 08:51:43 -07:00
Victor Zverovich
c4a3c2342a Refactor locale handling 2021-07-05 08:25:12 -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
cfc05e05f0 Bump version 2021-07-02 14:43:31 -07:00
Victor Zverovich
e461f3dbbe Minor consitency and comment tweaks 2021-07-02 13:56:37 -07:00
Mattias Ljungström
54014e42e3
silence warning C4100 on MSVC 2019 when exceptions are disabled (#2397) 2021-07-02 13:51:49 -07:00
Victor Zverovich
3e7a29cc92 Workaround clang/gcc incompatibility 2021-07-02 13:29:22 -07:00
Victor Zverovich
1d7384530e Add missing presentation type checks for std::string (#2402) 2021-07-02 07:51:04 -07:00
Jonathan Emmett
889bbf27a2
Fix missing std::get overload in MSVC (#2407)
This replaces the `std::get` call with an unqualified equivalent to allow
it to be treated as a dependent call.

ranges.h needs std::get overloads from `<tuple>` but does not directly
include it. This causes compilation failures in MSVC with /permissive-.
On other platforms `<tuple>` is included as a dependency from other headers
(specifically from `<memory>`), but there is no such implicit dependency in
MSVC's STL.

Fixes #2401
2021-07-01 10:55:46 -07:00
Victor Zverovich
5f8473914c Remove outdated apidoc 2021-07-01 07:56:53 -07:00
Victor Zverovich
785908ee37 Fix warnings 2021-06-30 06:42:29 -07:00
Greg Sjaardema
fbb70eec5c
suppress unused variable warnings (#2381)
* suppress unused variable warnings

An arguably better method for suppressing unused variable warnings.   The `(void)var` method does not work on many intel compiilers.
This is from Herb Sutter's blog post https://herbsutter.com/2009/10/18/mailbag-shutting-up-compiler-warnings/

* Format to eliminate long lines

* Run clang-format
2021-06-30 06:33:30 -07:00
Javier Honduvilla Coto
002bb759ff Remove unneeded num_result_bigits decrement
For what I see this seems unused?
2021-06-29 06:23:02 -07:00
Marek Kurdej
a3f762c5aa [doc] Minor: fix `code`. 2021-06-29 06:21:15 -07:00
Eren Okka
c3c27e5ab5 Fix MSVC warning C4819 2021-06-28 06:14:53 -07:00
Aidan Sun
f85fb9fdff Adjust definition for FMT_HAS_INCLUDE
Adjust definition for FMT_HAS_INCLUDE

Remove check for `!FMT_MSC_VER`
2021-06-27 07:08:29 -07:00
Patrick Geltinger
49a3b58c8b Specify size for static data arrays 2021-06-26 06:55:24 -07:00
Jason A. Donenfeld
c9a10631cb format: do not use udl_{arg,formatter} return types when UDL is not in use
The udl_{arg,formatter} structs are only defined when
FMT_USE_USER_DEFINED_LITERALS is set, so don't try to define things that
return that struct when it's not defined.
2021-06-26 06:25:16 -07:00
Greg Sjaardema
3bd806f12f Eliminate intel compiler warning
The intel compiler defines `__GNUC__`, but does not support the gcc `_Pragma`.  This PR filters out the intel compiler to avoid warnings about an unrecognized function.
2021-06-26 06:16:12 -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
31a5f0d399 Bump version in inline namespace 2021-06-22 14:47:59 -07:00
Victor Zverovich
102a4d492a Bump version in inline namespace 2021-06-22 07:04:02 -07:00
Victor Zverovich
92fec0f050 Bump version 2021-06-21 05:57:50 -07:00
Victor Zverovich
427b534054 Add no_value state to value 2021-06-15 07:53:28 -07:00
Victor Zverovich
e421d52713 Simplify error handling in parse_nonnegative_int 2021-06-14 16:05:37 -07:00
Владислав Щапов
a59678f376 Fix chrono_test.locale
UTF-8: https://datatracker.ietf.org/doc/html/rfc3629
2021-06-14 09:41:08 -07:00
Владислав Щапов
c123a72844 Fix set locale error in chrono formatter 2021-06-14 09:41:08 -07:00
Victor Zverovich
3c8fad126c Optimize parse_nonnegative_int 2021-06-13 19:20:44 -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
Victor Zverovich
3423d75475 Remove the msvc workaround (#2351) 2021-06-11 06:20:25 -07:00
Victor Zverovich
dccddc2bdb Apply clang-format 2021-06-07 08:49:47 -07:00
Victor Zverovich
0e36681b8e Cleanup digit count 2021-06-07 07:42:22 -07:00
Victor Zverovich
1de80f5b22 Workaround lack of static constexpr in constexpr functions 2021-06-07 07:27:56 -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
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
4678192c88 Remove bsr2log10 2021-06-04 21:33:05 -07:00
Victor Zverovich
7c3d3dfa29 Update thousands_sep_impl signature 2021-06-04 21:12:47 -07:00
Victor Zverovich
5223f552c8 Remove FMT_ALWAYS_INLINE 2021-06-04 20:29:54 -07:00
Victor Zverovich
cfde93afe0 Add FMT_STATIC_CONSTEXPR 2021-06-04 16:50:09 -07:00
Cristi
986a5a6c2c Fixed join_view formatter for wchar_t 2021-06-04 14:50:45 -07:00
Tobias Ribizel
7c8b35ff32 fix MSVC Win32 count_digits 2021-06-04 11:06:25 -07:00
Victor Zverovich
3eeb084e71 Optimize count_digits 2021-06-04 09:14:58 -07:00
Victor Zverovich
2ac0bfe59e Improve handling of thousands separator 2021-06-04 06:12:44 -07:00
Victor Zverovich
f4c95f6dd9 Improve handling of thousands separator 2021-06-03 18:25:08 -07:00
Victor Zverovich
0eef389ddb Code style 2021-06-03 18:25:08 -07:00
Victor Zverovich
11addaa16e Update docs 2021-06-03 06:24:17 -07:00
Victor Zverovich
290d3f8b61 Cleanup ranges API 2021-06-02 17:06:02 -07:00
Victor Zverovich
d142579e97 Cleanup the format API 2021-06-02 16:25:21 -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
a04e3a2dc8 Comment 2021-06-01 20:47:16 -07:00
Victor Zverovich
87876d5474 Cleanup the printf implementation 2021-06-01 20:32:56 -07:00
Victor Zverovich
d338d66324 Cleanup the printf implementation 2021-06-01 19:30:46 -07:00
Victor Zverovich
272660e704 Remove deprecated printf functions 2021-06-01 18:08:31 -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
8c1b22ba6d Workaround a gcc 9.1 bug (#2334) 2021-06-01 06:43:30 -07:00
Daniela Engert
d7ba6c3ea8
Use qualified name-lookup in module. (#2324)
Allow lookup of non-exported names from local classes in function templates.
2021-05-31 09:11:24 -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
832ec098fc Fix argument order in locale overload of vformat_to (#2327) 2021-05-30 06:42:09 -07:00
Victor Zverovich
486a80e8ef Move wchar_t overloads to xchar.h 2021-05-30 06:41:39 -07:00
Victor Zverovich
5a2b88f6e9 Reduce binary size 2021-05-29 16:45:43 -07:00
Daniela Engert
00a39ad5f8
Enable Char types other than char (#2323) 2021-05-29 11:42:16 -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
0901176fe4 arg_join -> join_view 2021-05-29 08:47:16 -07:00
Victor Zverovich
a9a9018191 Move wmemory_buffer to wchar.h 2021-05-29 08:26:04 -07:00
Victor Zverovich
9d67988aed FMT_DEPRECATED_WCHAR -> FMT_DEPRECATED_INCLUDE_WCHAR 2021-05-29 06:41:07 -07:00
Daniela Engert
126c8cb46b
Export os.h API, too (#2318) 2021-05-28 09:27:45 -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
4e21baff43 Simplify get_units 2021-05-26 18:26:00 -07:00
John Melas
ca466374bd
qualify make_format_args (#2315)
Co-authored-by: John Melas <john@jmelas.gr>
2021-05-26 06:42:02 -07:00
Victor Zverovich
5a2a185682 Make buffers non-movable 2021-05-25 17:30:17 -07:00
Alexey Ochapov
ee52a6dc40
add fmt::print() overload to support compiled format (#2304) 2021-05-25 14:54:56 -07:00
sven-herrmann
82607efb57
Fixed int conversion warning (#2313)
* Fixed int conversion warning

Compiler warns about conversion from int to size_t, thus added explicit cast.

* now using detail::to_unsigned for the cast
2021-05-25 08:13:39 -07:00
Victor Zverovich
35a2c2a743 Refactor chrono formatting 2021-05-25 06:57:47 -07:00
Victor Zverovich
b955e7a6b2 Refactor chrono formatting 2021-05-24 15:33:33 -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
dd8f38fcbb Cleanup printf API 2021-05-23 20:30:26 -07:00
Victor Zverovich
a216f2562d Remove undocumented and obsolete vprintf overload 2021-05-23 20:15:02 -07:00
Victor Zverovich
0c0926395d Add is_exotic_char trait 2021-05-23 19:50:17 -07:00
Daniela Engert
8ec0b9e33b Do *not* export namespace detail 2021-05-23 06:49:07 -07:00
Victor Zverovich
703005c8ba Deprecate locale.h 2021-05-22 10:21:17 -07:00
Victor Zverovich
51f0178625 Cleanup the format API 2021-05-22 07:09:09 -07:00
Victor Zverovich
5d59dcf66e Remove deprecated aliases / undeprecate has_formatter 2021-05-22 06:53:34 -07:00
Victor Zverovich
c242dd402c Move cerrno include to where it is used 2021-05-22 06:18:40 -07:00
Victor Zverovich
1c83a49be9 Simplify buffer extraction 2021-05-21 20:15:56 -07:00
Victor Zverovich
2617384d8e Improve buffer extraction 2021-05-21 19:44:49 -07:00
Victor Zverovich
34b8acaef7 More wchar_t-specific API to wchar.h 2021-05-21 18:24:39 -07:00
Victor Zverovich
6326c18906 Improve code style consistency 2021-05-21 17:29:15 -07:00
Matthew Gilbert
5c4b0c86fb Add missing Allocator template argument for basic_memory_buffer in format_to
Remove deduced default template arguments in format_to and moves the
SFINAE check to a non-deduced template parameter.
2021-05-21 12:13:46 -07:00
Victor Zverovich
00149c0b6a Move detail::null to chrono where it is used 2021-05-21 09:16:45 -07:00
Victor Zverovich
c5c968cb22 Improve binary size 2021-05-21 08:50:35 -07:00
Victor Zverovich
18af1dc460 Fix binary size regression caused by b268f88 2021-05-20 18:33:45 -07:00
Victor Zverovich
d1e6f0f8c6 Fix binary size regression caused by b268f88 2021-05-20 18:00:19 -07:00
Daniela Engert
6e2e6b796f Restore support for wchar_t overloads in module 2021-05-20 10:03:58 -07:00
Victor Zverovich
24b677d053 Improve symbol sizes 2021-05-20 07:21:20 -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
Michael Winterberg
2a2e4c5801 addressing nits. 2021-05-19 16:09:49 -07:00
Michael Winterberg
be48f4d657 Avoid unwanted sign extensions from MSVC in is_utf8.
Microsoft's constexpr evaluator treats the type of micro[0] and micro[1] as
plain char, and so sign extends before comparing them to ints.
The normal compiler, including the optimizer, does not fail in this way,
so this is merely a "future proof" change in case someone uses is_utf8()
in a constant expression.
2021-05-19 16:09:49 -07:00
Sergiu Deitsch
13e652939b export missed symbols
Enable `-fvisibility=hidden` and `-fvisibility-inlines-hidden` by default in CI builds to ensure all public symbols are exported correctly.
2021-05-19 16:03:45 -07:00
Jessy De Lannoit
71fb113818 fix compile error on msvc preview 4 (16.10) involving lookup clash /w STL 2021-05-19 13:17:20 -07:00
Victor Zverovich
08d22503bb Remove outdated comments 2021-05-19 11:47:21 -07:00
Victor Zverovich
95c358f721 Improve separation between code unit types 2021-05-19 09:06:57 -07:00
Victor Zverovich
39c3c4ec22 Simplify the core API 2021-05-19 08:32:57 -07:00
Victor Zverovich
e9c1c415b8 Improve compile-time checks 2021-05-19 07:57:57 -07:00
Victor Zverovich
21d93bfd33 Move generic format functions to format.h 2021-05-18 19:01:43 -07:00
Victor Zverovich
9a92eb4158 Move more wchar overloads to wchar.h 2021-05-18 05:53:25 -07:00
Victor Zverovich
0dd91e20d5 Add wchar.h for wide char overloads 2021-05-17 21:59:10 -07:00
Victor Zverovich
ce14eafc24 Simplify format string checks 2021-05-17 19:25:50 -07:00
Victor Zverovich
8d70c0edab Refactor the format API 2021-05-17 18:25:36 -07:00
Victor Zverovich
813ac49543 More API cleanups 2021-05-17 07:58:13 -07:00
Victor Zverovich
4ab01fb198 Cleanup printf API 2021-05-17 07:19:50 -07:00
Victor Zverovich
d5036b11b1 Remove deprecated APIs 2021-05-17 06:59:46 -07:00
Victor Zverovich
2581946231 Cleanup the core API 2021-05-16 13:02:01 -07:00
Victor Zverovich
b35db4e006 Improve handling of 128-bit ints 2021-05-16 11:43:44 -07:00
Victor Zverovich
d35f1ad5c1 Cleanup core 2021-05-16 10:02:33 -07:00
Victor Zverovich
8f1902c05a Move format string checks to core.h 2021-05-16 07:08:49 -07:00
Daniela Engert
6469b9037c Silence msvc warning about an unused named parameter
Warning C4100 may cause compile failures under strict warning regimes.
2021-05-16 06:14:30 -07:00
Daniela Engert
5466373a11 Do *not* export namespace detail
Introduce `FMT_BEGIN_DETAIL_NAMESPACE` and `FMT_END_DETAIL_NAMESPACE` for `namespace detail` sections embedded in that part of the code that contains all declarations that are exported from the module, i.e. which is enclosed by `FMT_MODULE_EXPORT_BEGIN` and `FMT_MODULE_EXPORT_END`. Given a correct implementation of C++20 modules, neither the name `fmt::detail` nor any of its contents will become visible outside of the module.
2021-05-15 12:08:42 -07:00
Victor Zverovich
588bdb5404 Simplify get_arg_index_by_name 2021-05-15 06:47:43 -07:00
Alexey Ochapov
54f22a3eef add support for statically named arguments with FMT_STRING 2021-05-14 16:31:10 -07:00
Daniela Engert
ea94d6d93c Prevent ambiguity in name lookup
Unqualified calls to 'make_format_args' may find the same name by ADL in <format> if this C++20 header happens to be directly or indirectly included in a translation unit. Do a qualified lookup instead.
2021-05-14 07:10:02 -07:00
Victor Zverovich
57280762b6 Move specs checker to core.h 2021-05-13 19:33:09 -07:00
Victor Zverovich
ced3037523 Move dynamic specs to core.h 2021-05-13 19:01:21 -07:00
Victor Zverovich
dd2bc998ab Move specs to core.h 2021-05-13 18:48:15 -07:00
Victor Zverovich
08da1adcf6 Remove unused headers 2021-05-13 17:58:15 -07:00
Victor Zverovich
3be0cc2087 Fix handling of 128-bit ints 2021-05-13 17:53:23 -07:00
Victor Zverovich
d1aebdbde0 Inline format_to 2021-05-12 18:07:59 -07:00
Victor Zverovich
02896dabee Avoid use after move (#2278) 2021-05-11 16:58:07 -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
Victor Zverovich
4862930845 Optimize format string compilation 2021-05-09 09:15:55 -07:00
Victor Zverovich
3207a8bbbf Get rid of unnecessary recursion to enable inlining 2021-05-09 07:54:13 -07:00
Victor Zverovich
6214f15a0c Optimize standard formatter specialization 2021-05-09 07:11:35 -07:00
Victor Zverovich
cd2c78fb8a Use write directly in formatter specializations 2021-05-09 07:07:51 -07:00
Владислав Щапов
4211d86539 Add a formatter specialization for std::error_code. 2021-05-09 06:29:39 -07:00