Commit Graph

4618 Commits

Author SHA1 Message Date
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
f80ed64dd9
Update README.rst 2020-09-14 11:13:51 -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
595902f8a0 Update test 2020-09-11 07:57:40 -07:00
Victor Zverovich
4f2ee8921d Use built-in FP formatter for any precision 2020-09-11 07:20:16 -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
fb289cf56b Fix coding conventions 2020-09-06 09:26:32 -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
Joël Lamotte
e66ba16923
Added build2 usage instructions. (#1838)
The `fmt` package have been available for `build2` users for several version, see: https://cppget.org/fmt

This simply add the minimum instructions for making a `build2` project depend on it.

There are other ways to do it, but they need more understanding of `build2`.
2020-08-28 15:15:15 -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
Victor Zverovich
5dff01d31b Add complex tests 2020-08-26 11:48:50 -07:00
Victor Zverovich
d16d585e64 Update signatures 2020-08-26 09:35:19 -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
medithe
951e0d2333
CMakeLists.txt: Added Wundef warning to clang and gcc. (#1823)
Co-authored-by: Martin Wührer <martin.wuehrer@artech.at>
2020-08-18 07:04:44 -07:00
medithe
f9f02df719
CMakeLists.txt: Clang-warnings: removed -Wno-sign-conversion (#1817)
* CMakeLists.txt: Clang-warnings: removed -Wno-sign-conversion

* test/ranges-test.cc: changed type of integer literals to unsigned

* test/format-test.cc: fixed implicit conversion changes signedness warning in clang

Co-authored-by: Martin Wührer <martin.wuehrer@artech.at>
2020-08-14 13:58:20 -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
16985fdadf
Update README.rst 2020-08-09 08:56:51 -07:00