Commit Graph

1324 Commits

Author SHA1 Message Date
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
Victor Zverovich
82c4e2236a Cleanup fuzzing 2020-10-13 09:08:04 -07:00
Victor Zverovich
63e40c9614 Fix naming of fuzzers 2020-10-12 16:48:25 -07:00
Victor Zverovich
af28305961 Cleanup 2020-10-11 10:13:42 -07:00
Victor Zverovich
48ea8193df Explain why assert-test is a separate test 2020-10-11 10:13:42 -07:00
Victor Zverovich
1d112bdd1e Remove old test 2020-10-11 10:13:42 -07:00
Victor Zverovich
7e56b6b6cb Fix coding style and remove duplicate fuzzer 2020-10-11 08:07:52 -07:00
Victor Zverovich
a5e7e7db95 Fix handling of thousand separator (#1927) 2020-10-10 07:23:36 -07:00
Victor Zverovich
7eddbfed53 Cleanup exponent handling in write_float 2020-10-07 15:58:43 -07:00
Victor Zverovich
a18b3fbbdc Fix fixed precision handling when rounding (#1917) 2020-10-07 07:42:23 -07:00
Victor Zverovich
af8a180aed Make GetCachedPower test more precise 2020-10-04 08:00:47 -07:00
Victor Zverovich
90ef46df0b Fix dragonbox integration 2020-09-28 18:10:46 -07:00
Victor Zverovich
79694d424c Fix WriteConsole signature 2020-09-27 14:26:28 -07:00
Victor Zverovich
51f2e2ca27 Move nan test to where it belongs 2020-09-27 12:50:18 -07:00
Victor Zverovich
68555fdbd2 Make format-test not depend on color.h 2020-09-27 09:17:57 -07:00
Victor Zverovich
a905d8f704 Merge grisu-test into format-test 2020-09-26 08:23:16 -07:00
Victor Zverovich
c156093ffd Fix carry in fallback_format 2020-09-25 10:12:44 -07:00
Victor Zverovich
6c025520aa Test that max_k is correctly defined 2020-09-23 15:44:37 -07:00
Victor Zverovich
2d4fde3a2e Don't emit trailing zero for consistency with std::format 2020-09-23 09:19:12 -07:00
Victor Zverovich
aa729bf25b Remove dead code 2020-09-22 16:58:02 -07:00
jk-jeon
6bcde9aab2
https://github.com/fmtlib/fmt/pull/1882#issuecomment-696823912 (#1894) 2020-09-22 10:33:52 -07:00
Victor Zverovich
16410056bf Optimize copy_str for counting_iterator 2020-09-22 07:56:09 -07:00
Victor Zverovich
2f7e08856b Disable range formatter if value type is not formattable (#1885) 2020-09-20 08:37:49 -07:00
Victor Zverovich
c46a8de4e1 Simplify test 2020-09-20 07:24:24 -07:00
rimathia
2696dc9273
add forgotten template argument to make_format_args which made some u… (#1877)
* add forgotten template argument to make_format_args which made some uses of FMT_COMPILE not work anymore after 54daa0864a, add more elaborate test cases to compile-test as regression tests

* fix old-style cast which gcc on travis thankfully doesn't accept anymore

* hopefully last forgotten (void*)
2020-09-20 06:51:11 -07:00