Commit Graph

828 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
Alexey Ochapov
cdc5ef6710
Remove fallback to inline specifier from FMT_CONSTEXPR(20) macro (#2075) 2020-12-30 06:23:20 -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
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
Victor Zverovich
3551f5d118 Workaround a gcc 10 -Warray-bounds bug (#2065) 2020-12-19 09:34:43 -08:00
Camille Bordignon
c20874c28f
Reenable support for fallback formatter in join (#2040) (#2050) 2020-12-08 08:56:53 -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
Victor Zverovich
4a6eadbde0 Make std::byte formattabe (#1981) 2020-12-03 08:59:07 -08:00
Victor Zverovich
5a493560f5 Move some code from core.h to format.h where it is used 2020-11-29 09:45:15 -08:00
Alexey Ochapov
dac753b81e
Basics of formatting at compile-time based on compile-time API (#2019) 2020-11-29 08:59:11 -08:00
Victor Zverovich
22a68d1613 Don't emit trailing zeros by default 2020-11-27 07:45:54 -08:00
Victor Zverovich
5f41bb0f77 clang-format 2020-11-23 10:23:54 -08:00
Victor Zverovich
bcc20b29df Implement compile-time checks by default 2020-11-15 17:24:36 -08:00
Victor Zverovich
f81c14aa1e Workaround an issue with mixing std versions in gcc (#2017) 2020-11-14 11:41:51 -08:00
rimathia
b268f8815d
detail::write in one more place relevant to printf with long argument… (#2016) 2020-11-13 12:14:16 -08:00
Victor Zverovich
6d14f78115 Fix linkage errors when linking with a shared library (#2011) 2020-11-12 06:11:17 -08:00
Victor Zverovich
9534b9fe69 Refactor warning suppression 2020-11-12 05:45:36 -08:00
Victor Zverovich
60dc273513 Simplify on_text 2020-11-11 15:13:44 -08:00
Victor Zverovich
b5dac0f0f8 Reduce <algorithm> usage (#1998) 2020-11-11 09:12:15 -08:00
Victor Zverovich
beb248b6ac Optimize handling of large format strings 2020-11-11 06:11:05 -08:00
Victor Zverovich
a30b279bad Apply clang-format and tweak comments 2020-11-04 17:17:23 -08:00
Alexey Ochapov
6a2495c840
-Wattributes visibility warning with some GCC versions (#1975) 2020-11-04 17:11:31 -08:00
darklukee
771292c328
Remove sizeof from unused variable silencer (#1974)
Using sizeof causes some compilers to complain:
'operand of sizeof is not a type, variable, or dereferenced pointer'

static_cast itself should be enough to silence unused variable warning

Co-authored-by: Łukasz Mitka <lukasz.mitka@aptiv.com>
2020-11-03 06:48:19 -08:00
Victor Zverovich
112755cf91 Remove FMT_SAFEBUFFERS (#1966) 2020-10-29 17:42:45 -07:00
Victor Zverovich
4081b2fe94 Fix ABI compatibility (#1961) 2020-10-29 11:29:47 -07:00
Vladislav Shchapov
97c8873214
Allocator::max_size support in basic_memory_buffer (#1960) 2020-10-29 06:17:00 -07:00