Commit Graph

1493 Commits

Author SHA1 Message Date
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
f81c14aa1e Workaround an issue with mixing std versions in gcc (#2017) 2020-11-14 11:41:51 -08:00
Victor Zverovich
5555651ce0 Fix more linkage errors (#2011) 2020-11-14 06:06:10 -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
rimathia
986fa00406
Printf get container (#1982)
* eliminate one case where basic_print_context would copy a string into a fmt::basic_memory_buffer character by character instead of using fmt::basic_memory_buffer::append

* use detail::write instead of re-implementing it

* use to_unsigned to avoid signedness conversion warnings
2020-11-12 08:37:04 -08:00
Victor Zverovich
7abc3c01e0 Suppress a useless warning (#2004) 2020-11-12 08:18:28 -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
Jonathan Gopel
a07627b1f8
🐛 Implicit sign conversion warning in clang in c++17 and 20 modes (#2009)
Problem:
- On Apple clang version 11.0.3 (clang-1103.0.32.62) in C++17 and C++20
  mode, clang 11.0.0 in C++17 and C++20 mode, and clang 9.0.1 in C++17
  mode, the following error is generated:

    In file included from test/compile-test.cc:16:
    include/fmt/compile.h:518:25: error: implicit conversion changes signedness: 'long' to 'unsigned long' [-Werror,-Wsign-conversion]
      return {f, pos + (end - str.data()) + 1, ctx.next_arg_id()};
                     ~  ~~~~^~~~~~~~~~~~
    include/fmt/compile.h:538:31: note: in instantiation of function template specialization
          'fmt::v7::detail::parse_specs<int, char>' requested here
          constexpr auto result = parse_specs<id_type>(str, POS + 2, ID);
                                  ^
    include/fmt/compile.h:569:17: note: in instantiation of function template specialization
          'fmt::v7::detail::compile_format_string<fmt::v7::detail::type_list<int>, 0, 0, FMT_COMPILE_STRING>' requested here
            detail::compile_format_string<detail::type_list<Args...>, 0, 0>(
                    ^
    include/fmt/compile.h:648:37: note: in instantiation of function template specialization
          'fmt::v7::detail::compile<int, FMT_COMPILE_STRING, 0>' requested here
      constexpr auto compiled = detail::compile<Args...>(S());
                                        ^
    test/compile-test.cc:140:24: note: in instantiation of function template specialization
          'fmt::v7::format<FMT_COMPILE_STRING, int, 0>' requested here
      EXPECT_EQ("42", fmt::format(FMT_COMPILE("{:x}"), 0x42));
                           ^
    In file included from test/compile-test.cc:16:
    include/fmt/compile.h:518:25: error: implicit conversion changes signedness: 'long' to 'unsigned long' [-Werror,-Wsign-conversion]
      return {f, pos + (end - str.data()) + 1, ctx.next_arg_id()};
                     ~  ~~~~^~~~~~~~~~~~
    include/fmt/compile.h:538:31: note: in instantiation of function template specialization
          'fmt::v7::detail::parse_specs<char [4], char>' requested here
          constexpr auto result = parse_specs<id_type>(str, POS + 2, ID);
                                  ^
    include/fmt/compile.h:494:27: note: in instantiation of function template specialization
          'fmt::v7::detail::compile_format_string<fmt::v7::detail::type_list<int, int, char const (&)[4], int>, 5, 2, FMT_COMPILE_STRING>'
          requested here
        constexpr auto tail = compile_format_string<Args, POS, ID>(format_str);
                              ^
    include/fmt/compile.h:539:14: note: in instantiation of function template specialization
          'fmt::v7::detail::parse_tail<fmt::v7::detail::type_list<int, int, char const (&)[4], int>, 5, 2, fmt::v7::detail::spec_field<char, int, 0>, FMT_COMPILE_STRING>' requested here
          return parse_tail<Args, result.end, result.next_arg_id>(
                 ^
    include/fmt/compile.h:569:17: note: in instantiation of function template specialization
          'fmt::v7::detail::compile_format_string<fmt::v7::detail::type_list<int, int, char const (&)[4], int>, 0, 0, FMT_COMPILE_STRING>'
          requested here
            detail::compile_format_string<detail::type_list<Args...>, 0, 0>(
                    ^
    include/fmt/compile.h:648:37: note: in instantiation of function template specialization
          'fmt::v7::detail::compile<int, int, char const (&)[4], int, FMT_COMPILE_STRING, 0>' requested here
      constexpr auto compiled = detail::compile<Args...>(S());
                                        ^
    test/compile-test.cc:145:18: note: in instantiation of function template specialization
          'fmt::v7::format<FMT_COMPILE_STRING, int, int, char const (&)[4], int, 0>' requested here
                fmt::format(FMT_COMPILE("{:{}}{:{}}"), 42, 4, "foo", 5));
                     ^
    2 errors generated.

Solution:
- Explicitly cast the result of the subtraction to the (unsigned) outer
  type.

Co-authored-by: Jonathan Gopel <jgopel@quantlab.com>
2020-11-11 07:57:52 -08:00
Victor Zverovich
beb248b6ac Optimize handling of large format strings 2020-11-11 06:11:05 -08:00
Lieven de Cock
1936dddc3c
fix gcc warning of missing override (#2001)
Co-authored-by: Lieven de Cock <killerbot@linux-2x3u.suse>
2020-11-10 07:57:21 -08:00
Victor Zverovich
14f6bd0f4e Move one more headers to args.h 2020-11-09 20:35:03 -08:00
Victor Zverovich
e01d26e1a4 Optimize includes 2020-11-09 16:34:54 -08:00
rimathia
3302fd1088
use memchr for searching for '%' in printf format string (#1984) 2020-11-08 10:36:00 -08:00
Victor Zverovich
ffa0a0834a Use newer versions of Sphinx and Breathe 2020-11-08 09:46:27 -08:00
Victor Zverovich
5bedcb665b Fix initialization of iterator_buffer (#1996) 2020-11-08 08:08:55 -08:00
Victor Zverovich
2435ea4113 Workaround MSVC mess 2020-11-08 07:48:03 -08:00
Victor Zverovich
8c6215f5de Fix fmt/color.h 2020-11-08 07:24:07 -08:00
Victor Zverovich
10ebe6cb48 Document color 2020-11-08 07:18:01 -08:00
Victor Zverovich
4f7df299ea Improve docs 2020-11-08 05:40:39 -08:00
Victor Zverovich
8f2131cf2d Document chrono 2020-11-07 10:51:08 -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
Victor Zverovich
689081d832 Merge branch 'release' of github.com:fmtlib/fmt 2020-11-04 07:46:02 -08:00
Victor Zverovich
e4eb242ce8 Update changelog and bump version 2020-11-03 21:20:53 -08:00
Victor Zverovich
ce98e0c6a0 Fix fallback float formatter at assymetric bounds (#1976) 2020-11-03 21:18:04 -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
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
86bf6045c6 Merge branch 'release' of github.com:fmtlib/fmt 2020-11-02 06:27:49 -08:00
Victor Zverovich
5d3f0741e3 Update changelog and bump version 2020-11-01 06:28:06 -08:00
Victor Zverovich
563cbb6c21 Add a macro to workaround clang/gcc ABI incompatibility on ARM 2020-11-01 06:10:04 -08:00
Victor Zverovich
425778aa67 Fix ABI compatibility (#1961) 2020-11-01 06:09:31 -08:00
Tobias Hammer
69a84198b0 Remove accidental parenthesis (#1968)
fails only when FMT_BUILTIN_CTZLL is not defined
2020-11-01 06:09:25 -08:00
OptoCloud
5c04504932 Removed [-Wsign-conversion] warning in GCC 2020-11-01 06:09:11 -08:00
Victor Zverovich
28a8eae850 Cleanup 2020-11-01 06:08:50 -08:00
Владислав Щапов
236fea1f00 Workaround bugs in gcc 8 2020-11-01 06:08:28 -08:00
Victor Zverovich
e50ced88c6 Add a macro to workaround clang/gcc ABI incompatibility on ARM 2020-10-31 07:52:08 -07: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
Tobias Hammer
2d9311e860
Remove accidental parenthesis (#1968)
fails only when FMT_BUILTIN_CTZLL is not defined
2020-10-29 07:08:06 -07:00
Vladislav Shchapov
97c8873214
Allocator::max_size support in basic_memory_buffer (#1960) 2020-10-29 06:17:00 -07:00
OptoCloud
bb68f6089b Removed [-Wsign-conversion] warning in GCC 2020-10-28 06:02:17 -07:00
kitegi
f4ca065cfb Range support 2020-10-28 05:35:37 -07:00
Victor Zverovich
7977c2b4d0 Cleanup 2020-10-27 07:19:28 -07:00
Владислав Щапов
e54eb67639 Workaround bugs in gcc 8 2020-10-27 06:11:31 -07:00
Victor Zverovich
df4bd60f42 Bump version 2020-10-25 10:43:03 -07:00