Victor Zverovich
dac42f52b2
Inline fallback is_constant_evaluated
2021-04-01 10:42:09 -07:00
Victor Zverovich
7c43f8b896
Don't use strlen at compile time ( #2205 )
2021-04-01 10:04:21 -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
15c10b0c66
Add speech synthesis support
2021-04-01 09:19:36 -07:00
Billy Donahue
308510eb4f
"Use" fwrite
result (workaround for warn_unused_result
)
...
Fixes #2185
2021-03-31 08:31:35 -07:00
Victor Zverovich
b49af043d7
Remove noexcept from file's move assignment
2021-03-30 09:51:25 -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
Victor Zverovich
b966afcc7a
Remove formattable
2021-03-28 14:21:12 -07:00
Victor Zverovich
ec5315a987
Use strlen when possible in fallback basic_string_view
2021-03-28 08:01:55 -07:00
Victor Zverovich
4f8778bab9
Inline basic_format_args's ctor
2021-03-28 07:32:17 -07:00
Yaser Afshar
e2d87548f8
user-defined constructor
...
user-defined constructor added to prevent Intel compilers
warnings. According to the standard, objects need to have a
user-defined constructor if instances are delcared const.
2021-03-28 06:56:14 -07:00
Yaser Afshar
f7151d384b
Extra flag to prevent Intel compiler with Clang front-end warning of 'unknown attribute no_sanitize'
2021-03-28 06:56:14 -07:00
Victor Zverovich
0fb8ef8f79
Inline trivial argument handling functions
2021-03-27 19:05:39 -07:00
Victor Zverovich
1b23e25f95
Simplify formattability check
2021-03-27 18:57:18 -07:00
Victor Zverovich
35c71ff536
Only use -Og with optimizations disabled
2021-03-27 11:35:01 -07:00
Victor Zverovich
243d8bebd1
Enable minimal optimizations in debug mode
2021-03-27 08:40:07 -07:00
Chris White
9b34681d97
Work around xl compiler bug when nvcc preprocesses this file ( #2190 )
2021-03-27 06:05:49 -07:00
Victor Zverovich
9cb347b4b2
Simplify argument formatters
2021-03-21 09:31:46 -07:00
Ryan Sherlock
0f85a4683a
add default cases ( #2186 )
...
Adding default case for switch statements where the compilation
flag -Wswitch-default is present on the command line when spdlog
is included in external projects.
Signed-off-by: Ryan Sherlock <ryan.m.sherlock@gmail.com>
2021-03-19 16:56:52 -07:00
Victor Zverovich
417e1cee9e
Stop using deprecated UDL templates
2021-03-19 08:34:55 -07:00
Victor Zverovich
f7e900e12e
Simplify UDL definitions
2021-03-19 08:10:58 -07:00
Victor Zverovich
d9661c8f3b
Mark grouping as deprecated
2021-03-19 07:54:57 -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
1147782c79
Fix an ambiguous call to check caused by ADL ( #2184 )
2021-03-17 20:59:36 -07:00
VZ
2f3f3862fa
Fix harmless MSVS warning about using undefined _MANAGED symbol ( #2183 )
...
Since the changes of 1305cbeb
(Fix MSVC2019 error C2049 when compiling
with /clr (#1897 ), 2020-09-23), compiling fmt with MSVS 2019 resulted in
fmt\include\fmt\core.h(180,32): warning C4668: '_MANAGED' is not defined
as a preprocessor macro, replacing with '0' for '#if/#elif'.
when the (disabled by default) warning C4668 was enabled.
Fix this simply by checking if _MANAGED is defined before testing it.
2021-03-17 11:21:50 -07:00
Brainy0207
d0bded5988
Fix MSVC /clr builds ( #2179 )
2021-03-15 08:17:28 -07:00
Victor Zverovich
8308f52c2a
Fix dynamic_format_arg_store::push_back comment
2021-03-15 07:10:28 -07:00
Victor Zverovich
5a1127b726
Don't wrap named arg in cref and clarify docs
2021-03-14 09:08:08 -07:00
moiwi
b8ff3c1820
optimize append ( #2164 )
2021-03-13 07:21:23 -08:00
Alexey Ochapov
c8d8b88223
fix GCC 7,8,9 warning about unused but set parameter ( #2177 )
2021-03-13 06:36:53 -08:00
Victor Zverovich
bac14ef985
Simplify integer spec checking
2021-03-12 15:02:01 -08:00
Victor Zverovich
8f9db3fcb8
Make ubsan happy on empty format specs ( #2175 )
2021-03-12 09:13:47 -08:00
Victor Zverovich
af567538a0
Bitpack integral prefixes
2021-03-11 21:22:33 -08:00
Victor Zverovich
cdf877d4b1
Workaround missed optimization opportunity
2021-03-11 16:44:59 -08:00
Victor Zverovich
eef4ba9c02
Optimize integer formatting without padding
2021-03-11 15:47:58 -08:00
Victor Zverovich
a1ea8a82c3
Unbloat my heart
2021-03-11 08:27:53 -08:00
Victor Zverovich
a457e16360
Simplify integer formatter
2021-03-11 08:14:03 -08:00
Victor Zverovich
05bc87a66f
Optimize padding
2021-03-10 17:59:36 -08:00
Victor Zverovich
605b603735
Optimize count_digits for powers of 2
2021-03-10 14:48:07 -08:00
Victor Zverovich
85ba271639
Implement 128-bit count_digits in terms of count_digits_fallback
2021-03-10 12:57:46 -08:00
Victor Zverovich
d9835737f0
spec -> specs
2021-03-10 12:51:03 -08:00
Victor Zverovich
60f5d24411
Simplify arg_formatter
2021-03-10 09:35:48 -08:00
Victor Zverovich
30e1302e73
Simplify on_format_specs
2021-03-10 08:46:16 -08:00
Victor Zverovich
87c5cd46ac
Optimize parsing of argument ids
2021-03-10 07:04:04 -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
Alexey Ochapov
d8b9254301
use simplified void_t
for all compilers other than gcc 4.x ( #2160 )
2021-03-02 14:42:27 -08:00
Victor Zverovich
835b910e7d
Add an is_formattable trait
2021-02-28 15:25:33 -08:00
Victor Zverovich
578874033a
Revert "Optimize handling of integer constants" ( #2147 )
...
This reverts commit 2797588be1
.
2021-02-25 05:58:58 -08:00
Jiahao XU
640acba850
Print x.what() of FMT_THROW when exception is disabled ( #2145 )
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2021-02-24 06:29:04 -08:00
Alexey Ochapov
d8e1c9f175
fix fmt::get
for some GCC versions and legacy Clang ( #2144 )
...
fixes https://github.com/fmtlib/fmt/issues/2140
- some GCC versions decay function pointers to `const void*`, exactly like
MSVC does
- legacy Clang (prior to 7.0) treats function pointers also as `const T*`
pointers, but unable to convert them
2021-02-23 07:18:30 -08:00
Victor Zverovich
2797588be1
Optimize handling of integer constants
2021-02-21 11:11:57 -08:00
Victor Zverovich
e8eff3b8fd
Fix FMT_STATIC_THOUSANDS_SEPARATOR ( #2142 )
2021-02-21 07:42:12 -08:00
Alexey Ochapov
ab0f7d7fdc
use const& for arguments
2021-02-20 11:50:12 -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
3f69af3aaf
update wording in the error inside arg_id_handler
, use FMT_ASSERT
instead of throw
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
b31bc2dc9f
simplify try_format_argument()
, make manual_indexing_id()
a variable
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
Victor Zverovich
ee0fed639c
Fix handling of the + flag with locales ( #2133 )
2021-02-13 07:08:01 -08:00
Yuval Gamzon-Kapeller
c5979d564e
Fix fmt::localtime formatting not working in wide-char string contexts
2021-02-13 06:53:30 -08:00
Mike Crowe
e6ef927e6b
fmt::ptr: Support function pointers ( #2131 )
...
Passing a function pointer to fmt::ptr results in:
In file included from /home/mac/git/fmt/test/gmock/gmock.h:238,
from /home/mac/git/fmt/test/format-test.cc:31:
.../fmt/test/format-test.cc: In member function ‘virtual void FormatterTest_FormatPointer_Test::TestBody()’:
.../fmt/test/format-test.cc:1486:56: error: no matching function for call to ‘ptr(void (&)(int, double, std::__cxx11::string))’
format("{}", fmt::ptr(function_pointer_test)));
with GCC and Clang. Let's add an overload to support that usage.
Unfortunately, MSVC would
consider the overload to be ambiguous for unknown reasons:
D:\a\fmt\fmt\test\format-test.cc(1485,1): error C2668: 'fmt::v7::ptr': ambiguous call to overloaded function [D:\a\fmt\build\test\format-test.vcxproj]
D:\a\fmt\fmt\include\fmt/format.h(3742,60): message : could be 'const void *fmt::v7::ptr<void,int,double,std::string>(T (__cdecl *)(int,double,std::string))' [D:\a\fmt\build\test\format-test.vcxproj]
with
[
T=void
]
D:\a\fmt\fmt\include\fmt/format.h(3735,42): message : or 'const void *fmt::v7::ptr<void(int,double,std::string)>(T (__cdecl *))' [D:\a\fmt\build\test\format-test.vcxproj]
with
[
T=void (int,double,std::string)
]
D:\a\fmt\fmt\test\format-test.cc(1486,1): message : while trying to match the argument list '(overloaded-function)' [D:\a\fmt\build\test\format-test.vcxproj]
but luckily this means that the overload is unnecessary in that case
anyway, so we can just make it conditional.
2021-02-09 07:35:16 -08:00
Yin Zhong
1980ca8c4e
fix #2118 : FMT_COMPILE did not work with tm formatter ( #2119 )
...
Co-authored-by: summivox <summivox@github.com>
2021-01-30 08:44:49 -08:00
Alexey Ochapov
2a25e2bf4d
Make ranges-test available with C++11 ( #2114 )
...
* make ranges-test available with C++11, fix problem with some gcc versions
* potentially fix build for MSVC 19.10, a bit reorganizing in test
2021-01-30 07:42:58 -08:00
Yin Zhong
b0b56b4379
fix #2116 (FMT_COMPILE requires exceptions enabled) ( #2117 )
...
Co-authored-by: summivox <summivox@github.com>
2021-01-28 06:58:49 -08:00
Victor Zverovich
ce519e939b
Fix exception propagation from iterators ( #2097 )
2021-01-23 17:27:24 -08:00
Alexey Ochapov
acef0bb51a
use gcc-10.2 instead of gcc-10.1 on CI, also fix one problem ( #2110 )
...
the problem was not detected by test because of wrong gcc-10 minor version on CI
2021-01-23 07:52:41 -08:00
Ivan Polyakov
8bf28e6bb1
Add support for s format specifier to bool ( #2094 ) ( #2109 )
2021-01-23 07:32:41 -08:00
Walter Gray
456efa4666
add missing detail namespace ( #2107 )
...
Co-authored-by: Walter Gray <walter.gray@getcruise.com>
2021-01-19 17:44:15 -08:00
Ivan Shynkarenka
80dc7cceb8
Fixed format.h(1465): warning C4702: unreachable code ( #2106 )
...
* Fixed format.h(1465): warning C4702: unreachable code
* Fixed format.h(1416): warning C4702: unreachable code
2021-01-19 17:13:10 -08:00
Victor Zverovich
7fd535c6ae
Cleanup 'L' handling
2021-01-18 07:57:38 -08:00
Victor Zverovich
e4f2cf455e
Make 'L' a modifier
2021-01-17 09:28:46 -08:00
Victor Zverovich
532e846b86
Fix width computation in float formatter
2021-01-15 11:07:55 -08:00
Victor Zverovich
f8c2f8480a
Fix handling of width when formatting int as char
2021-01-14 08:41:17 -08:00
Victor Zverovich
0fe0b15e71
Fix handling of # in width computation
2021-01-13 16:48:07 -08:00
Victor Zverovich
061e364b25
Document output_file
2021-01-09 07:18:56 -08:00
Victor Zverovich
9ec5592bb5
Fix writing to stdout when redirected to NUL on Windows ( #2080 )
2020-12-30 13:23:37 -08:00
Alexey Ochapov
cdc5ef6710
Remove fallback to inline specifier from FMT_CONSTEXPR(20) macro ( #2075 )
2020-12-30 06:23:20 -08:00
Victor Zverovich
c9dd1eb97d
Don't change charset
2020-12-27 07:44:02 -08:00
Alexey Ochapov
d09b5c1453
Fix std::byte formatting with compile-time API ( #2072 )
...
* add test for byte formatting with `FMT_COMPILE`
* fix byte formatting with `FMT_COMPILE`, use `__cpp_lib_byte` macro
* use is not custom mapped type check
* workaround MSVC bug
2020-12-27 07:23:28 -08:00
Alexey Ochapov
bbd6ed5bc5
Add support of most format_specs for formatting at compile-time ( #2056 )
2020-12-25 06:40:03 -08:00
Victor Zverovich
1256541d7a
Fix formatting
2020-12-24 07:07:15 -08:00
Walter Gray
4fa4c9248f
Add tests for FMT_ENFORCE_COMPILE_STRING, fix several errors ( #2038 )
2020-12-24 06:40:46 -08:00
Issam Maghni
aa89e380d9
add cwchar to format.h for std::fputws ( #2073 )
2020-12-23 07:02:25 -08:00
Björn Schäpers
5a37e182de
Disable warning about format string ( #2067 )
...
Reported by MinGW/GCC 10
2020-12-21 08:43:30 -08:00
Daumantas Kavolis
fa43fd1444
Forward arguments to work with views ( #2068 )
2020-12-20 07:14:54 -08:00
Victor Zverovich
3551f5d118
Workaround a gcc 10 -Warray-bounds bug ( #2065 )
2020-12-19 09:34:43 -08:00
Victor Zverovich
e737672614
Remove an old mingw workaround ( #2059 )
2020-12-10 06:36:04 -08:00
Finkman
9293f7072e
Suppress gcc warning on privates-only class ( #2053 )
...
Since gcc 9 it warns about is_streamable to have only private methods.
Add explicit default ctor instead of suppression
2020-12-09 06:55:17 -08:00
Camille Bordignon
c20874c28f
Reenable support for fallback formatter in join ( #2040 ) ( #2050 )
2020-12-08 08:56:53 -08:00
Alexey Ochapov
5de0bc1d4f
Add UDL as replacement for FMT_COMPILE ( #2043 )
2020-12-07 15:53:11 -08:00
Victor Zverovich
33f9a6d360
Fix handling of enums in to_string ( #2036 )
2020-12-03 15:18:33 -08:00
Victor Zverovich
1f4a76d2c8
Add a missing include ( #2047 )
2020-12-03 14:17:09 -08:00