Commit Graph

1348 Commits

Author SHA1 Message Date
Victor Zverovich
ce519e939b Fix exception propagation from iterators (#2097) 2021-01-23 17:27:24 -08:00
Ivan Polyakov
8bf28e6bb1
Add support for s format specifier to bool (#2094) (#2109) 2021-01-23 07:32:41 -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
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
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
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
Alexey Ochapov
aabe0a8473
simplify tests by reordering arguments of EXPECT_EQ (#2044) 2020-12-03 14:21:23 -08:00
Victor Zverovich
4a6eadbde0 Make std::byte formattabe (#1981) 2020-12-03 08:59:07 -08:00
Alexey Ochapov
683a74501f
fix formatting with empty compiled format string (#2042) 2020-12-02 07:14:57 -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
119f7dc3d6 Truncate file by default 2020-11-27 08:15:14 -08:00
Victor Zverovich
22a68d1613 Don't emit trailing zeros by default 2020-11-27 07:45:54 -08:00
Victor Zverovich
a58a6b27c3 Add a newline 2020-11-21 16:52:40 -08:00
Victor Zverovich
a036cc97b7 Reintroduce ostream support to range formatters (#2014) 2020-11-21 16:31:22 -08:00
Victor Zverovich
2c734c9bca Fix an overflow in format_to_n (#2029) 2020-11-18 06:50:43 -08:00
Victor Zverovich
bcc20b29df Implement compile-time checks by default 2020-11-15 17:24:36 -08:00
Walter Gray
befd7d4a2f
Always use FMT_STRING internally where possible [Issue #2002] (#2006)
Co-authored-by: Walter Gray <walter.gray@getcruise.com>
2020-11-15 05:19:06 -08:00
Victor Zverovich
f8640d4050 Add more standards 2020-11-14 12:02:46 -08:00
Victor Zverovich
f81c14aa1e Workaround an issue with mixing std versions in gcc (#2017) 2020-11-14 11:41:51 -08:00
Jonathan Gopel
aa9b09a9e3
🐛 Cannot call non-constexpr function in constexpr context (#2010)
Problem:
- gcc-8 gives the following error when compiling this function on all
  standards:
    test/std-format-test.cc: In member function 'constexpr auto std::formatter<S>::parse(std::format_parse_context&)':
    test/std-format-test.cc:112:17: error: call to non-'constexpr' function 'int isdigit(int)'
        if (!isdigit(c) || (++iter, get_char()) != '}')
         ~~~~~~~^~~

Solution:
- Write a `constexpr` version of `isdigit` for use in this function.

Co-authored-by: Jonathan Gopel <jgopel@quantlab.com>
2020-11-12 10:10:52 -08:00
Victor Zverovich
7abc3c01e0 Suppress a useless warning (#2004) 2020-11-12 08:18:28 -08:00
Victor Zverovich
b5dac0f0f8 Reduce <algorithm> usage (#1998) 2020-11-11 09:12:15 -08:00
Jonathan Gopel
1b8f499ee1
🔧 Silence useless cast warnings (#2008)
Problem:
- gcc-10 is generating the following warning at all standards:

    test/format-test.cc: In member function 'virtual void UtilTest_BitCast_Test::TestBody()':
    test/format-test.cc:108:42: error: useless cast to type 'uint64_t' {aka 'long long unsigned int'} [-Werror=useless-cast]
      108 |   s = fmt::detail::bit_cast<uint32_pair>(uint64_t(~0ull));
          |                                          ^~~~~~~~~~~~~~~
- gcc-8 is generating the following warning at all standards:
    test/format-test.cc: In member function 'virtual void UtilTest_BitCast_Test::TestBody()':
    test/format-test.cc:108:56: error: useless cast to type 'uint64_t' {aka 'long long unsigned int'} [-Werror=useless-cast]
       s = fmt::detail::bit_cast<uint32_pair>(uint64_t(~0ull));
                                                        ^
Solution:
- Cast 0 to a 64 unsigned bit int and then invert.

Co-authored-by: Jonathan Gopel <jgopel@quantlab.com>
2020-11-11 07:56:59 -08:00
Victor Zverovich
e01d26e1a4 Optimize includes 2020-11-09 16:34:54 -08:00
Victor Zverovich
5bedcb665b Fix initialization of iterator_buffer (#1996) 2020-11-08 08:08:55 -08:00
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