Commit Graph

1641 Commits

Author SHA1 Message Date
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
Victor Zverovich
530cf316b8 Point to the release, not dev documentation 2020-10-24 12:02:12 -07:00
Victor Zverovich
8de96817ce Woraround bugs in gcc 8 2020-10-22 07:33:32 -07:00
Victor Zverovich
47e167679a Simplify arg formatter 2020-10-21 19:04:02 -07:00
Victor Zverovich
f0a42346a4 Move parsing optimization one level up 2020-10-21 18:18:53 -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
9755307842 Optimize format_uint 2020-10-21 08:19:21 -07:00
Victor Zverovich
7446818f98 Simplify vformat_to 2020-10-21 07:15:11 -07:00
darklukee
280b5612c0 Add option to force usage of inline namespaces
Detection of inline namespaces is imperfect as some compilers
don't provide __has_feature

This option allows to override it if needed.
2020-10-21 06:38:59 -07:00
Victor Zverovich
e57ec7d563 Merge vformat_to overloads 2020-10-20 17:39:50 -07:00
Victor Zverovich
2a3f4de3f4 Remove iterator_category 2020-10-20 16:44:49 -07:00
Victor Zverovich
27fdb4ead2 Unshadow floaty 2020-10-20 15:05:00 -07:00
Victor Zverovich
297e0bad8c Apply clang-format 2020-10-20 14:10:28 -07:00
Victor Zverovich
e3b4c22ec9 Simplify is_output_iterator 2020-10-20 14:09:57 -07:00
Victor Zverovich
da8278e1e3 Update changelog and bump version 2020-10-19 14:37:14 -07:00
Victor Zverovich
f468b203ad Avoid conversion from long long to size_t (#1935) 2020-10-18 09:25:33 -07:00
Victor Zverovich
20d4f2e836 Fix handling of weird character types when parsing sign (#1932) 2020-10-17 09:40:30 -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
41d97e1ef4 Fix a UB on ridiculously large precision 2020-10-11 08:07:52 -07:00
MarcDirven
01c37e0a4b
Added check for -mbig-obj and ref qualifier check (#1929)
* Added check whether mingw has -mbig-obj flag
* Removed ref qualifiers
2020-10-11 07:49:54 -07:00
Victor Zverovich
a5e7e7db95 Fix handling of thousand separator (#1927) 2020-10-10 07:23:36 -07:00
Victor Zverovich
bf19051a9f Optimize floating point formatting 2020-10-09 15:29:56 -07:00
Victor Zverovich
3c13a88b14 Optimize floating point formatting 2020-10-09 11:01:01 -07:00
Victor Zverovich
f6d75c534c Refactor write_float 2020-10-09 09:11:39 -07:00
Victor Zverovich
e9c0b2d69e Merge write_float overloads 2020-10-08 20:00:38 -07:00
Victor Zverovich
7eddbfed53 Cleanup exponent handling in write_float 2020-10-07 15:58:43 -07:00
Victor Zverovich
b347b3023f Update dynamic_formatter comment (#1923) 2020-10-07 12:15:07 -07:00
Victor Zverovich
3541880efd Fix integer overflow when using max int precision 2020-10-07 11:27:02 -07:00
Victor Zverovich
a18b3fbbdc Fix fixed precision handling when rounding (#1917) 2020-10-07 07:42:23 -07:00
Victor Zverovich
b91d39f20b Get rid of float_writer 2020-10-05 06:34:04 -07:00
Victor Zverovich
b4b64b9cce Refactor float formatting 2020-10-04 14:44:25 -07:00
Victor Zverovich
712abe40f2 Workaround a bug in gcc 7.5 (#1912)
Thanks Martin Janzen.
2020-10-04 09:20:37 -07:00
Victor Zverovich
af8a180aed Make GetCachedPower test more precise 2020-10-04 08:00:47 -07:00
Kazantcev Andrey
a581e9e5d8
Fix warning C4018: '<=': signed/unsigned mismatch (#1908) 2020-10-02 06:30:57 -07:00
Victor Zverovich
575f401896 Simplify FP formatting and follow coding conventions 2020-09-30 06:36:17 -07:00
jk-jeon
6f3536f974
Move zero-check to an earlier branch (#1906) 2020-09-29 06:24:53 -07:00
Victor Zverovich
90ef46df0b Fix dragonbox integration 2020-09-28 18:10:46 -07:00
Victor Zverovich
3ae88147e2 Fix declaration 2020-09-28 06:50:09 -07:00
Victor Zverovich
6417952574 Improve dragonbox integration 2020-09-27 20:49:37 -07:00
Victor Zverovich
79694d424c Fix WriteConsole signature 2020-09-27 14:26:28 -07:00
Victor Zverovich
63e0c35412 Make dragonbox::to_decimal available in format.h 2020-09-27 07:27:44 -07:00
Victor Zverovich
762c33a964
Simplify windows handling (#1903) 2020-09-26 08:20:38 -07:00
Bernd Baumanns
253d63159f
Remove dependency on windows.h (#1900) 2020-09-26 07:03:16 -07:00
Victor Zverovich
c156093ffd Fix carry in fallback_format 2020-09-25 10:12:44 -07:00
moiwi
34179b3354
Update format.h (#1898) 2020-09-24 08:16:16 -07:00
Victor Zverovich
0651e4598b Minor tweaks to get_cached_power 2020-09-23 16:04:40 -07:00
Victor Zverovich
6c025520aa Test that max_k is correctly defined 2020-09-23 15:44:37 -07:00
Victor Zverovich
51f8d0cc21 Reuse log10_2_significand constant 2020-09-23 13:19:21 -07:00
Riccardo Ghetta (larix)
1305cbeb6f
Fix MSVC2019 error C2049 when compiling with /clr (#1897)
'fmt::v7': non-inline namespace cannot be reopened as inline
2020-09-23 09:55:41 -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
5fd89d50e4 Minor simplifications 2020-09-23 08:05:31 -07:00
Victor Zverovich
605ce5e429 Simplify divisible_by_power_of_2 2020-09-22 20:44:29 -07:00
Victor Zverovich
085171e7e6 Remove grisu_count_digits 2020-09-22 19:36:52 -07:00
Victor Zverovich
aa729bf25b Remove dead code 2020-09-22 16:58:02 -07:00
Victor Zverovich
aa2ddf9b86 Simplify Dragonbox integration 2020-09-22 16:20:40 -07:00
Victor Zverovich
c1654ce487 Simplify uint32_or_64_or_128_t definition 2020-09-22 15:08:37 -07:00
Victor Zverovich
33712dc07a Combine pragmas 2020-09-22 14:47:35 -07:00
Victor Zverovich
e5942ac9dd Tweak comments 2020-09-22 14:36:10 -07:00
Victor Zverovich
aae7a1338c Remove unused pragmas 2020-09-22 14:00:41 -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
bb0db5e51e clang-format 2020-09-22 08:19:37 -07:00
Victor Zverovich
16410056bf Optimize copy_str for counting_iterator 2020-09-22 07:56:09 -07:00
mwinterb
2591ab91c3
MSVC optimizations for count_digits. (#1890)
Changed the clz implementations to use xor instead of subtraction so that when
count_digits "undoes" the BSR -> CLZ translation, the optimizer is more
willing to recognize the equivalence.
Changed the data array in bsr2log10 to static since otherwise MSVC generates
code to build the array every time the function is called.
2020-09-21 11:38:06 -07:00
jk-jeon
2e620ddbcd
Small improvements that should have zero to negligible impact on the runtime (#1887) 2020-09-20 09:34:44 -07:00
Victor Zverovich
2f7e08856b Disable range formatter if value type is not formattable (#1885) 2020-09-20 08:37:49 -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
Victor Zverovich
0016da7ab3 Don't generate zeros and fix UB on huge precision 2020-09-19 16:01:43 -07:00
Victor Zverovich
ce3f76994a Merge intrinsic blocks 2020-09-19 07:54:45 -07:00
Junekey Jeon
3b6248f602 Change formatting 2020-09-19 07:23:41 -07:00
Junekey Jeon
2d9b1dd0ad Fix sign mismatch 2020-09-19 07:23:41 -07:00
Junekey Jeon
1f0600a23b Fix bug regarding FMT_SAFEBUFFERS 2020-09-19 07:23:41 -07:00
Junekey Jeon
2ecdbb986d Fix a bug in ctzll 2020-09-19 07:23:41 -07:00
Junekey Jeon
6f81ea151a Fix typo (and thus bug) 2020-09-19 07:23:41 -07:00
Junekey Jeon
0c8ffe9b0f Implement Dragonbox (first version) 2020-09-19 07:23:41 -07:00
jk-jeon
42699bf408
Fix msvc version of clz & clzll (#1880)
Change msvc version of clz & clzll to match __builtin_clz & _builtin_clzll
2020-09-18 11:07:01 -07:00
Axel Kohlmeyer
bc51a8df04
Disable fallthrough attributes for the Intel compilers on Linux and MacOS (#1879)
* Disable fallthrough attributes for the Intel compilers

On MacOS and Linux the Intel compilers may be identified as the
host compilers (Clang or GNU) but do not support the corresponding
compiler specific fallthrough attributes.

* Rearrange ifdef logic for excluding pre-C++17 fallthrough attributes

This puts Intel and PGI compilers into a separate group
and thus makes the intent and logic more obvious.
2020-09-18 09:57:00 -07:00
Jan Schwers
45da432d60 fix compiler warnings in public header files 2020-09-17 15:53:53 -07:00
jk-jeon
d55e61f120
Improve FMT_ALWAYS_INLINE (#1878)
1. FMT_ALWAYS_INLINE should imply inline; otherwise, there might be
   linkage problems
2. Add specialization for MSVC (__forceinline)
2020-09-17 15:21:17 -07:00
Victor Zverovich
7e6827521a Remove trailing zeros when using fallback formatter (#1873) 2020-09-17 08:16:21 -07:00
Victor Zverovich
1d696dc280 Handle exotic character types in compilation 2020-09-17 07:12:34 -07:00
Alexey Ochapov
f674434a67
Add format_to_n overload that accepts FMT_COMPILE (from #1767) (#1869)
* Add format_to_n overload that accepts FMT_COMPILE

* add FormatToNWithCompileMacro test into CompileTest

Co-authored-by: Dmitriy Kurkin <Dmitriy.Kurkin@itiviti.com>
2020-09-15 07:28:06 -07:00
Victor Zverovich
5b5a597198 Fix handling of wide alignment 2020-09-15 06:53:06 -07:00
Victor Zverovich
3813966497 Simplify fallback format 2020-09-13 11:27:34 -07:00
Victor Zverovich
dce8e49b4f Handle float in fallback formatter 2020-09-13 09:28:40 -07:00
Victor Zverovich
78b5944313 Spelling 2020-09-12 13:14:49 -07:00
Victor Zverovich
f233b56cdd Don't generate insignificant digits 2020-09-12 09:19:50 -07:00
Victor Zverovich
58a044be5d Use built-in FP formatter for any precision 2020-09-11 07:19:45 -07:00
Victor Zverovich
efe3694f15 Macro tweak and clang-format 2020-09-07 14:43:00 -07:00
Victor Zverovich
9f312fe87e Implement fallback FP formatting with given precision (#1526) 2020-09-07 09:34:30 -07:00
Victor Zverovich
86f0a7046e Fix formatting 2020-09-06 08:58:19 -07:00
Denis Blank
bff4d18efb Add color format_to overloads
* Fix variable size basic_memory_buffer colorization
* Fix an unused arguments warning on GCC that blocks the CI otherwise
* Ref #1842
* Ref #1593
2020-09-06 08:24:15 -07:00
Ivan Shynkarenka
f19b8885f2
Fixed a warning in mingw32/mingw64 (#1860) 2020-09-06 06:27:37 -07:00
Giovanni Cerretani
f8e00a084a
NOMINMAX not handled properly (#1855) 2020-09-03 09:45:47 -07:00
Victor Zverovich
6cccdc24bc Fix move constructor (#1844) 2020-09-01 08:48:56 -07:00
t-wiser
69902c1787
Allow use of <fcntl.h> in Linux when __has_include is not available (#1848) 2020-09-01 06:29:34 -07:00
t-wiser
1edd38b96e
Add append mode. (#1847) 2020-08-31 15:48:39 -07:00
Adam Burgess
f39e6fb617
Add formatters for chrono::time_point<system_clock> (#1837)
Add formatters for chrono::time_point and helper overloads for localtime/gmtime(time_point)
Fixes #1819
2020-08-28 07:41:38 -07:00
Victor Zverovich
77b627be20 Fix bogus MSVC warnings (#1825) 2020-08-26 12:33:54 -07:00
Alexander Lanin
c7e6d8afb0
Fix usage of override (#1836) 2020-08-23 11:01:46 -07:00
Victor Zverovich
92bff2fe2c Revert "Add missing includes"
This reverts commit 06895a7687.
2020-08-21 16:24:53 -07:00
Victor Zverovich
a0dcfbc57b Add ptr to docs 2020-08-21 06:54:05 -07:00
Alexey Ochapov
1651b2d433
Fix detail::write with fallback formatter (#1829)
* add support for fallback_formatter in detail::write

* add ToString test into OStreamTest

to check fmt::to_string() with class that has output stream operator

* add WithOstreamOperator test into CompileTest

to check fmt::format() with FMT_COMPILE() and class that has output stream operator

* use conditional_t inside detail::write instead of 2 overloads

* Revert "add WithOstreamOperator test into CompileTest"

* remove Context from template parameters in detail::write
2020-08-20 06:41:09 -07:00
Victor Zverovich
06895a7687 Add missing includes 2020-08-19 20:33:04 -07:00
Victor Zverovich
92a448a071 Apply clang-format 2020-08-19 10:42:22 -07:00
Barry Revzin
6be6544668
Fixing buffer_appender's ++ slicing (#1822)
* Fixing buffer_appender's ++ slicing.

* This test requires C++14.

* Removing string_view dependency.

* Simplifying test case.

* Adding message to static_assert
2020-08-18 12:37:56 -07:00
Greg Sjaardema
76e97dc4df
Eliminate shadowed variable warnings on intel (#1816)
The intel-19 compiler warns about hidden variables:
```
/s/dev/nightly/libraries/ioss/src/fmt/format.h(2689): warning #1599: declaration hides variable "begin" (declared at line 2668)
      FMT_CONSTEXPR void operator()(const Char* begin, const Char* end) {
                                                ^
          detected during:
            instantiation of "Context::iterator fmt::v7::vformat_to<ArgFormatter,Char,Context>(ArgFormatter::iterator, fmt::v7::basic_string_view<Char>, fmt::v7::basic_format_args<Context>, fmt::v7::detail::locale_ref) [with ArgFormatter=fmt::v7::detail::arg_formatter<fmt::v7::detail::buffer_appender<char>, char>, Char=char, Context=fmt::v7::format_context]" at line 3492
            instantiation of "fmt::v7::detail::buffer_appender<Char> fmt::v7::detail::vformat_to(fmt::v7::detail::buffer<Char> &, fmt::v7::basic_string_view<Char>, fmt::v7::basic_format_args<fmt::v7::basic_format_context<fmt::v7::detail::buffer_appender<fmt::v7::type_identity_t<Char>>, fmt::v7::type_identity_t<Char>>>) [with Char=char]" at line 1413 of "/s/dev/nightly/libraries/ioss/src/fmt/format-inl.h"

/s/dev/nightly/libraries/ioss/src/fmt/format.h(2689): warning #1599: declaration hides variable "end" (declared at line 2669)
      FMT_CONSTEXPR void operator()(const Char* begin, const Char* end) {
                                                                   ^
          detected during:
            instantiation of "Context::iterator fmt::v7::vformat_to<ArgFormatter,Char,Context>(ArgFormatter::iterator, fmt::v7::basic_string_view<Char>, fmt::v7::basic_format_args<Context>, fmt::v7::detail::locale_ref) [with ArgFormatter=fmt::v7::detail::arg_formatter<fmt::v7::detail::buffer_appender<char>, char>, Char=char, Context=fmt::v7::format_context]" at line 3492
            instantiation of "fmt::v7::detail::buffer_appender<Char> fmt::v7::detail::vformat_to(fmt::v7::detail::buffer<Char> &, fmt::v7::basic_string_view<Char>, fmt::v7::basic_format_args<fmt::v7::basic_format_context<fmt::v7::detail::buffer_appender<fmt::v7::type_identity_t<Char>>, fmt::v7::type_identity_t<Char>>>) [with Char=char]" at line 1413 of "/s/dev/nightly/libraries/ioss/src/fmt/format-inl.h"
```
Rename the second set of variables to `pbegin` and `pend` to eliminate warning.
2020-08-13 18:58:31 -07:00
Greg Sjaardema
e204df0e66
nvcc compiler should be EDG-based, but fails test (#1818)
Our nvcc compilers (10.1.243 and 9.2.X) do not define the correct value for `FMT_USE_UDL_TEMPLATE` and then end up with an error later on in the build.  Explicitly search for `__NVCC__` symbol not being defined.   Might want to instead use `FMT_NVCC` or some other check, but the raw `__EDG_VERSION__` check is not working correctly for nvcc.
2020-08-13 15:18:57 -07:00
medithe
1c8bb54703
small changes to reduce clang-9 warnings (#1808)
* include/fmt/format.h: int_writer: removed unnecessary iterator type re-declaration (prevents shadow-waringing in clang)

* include/fmt/format.h: int_writer: correctly cast signed integer to unsigned to prevent 'implicit conversion changes signedness'-warnings in clang.

Co-authored-by: Martin Wührer <martin.wuehrer@artech.at>
2020-08-13 11:56:03 -07:00
Seokjin Lee
4b69c78751
fix: warning C4100: unreferenced formal parameter (#1814)
Add [[maybe_unused]] to fix it.
2020-08-12 06:57:22 -07:00
n16h7hunt3r
fb0aeb8209
fix: disabled UDL templates for PGI (#1811) (#1812)
* fix: disabled UDL templates for PGI (#1811)

* fix: insert defined auround __PGI

Co-authored-by: n16h7hunt3r <n16h7hunt3r@nixos>
2020-08-11 15:27:27 -07:00
Victor Zverovich
54daa0864a Add dynamic width support to FMT_COMPILE (#1809) 2020-08-10 09:40:11 -07:00
Victor Zverovich
6fb7c6fb25 Workaround a bug in gcc10 (#1810) 2020-08-10 07:20:34 -07:00
Victor Zverovich
4fd95e4b4d Don't remove trailing zeros with # 2020-08-08 08:14:39 -07:00
Victor Zverovich
e06ae32294 Avoid warnings on functions with external linkage that don't have declarations 2020-08-08 07:58:13 -07:00
Victor Zverovich
7fc3d1f54c Add override to grow 2020-08-08 07:23:11 -07:00
Victor Zverovich
065889a593 Use correct capacity in iterator_buffer (#1807) 2020-08-08 07:01:21 -07:00
Barry Revzin
d0dd678693 Adding convenience append(range) 2020-08-08 06:33:46 -07:00
Victor Zverovich
c13f79e09e Merge release branch 2020-08-07 07:01:21 -07:00
Victor Zverovich
1ebc2f7cc6 Bump version 2020-08-06 07:41:04 -07:00
Victor Zverovich
0907c08ae5 Fix handling of default alignmment with locale (#1801) 2020-08-06 07:39:09 -07:00
Kingcom
37c8f4eaf3 Don't use 128 bit integers with clang-cl (#1800)
clang-cl currently has a long-standing bug that using 128 bit integers
generates references to symbols that are provided neither by its own nor
by the Microsoft runtime: https://bugs.llvm.org/show_bug.cgi?id=25305
2020-08-06 07:38:57 -07:00
Victor Zverovich
eaaaec9992 Workaround a bug in msvc 2020-08-06 07:38:51 -07:00
Victor Zverovich
ccf8561cb3 Workaround broken numeric_limites, part 2 (#1787) 2020-08-06 07:38:32 -07:00
Victor Zverovich
0cc73ebf79 Report error on missing named argument (#1796) 2020-08-06 07:38:18 -07:00
Victor Zverovich
33efc3c94f Fix handling of iterators in locale-specific formatting (#1782) 2020-08-06 07:38:08 -07:00
medithe
717b226b59
include/fmt/format.h: explicit cast to std::size_t for parameter to buffer.resize() in order to get rid of warning 'implicit conversion changes signedness:' in clang-8 (#1802)
Co-authored-by: Martin Wührer <martin.wuehrer@artech.at>
2020-08-05 09:37:10 -07:00
Victor Zverovich
2a69f56769 Tweak buffer size 2020-08-05 08:22:12 -07:00
Victor Zverovich
ea76933802 Simplify ostream 2020-08-04 20:11:43 -07:00
Victor Zverovich
5413713c95 Remove unused function 2020-08-04 19:08:06 -07:00
Victor Zverovich
57f462428d Increase the default buffer size 2020-08-04 08:19:19 -07:00
Victor Zverovich
e587adb4e9 Simplify count_digits 2020-08-03 15:45:48 -07:00
Victor Zverovich
279d698e1b Fix handling of default alignmment with locale (#1801) 2020-08-03 10:51:42 -07:00
Victor Zverovich
76cfb50b2d Test complex formatter 2020-08-03 10:05:18 -07:00
Victor Zverovich
208291205d Optimize count_digits 2020-08-02 07:58:36 -07:00
Victor Zverovich
8d9ab96736 Cut a few cycles from count_digits 2020-08-01 18:33:53 -07:00
Victor Zverovich
734344931f Simplify ostream_params 2020-08-01 18:33:53 -07:00
Victor Zverovich
7c4c5c79d2 Make buffer size configurable 2020-08-01 10:53:58 -07:00
Kingcom
f0b84da5ff
Don't use 128 bit integers with clang-cl (#1800)
clang-cl currently has a long-standing bug that using 128 bit integers
generates references to symbols that are provided neither by its own nor
by the Microsoft runtime: https://bugs.llvm.org/show_bug.cgi?id=25305
2020-07-30 17:21:35 -07:00
Victor Zverovich
a3dfd6f927 Workaround a bug in msvc 2020-07-30 11:13:54 -07:00
Victor Zverovich
51d05521e9 Workaround broken numeric_limites, part 2 (#1787) 2020-07-30 09:42:24 -07:00
Victor Zverovich
21c8b5c142 Report error on missing named argument (#1796) 2020-07-30 07:16:15 -07:00
Victor Zverovich
d82fdcc9e2 Fix handling of iterators in locale-specific formatting (#1782) 2020-07-30 07:03:11 -07:00
Victor Zverovich
86b63bb71a Bump version 2020-07-29 07:14:25 -07:00
Victor Zverovich
229ee9b469 Workaround broken numeric_limits (#1725) 2020-07-29 07:06:45 -07:00
Victor Zverovich
2b7a146fa1 Fix a regression in handling digit separators (#1782) 2020-07-29 07:04:11 -07:00
Victor Zverovich
e8f2580a43 Bump version 2020-07-28 09:25:15 -07:00
Victor Zverovich
95d3abf95c Make format_to_n part of the core API 2020-07-24 09:25:26 -07:00
Victor Zverovich
47f8d7a345 Make formatted_size part of the core API 2020-07-23 08:51:38 -07:00
TheQwertiest
430f393d6f
Disabled __attribute__((deprecated)) usage for LCC (#1790) 2020-07-23 06:34:03 -07:00
Tony E Lewis
febffa4e64
Make join() handle non-const-only begin/end ranges (#1786)
See fmtlib/fmt#1784.

Add tests that demonstrate the problem and check obvious variations.
2020-07-21 12:13:00 -07:00
Victor Zverovich
d69e2da221 Fix apidoc 2020-07-20 10:38:14 -07:00
Victor Zverovich
d39d661b18 Workaround broken numeric_limits (#1725) 2020-07-20 08:39:15 -07:00