Commit Graph

4911 Commits

Author SHA1 Message Date
Victor Zverovich
2c734c9bca Fix an overflow in format_to_n (#2029) 2020-11-18 06:50:43 -08:00
Park DongHa
6cdd1be93e
Update build.gradle for latest AGP (#2026)
* update build.gradle for latest AGP

* bump Android Gradle Plugin version to 4.1.1
* ignore .cxx which was externalNativeBuild in old versions

Use variable 'rootDir' instead of using relative path.

* build.gradle copies AAR files to libs/
2020-11-17 06:31:06 -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
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
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
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
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
f428d286a1
Update README.rst 2020-11-11 07:11:43 -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
Victor Zverovich
e528d919a8 Merge branch 'master' of github.com:fmtlib/fmt 2020-11-08 12:45:15 -08:00
Victor Zverovich
4881677268 Update signatures 2020-11-08 12:29:26 -08:00
rimathia
3302fd1088
use memchr for searching for '%' in printf format string (#1984) 2020-11-08 10:36:00 -08:00
Victor Zverovich
4c2d637203 Update signatures 2020-11-08 10:10:44 -08:00
Victor Zverovich
beaff39618 Update signatures 2020-11-08 10:00:08 -08:00
Victor Zverovich
ffa0a0834a Use newer versions of Sphinx and Breathe 2020-11-08 09:46:27 -08:00
Victor Zverovich
038057eb3e Document contexts 2020-11-08 08:16:23 -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
1ac50fcb5a Suppress more bogus warnings 2020-11-08 07:04:42 -08:00
Victor Zverovich
e098be8e88 Fix warning filtering 2020-11-08 06:58:41 -08:00
Victor Zverovich
8cf0afaf1c Improve docs 2020-11-08 06:48:34 -08:00
Victor Zverovich
e29f93e8a8 Suppress more bogus warnings 2020-11-08 06:33:42 -08:00
Victor Zverovich
4e8d000f76 Suppress more bogus warnings 2020-11-08 06:29:50 -08:00
Victor Zverovich
7787792e8d Fix re usage 2020-11-08 06:20:53 -08:00
Victor Zverovich
6ee5e507c7 Fix imports 2020-11-08 06:16:49 -08:00
Victor Zverovich
06ee32d1b5 Filter useless doxygen warnings 2020-11-08 06:13:56 -08:00
Victor Zverovich
86bb7fe614 Add a missing import 2020-11-08 05:55:49 -08:00
Victor Zverovich
959a9f5cad Merge branch 'master' of github.com:fmtlib/fmt 2020-11-08 05:50:48 -08:00
Victor Zverovich
4f7df299ea Improve docs 2020-11-08 05:40:39 -08:00
Jonathan Gopel
b3ab0bc7e3
🎨 [CI] Specify the exact version of clang to use (#1991)
Problem:
- The version of clang to use is specified only as `clang++`. This is
  inconsistent with the specifications for gcc and exposed to unexpected
  failure if the default changes.

Solution:
- Specify the exact version of clang to use. I chose `clang++-9` as that
  is the version that `clang++` is currently resolving to.

Co-authored-by: Jonathan Gopel <jgopel@quantlab.com>
2020-11-08 05:18:24 -08:00
Victor Zverovich
701ed6c874 Install deps in github actions instead of script 2020-11-07 11:16:38 -08:00
Victor Zverovich
8f2131cf2d Document chrono 2020-11-07 10:51:08 -08:00
Victor Zverovich
32c4af8f0d Document chrono 2020-11-07 10:38:51 -08:00
Victor Zverovich
295a60ec8d Document chrono 2020-11-07 10:30:23 -08:00
Victor Zverovich
a4fae96c96 Document chrono 2020-11-07 10:24:27 -08:00