Victor Zverovich
ea1cd9638c
Fix apidoc
2020-05-15 10:03:02 -07:00
Victor Zverovich
d3964d7b1e
Merge branch 'master' of github.com:fmtlib/fmt
2020-05-15 09:43:38 -07:00
Victor Zverovich
d18c6723a2
Update docs
2020-05-15 09:43:35 -07:00
rimathia
96c18b26c2
make plus flag for printf not be ignored for char argument ( #1683 )
...
* make plus flag for printf not be ignored for char argument
* clarify overwriting of alignment specifiers for printf with char argument
2020-05-15 06:45:51 -07:00
Vladimir Solontsov
922ea924bf
Make dynamic_format_arg_store reusable and add reserve() ( #1677 )
...
Implemented #1674 : make dynamic_format_arg_store reusable and add
reserve() for better memory menagement.
2020-05-12 11:00:42 -07:00
Victor Zverovich
8069265373
internal -> detail ( #1538 )
2020-05-10 07:34:30 -07:00
Victor Zverovich
963ee08310
Simplify named arguments
2020-05-09 16:43:31 -07:00
Victor Zverovich
02a6fe59fb
Named arguments go brrr
2020-05-09 13:22:38 -07:00
Victor Zverovich
de290f5c4c
Ditch internal::arg_map
2020-05-09 12:43:11 -07:00
Victor Zverovich
d0623de510
Bump version
2020-05-09 10:57:04 -07:00
Markus Werle
73e335ed38
Make implicit capture explicit for C++20 ( #1669 )
2020-05-09 10:55:37 -07:00
Vladimir Solontsov
68201831a5
Support named args in dynamic_format_arg_store ( #1655 ). ( #1663 )
...
Dynamic arguments storage. Implementation of enhancement from issue
#1170 .
2020-05-09 06:25:03 -07:00
Victor Zverovich
7f723fbcb8
Consistently namespace qualify size_t
2020-05-07 15:59:46 -07:00
Victor Zverovich
c06851456d
Purge basic_writer
2020-05-07 15:04:48 -07:00
Victor Zverovich
2f05054dd3
Purge basic_writer
2020-05-07 11:35:41 -07:00
Victor Zverovich
f0ce21164c
Revert enum change
2020-05-07 07:25:33 -07:00
peterbell10
44639b11fe
Fix some warnings ( #1667 )
...
* Fix sign-conversion warning
* Add missing "extern template" declarations for non-header-only build
* Use typed enums to fix Wsigned-enum-bitfield warnings
* Consolidate FMT_HEADER_ONLY code
2020-05-07 06:14:07 -07:00
Victor Zverovich
1c86a99e8f
Purge basic_writer
2020-05-06 18:46:01 -07:00
Victor Zverovich
8f511fc12f
Make copyfmt not throw ( #1666 )
2020-05-06 17:38:46 -07:00
Victor Zverovich
b0f47a13e6
Separate nonfinite formatting
2020-05-06 07:19:37 -07:00
Victor Zverovich
d6cea50d01
Remove deprecated APIs
2020-05-05 20:03:48 -07:00
Victor Zverovich
40bc7163fb
Move FMT_MAYBE_UNUSED to where it's actually used
2020-05-05 19:41:07 -07:00
Victor Zverovich
080e44d0bf
Fix inconsistent type detection ( #1662 )
2020-05-05 19:09:21 -07:00
James Beach
7e57cace5d
Exclude std::abort from compilation when compiling CUDA with Clang ( #1661 )
2020-05-04 06:21:21 -07:00
Victor Zverovich
7b66e2f219
Inherit arg_formatter_base from basic_writer
2020-05-03 21:05:45 -07:00
Victor Zverovich
bab3f58003
Refactor pointer formatting
2020-05-03 20:33:25 -07:00
Victor Zverovich
9cc7edfddc
Move int_writer to the namespace scope
2020-05-03 17:34:48 -07:00
Victor Zverovich
8d9d528bf5
Improve handling of alignment
2020-05-03 10:58:18 -07:00
Victor Zverovich
8efd1a8ef6
Improve handling of alignment
2020-05-03 10:08:57 -07:00
Victor Zverovich
a71bc9c825
Use '0' fill with numeric align for consistency with std::format
2020-05-03 09:52:31 -07:00
Victor Zverovich
60d85d598c
Suppress ubsan warning
2020-05-03 08:43:10 -07:00
Victor Zverovich
c3099beb6f
Cleanup
2020-05-02 22:00:34 -07:00
Victor Zverovich
cbb4cb8991
Remove undocumented deprecated APIs
2020-05-02 21:34:44 -07:00
Victor Zverovich
b85e9ac38b
Simplify vformat_to
2020-05-02 21:34:44 -07:00
Victor Zverovich
e3710ab972
FMT_CONSTEXPR -> constexpr
2020-05-02 21:34:44 -07:00
Victor Zverovich
d6abb2fa03
Reduce library size
2020-05-01 17:23:45 -07:00
Victor Zverovich
7ca89bf87a
Reduce template bloat in write_int
2020-05-01 07:56:57 -07:00
Victor Zverovich
3c114d091b
Fix a shadowing warning ( #1658 )
2020-05-01 07:00:25 -07:00
Victor Zverovich
bca82719ab
Pass iterator by value
2020-04-30 21:06:17 -07:00
Victor Zverovich
99da389627
Make write_padded non-members
2020-04-30 16:05:30 -07:00
Victor Zverovich
f19d667943
Bump fuzzer allocation limit
2020-04-30 08:45:50 -07:00
Victor Zverovich
3e69847616
Reduce branching in write_padded
2020-04-30 06:33:45 -07:00
Victor Zverovich
9ac1eebd47
Reduce library size
2020-04-29 17:37:05 -07:00
asraa
e2ff910675
Replace FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION with fmt-specific macro ( #1650 )
...
Signed-off-by: Asra Ali <asraa@google.com>
2020-04-29 09:12:43 -07:00
Victor Zverovich
f2ed03b919
Fix a warning ( #1649 )
2020-04-28 06:39:24 -07:00
Victor Zverovich
9dde9f0131
Reduce library size
2020-04-27 20:43:30 -07:00
Victor Zverovich
b1af642d1d
Reduce library size
2020-04-27 18:50:49 -07:00
Victor Zverovich
4a617f25c6
Clarify encoding conversion in chrono
2020-04-27 09:57:08 -07:00
Victor Zverovich
6f435f55c8
Improve compile time by using extern template ( #1452 )
2020-04-26 14:02:15 -07:00
Victor Zverovich
cb475cb884
Clarify why we don't check argument id
2020-04-26 13:38:42 -07:00
Victor Zverovich
1e1ac6e964
Check dynamic width/precision id at compile time ( #1614 )
2020-04-25 08:36:24 -07:00
Victor Zverovich
e51c449fe6
Revert "Check dynamic widht/precision id at compile time ( #1614 )"
...
This reverts commit 7d748a6f82
.
2020-04-25 07:43:56 -07:00
Victor Zverovich
0463665ef1
Don't access a C string past precision in printf ( #1595 )
2020-04-22 17:10:23 -07:00
Victor Zverovich
7d748a6f82
Check dynamic widht/precision id at compile time ( #1614 )
2020-04-22 14:45:37 -07:00
Victor Zverovich
2b75bd7ce6
Get rid of do_check_format_string
2020-04-22 12:15:29 -07:00
Victor Zverovich
4a1d5931cb
Simplify udl_formatter with FMT_STRING
2020-04-22 11:26:05 -07:00
Victor Zverovich
811b0f9054
Enable compile-time error tests
2020-04-22 11:00:20 -07:00
Victor Zverovich
56bc86ffac
Suppress bogus MSVC analysis warnings
2020-04-22 07:51:25 -07:00
Victor Zverovich
3f79357ef0
Fix a recent regression in handling max packed arguments
2020-04-22 07:15:19 -07:00
Victor Zverovich
63479c8519
Use a delegating ctor and add inlines
2020-04-20 19:17:16 -07:00
Victor Zverovich
e253b371b2
Don't generate RTTI for allocator
2020-04-19 15:57:48 -07:00
Victor Zverovich
0c86f467bc
Fix build on ancient gcc
2020-04-19 09:52:40 -07:00
Victor Zverovich
1929df4bc2
Simplify format_args
2020-04-19 09:21:39 -07:00
Victor Zverovich
a138221813
Always inline arg_data functions
2020-04-19 08:20:00 -07:00
Victor Zverovich
04e0dfd4bd
Always inline value ctors
2020-04-19 08:05:02 -07:00
Victor Zverovich
04cde756bc
Simplify checks
2020-04-19 07:35:19 -07:00
Victor Zverovich
c9a57b9a81
Fix incorrect assumptions about nul termination
2020-04-18 06:51:52 -07:00
Victor Zverovich
f46f5ecaf0
Reenable constexpr _compile on GCC 9
2020-04-17 06:10:57 -07:00
Victor Zverovich
6e8d7e2776
Don't use constexpr on Intel compiler ( #1628 )
2020-04-16 07:08:04 -07:00
Victor Zverovich
567ed03f88
Merge arg overloads and cleanup
2020-04-15 08:44:58 -07:00
Johan Norberg
c3fa333140
Remove warning in core.h with when compiling with gcc and -Wshadow
...
In file included from build/_deps/fmt-src/include/fmt/format.h:44:0,
from src/main.cpp:5:
build/_deps/fmt-src/include/fmt/core.h: In member function ‘const T& fmt::v6::internal::dynamic_arg_list::push(const Arg&)’:
build/_deps/fmt-src/include/fmt/core.h:1256:10: error: declaration of ‘node’ shadows a member of ‘fmt::v6::internal::dynamic_arg_list’ [-Werror=shadow]
auto node = std::unique_ptr<typed_node<T>>(new typed_node<T>(arg));
^~~~
build/_deps/fmt-src/include/fmt/core.h:1236:37: note: shadowed declaration is here
template <typename = void> struct node {
2020-04-15 07:31:24 -07:00
Johan Norberg
84898b4626
Remove warning in format.h when compiling with gcc and -Wshadow
...
build/_deps/fmt-src/include/fmt/format.h: In member function ‘decltype (ctx.out()) fmt::v6::formatter<fmt::v6::bytes>::format(fmt::v6::bytes, FormatContext&)’:
build/_deps/fmt-src/include/fmt/format.h:3251:58: error: declaration of ‘writer’ shadows a global declaration [-Werror=shadow]
internal::basic_writer<range_type> writer(range_type(ctx.out()));
^~~
build/_deps/fmt-src/include/fmt/format.h:2741:53: note: shadowed declaration is here
using writer FMT_DEPRECATED_ALIAS = internal::writer;
2020-04-15 07:31:24 -07:00
Victor Zverovich
538d83fd08
Cleanup named arguments
2020-04-15 06:28:41 -07:00
Victor Zverovich
8a4630686e
Improve handling of named arguments
2020-04-14 11:56:55 -07:00
Dmitriy Kurkin
a9d62d3f35
Add check for CompiledFormat to avoid ambiguous call
2020-04-14 05:59:02 -07:00
Victor Zverovich
fdcf7870a2
Add stack-based named argument storage
2020-04-13 08:03:51 -07:00
Victor Zverovich
07b4c246ea
Fix a typo
2020-04-12 08:18:47 -07:00
Victor Zverovich
e99809f29d
Fix ostream support in sprintf ( #1631 )
2020-04-12 07:53:17 -07:00
Victor Zverovich
3aab2171ed
Clean up basic_format_args
2020-04-11 08:22:53 -07:00
Victor Zverovich
7645ca0724
Clean up printf
2020-04-11 08:01:00 -07:00
Victor Zverovich
e30d8391e4
Suppress an MSVC warning ( #1622 )
2020-04-11 07:49:00 -07:00
Victor Zverovich
8cd8ef03eb
Simplify warning suppression
2020-04-11 06:17:31 -07:00
Victor Zverovich
bbb6b357c7
Add floating-point L specifier ( #1624 )
2020-04-10 07:16:20 -07:00
Victor Zverovich
36ea32640f
Suppress a bogus MSVC warning
2020-04-10 06:44:07 -07:00
Victor Zverovich
141a00d642
Define FMT_EXTERN_TEMPLATE_API on export
2020-04-09 11:54:55 -07:00
Victor Zverovich
3860edc5d9
Bump version
2020-04-08 14:48:14 -07:00
Victor Zverovich
7d01859ef1
Fix handling of unsigned char strings in printf
2020-04-08 13:05:42 -07:00
Greg Sjaardema
34b3f7b7aa
Avoid windows issue with min() max() macros
...
Including the ``windows.h`` file without defining ``NOMINMAX`` will define the `min()` and `max()` macros which will result in issues compiling any C++ code that uses any variant of `max`, for example `std::numeric_limits<std::streamsize>::max()` and many others. Although max() isn't used in Fmt anywhere, it is often used in codes that include a format include file so simply upgrading to the current version of lib::fmt will break the windows build which worked prior to the update...
2020-04-07 08:34:34 -07:00
Victor Zverovich
346500e70b
Fix gcc version check
2020-04-04 11:23:40 -07:00
Victor Zverovich
51c58a56ba
Bump version
2020-04-03 08:32:45 -07:00
Victor Zverovich
d1d653d895
Implement the L specifier
2020-04-02 06:58:38 -07:00
Victor Zverovich
73c8437485
Follow naming conventions
2020-04-01 09:30:28 -07:00
Victor Zverovich
e588b02b17
Fix posix-mock-test
2020-04-01 08:42:14 -07:00
Victor Zverovich
1a62711d01
Reduce binary size
2020-03-31 08:07:11 -07:00
Victor Zverovich
5b02881582
Merge branch 'master' of github.com:fmtlib/fmt
2020-03-28 09:46:44 -07:00
Victor Zverovich
80ce222ca6
Fix wide print overload ( #1609 )
2020-03-28 09:44:18 -07:00
Scott Ramsby
770a94edef
Use FMT_THROW macro where applicable
2020-03-27 12:17:22 -07:00
Victor Zverovich
2864e8432a
Update readme and add compatibility option
2020-03-26 07:18:27 -07:00
Victor Zverovich
21a295c272
Undo comment change
2020-03-25 08:14:31 -07:00
Victor Zverovich
96c68afe69
Fix -Wsign-conversion warnings
2020-03-25 07:46:00 -07:00
Scott Ramsby
664dd88e31
Enable FMT_STRING() use with types other than string literals
2020-03-24 12:56:21 -07:00
Victor Zverovich
69779b4ed6
Fix handling of small precision in general format
2020-03-24 09:01:57 -07:00
Victor Zverovich
08ca40ea91
Detect /utf-8 in MSVC
2020-03-22 08:19:38 -07:00
Victor Zverovich
dd97f4920c
Improve exception safety in dynamic_format_arg_store
2020-03-21 08:58:50 -07:00
Victor Zverovich
2951169481
Move FMT_USE_FLOAT and friends to fmt/format.h
2020-03-20 07:55:43 -07:00
Alberto Aguirre
d3e668418f
Allow disabling floating point support ( #1590 )
...
* Allow disabling floating point support
Add FMT_USE_FLOAT, FMT_USE_DOUBLE and FMT_USE_LONG_DOUBLE to allow a
user of the library to configure the float types they want to allow.
This is specially useful in embedded environements where code size is
important.
* Avoid conditional macros to disable float support
* Add is_supported_floating_point constexpr function
* Fix empty-body warning
2020-03-20 06:46:31 -07:00
Victor Zverovich
3cf619de55
Simplify dynamic_format_arg_store
2020-03-17 07:13:46 -07:00
Spirrwell
2559983e7a
Color formatting fixed for wide strings (fixes issue #1594 ) ( #1596 )
...
* Use std::char_traits::length for ansi_color_escape::begin
-Fixes issue #1594 https://github.com/fmtlib/fmt/issues/1594
2020-03-17 06:24:42 -07:00
Victor Zverovich
026f99178e
Simplify dynamic store
2020-03-16 19:10:41 -07:00
Victor Zverovich
9f70fc3e7a
Minor tweaks for dynamic_format_arg_store
2020-03-16 07:58:15 -07:00
Vladimir Solontsov
6012dc9ab4
Dynamic arguments storage. Implementation of enhancement from issue #1170 . ( #1584 )
2020-03-16 07:00:29 -07:00
Nikolay Rapotkin
85050aa2e6
Ability to join elements of std::initializer_list was added
2020-03-15 16:10:00 -07:00
Victor Zverovich
ff486a72a7
Allow leading zeros in precision ( #1579 )
2020-03-14 11:37:38 -07:00
Victor Zverovich
678341275b
Deprecate fmt::char8_t
2020-03-14 10:32:34 -07:00
Victor Zverovich
61c5a51604
Fix handling of empty tuples ( #1588 )
2020-03-14 07:41:08 -07:00
Dair Grant
02bfd8a9a5
Add FMT_HAS_CPP14_ATTRIBUTE / FMT_HAS_CPP17_ATTRIBUTE to test for language-specific attributes.
...
FMT_DEPRECATED is now defined as FMT_HAS_CPP14_ATTRIBUTE(deprecated), as this attribute was introduced in C++14.
FMT_FALLTHROUGH is now defined as FMT_HAS_CPP17_ATTRIBUTE(fallthrough), as this attribute was introduced in C++17.
FMT_MAYBE_UNUSED is defined as FMT_HAS_CPP17_ATTRIBUTE(maybe_unused), as this attribute was introduced in C++17.
FMT_MAYBE_UNUSED has been applied to fix a couple of -Wunused-member-function warnings from clang.
2020-03-13 09:03:52 -07:00
Victor Zverovich
3c24052cf1
Workaround 'cannot call member function without object' error on gcc 4.9
2020-03-11 17:39:32 -07:00
Victor Zverovich
f72a905eb3
Fix handling of volatile enums
2020-03-11 08:40:57 -07:00
Victor Zverovich
941d5e147a
Workaround broken fallthrough attribute in the PGI compiler ( #1583 )
2020-03-11 07:56:23 -07:00
Victor Zverovich
ee2b828b9a
Tweak a comment
2020-03-09 11:27:14 -07:00
Pramod Kumbhar
5bb8856655
Workaround for broken [[deprecated]] in PGI compiler ( #1581 )
...
* Workaround broken [[deprecated]] in PGI compiler
- similar to Intel and NVCC, add workaround for PGI compiler
2020-03-09 11:25:38 -07:00
Victor Zverovich
db4a6cfbf9
is_static_compiled_format -> is_compiled_format
2020-03-06 07:25:34 -08:00
Dair Grant
29a1ea795a
Fix clang -Wdisabled-macro-expansion warning from FMT_STRING_IMPL.
...
FMT_STRING_IMPL has an internal helper named FMT_STRING, however FMT_STRING is also the name of the macro that invokes FMT_STRING_IMPL.
Renaming this helper avoids the appearance of a recursive macro.
2020-03-06 07:00:47 -08:00
Victor Zverovich
8a06ca84c7
Fix ambiguous overloads of format & format_to
2020-03-05 12:22:43 -08:00
Victor Zverovich
153f753bde
Deprecate undocumented _u suffix
2020-03-04 19:20:19 -08:00
Victor Zverovich
eafd079868
Improve width computation
2020-03-04 17:17:34 -08:00
Victor Zverovich
197a5c3721
Apply clang-format
2020-03-04 08:37:00 -08:00
refnum
68742e1d87
Fix clang -Wsign-conversion warning in grisu_count_digits. ( #1573 )
...
grisu_count_digits is only used by grisu_gen_digits, which assigns the unsigned result to a (signed) int.
Although grisu_count_digits always returns a positive integer this keeps its return type in sync with the type its result is assigned to.
2020-03-04 06:48:41 -08:00
Victor Zverovich
1e8493196e
Make compile-time checks in format_to handle references
2020-03-01 07:57:34 -08:00
refnum
58e6c84f5a
Fix simple -Wsign-conversion cases. ( #1571 )
...
* Fix -Wsign-conversion in bigint::subtract_aligned.
n is assigned a size_t, and only used for comparisons with j.
j is assigned 0, compared to n (size_t), and passed to basic_memory_buffer::operator[] (size_t).
* Fix -Wsign-conversion in bigint::assign.
num_bigits is initialised to 0, is only ever incremented, and is passed to basic_memory_buffer::operator[] (size_t) and basic_memory_buffer::resize (size_t).
2020-03-01 07:22:15 -08:00
refnum
75a4525e5f
Move FMT_CLANG_VERSION definition to core.h ( #1568 )
...
Previously format.h defined FMT_CLANG_VERSION after including core.h, however core.h tests FMT_CLANG_VERSION when it defines FMT_API.
2020-02-29 17:19:34 -08:00
refnum
6ccb2e241b
Add FMT_NORETURN to assert_fail prototype. ( #1569 )
...
When building with -Werror,-Wmissing-noreturn clang identifies that assert_fail could be declared with the 'noreturn' attribute.
2020-02-29 17:17:55 -08:00
Victor Zverovich
bed134a4aa
Tentative fix for default template param in friend error
2020-02-27 15:29:46 -08:00
Victor Zverovich
b2d3a86ec0
Make FMT_ASSERT work in constexpr on clang 4.0.1
2020-02-26 06:26:46 -08:00
fghzxm
2161a73f2b
Fix FMT_FORMAT_AS const specifier position ( #1554 )
...
The current `FMT_FORMAT_AS` macro will make `formatter<Char *>::format`
have the first argument type `const Char *&` which is incorrect an
should be `Char *const &`. This pull request fixes that by changing the
first argument type in the macro definition body from `const Type &` to
`Type const &`.
2020-02-23 07:27:22 -08:00
IkarusDeveloper
e00997b004
improved use of find ( #1560 )
...
* improved use of find
*begin is supposed to be different from '{' when this find is used, so we can avoid checking it.
2020-02-21 14:43:06 -08:00
dominicpoeschko
0415cf2350
add const begin and end overload to buffer ( #1553 )
...
* add const begin and end overload to buffer
since there is a const overload for data I think there should also be one for begin and end
2020-02-19 14:59:50 +01:00
Victor Zverovich
3bafd0749b
Fix to_string docs
2020-02-15 09:51:35 +01:00
Victor Zverovich
f733882b55
Remove misleading FMT_USE_WINDOWS_H
2020-02-14 14:09:27 +01:00
Victor Zverovich
dc22360c34
Workaround broken UDL templates in GCC < 6.4
2020-02-10 17:08:14 +01:00
Victor Zverovich
1f1b50707c
Make formatter override implicit conversion to a C string
2020-02-07 19:24:36 -08:00
Victor Zverovich
24924128e3
Fix a link error in gcc8 ( #1548 )
2020-02-07 18:34:05 -08:00
Victor Zverovich
b55ea58705
string_view::char_type -> value_type ( #1539 )
2020-02-01 12:27:44 -08:00
Milian Wolff
314e15001f
Fix symbol visibility on Linux when compiling with -fvisibility=hidden ( #1535 )
...
Make FMT_API symbols use the default visibility on non-Windows
platforms. Otherwise, one cannot use the generated fmt library when
compiling globally with -fvisibility=hidden.
Fixes compile errors like:
```
../3rdParty/fmt/include/fmt/core.h:757: error: undefined reference to 'fmt::v6::internal::assert_fail(char const*, int, char const*)'
```
Note that the symbol exists, but is local:
```
$ nm -C libfmtd.so.6.1.3 | grep assert_fail
U __assert_fail
0000000000233ffa t fmt::v6::internal::assert_fail(char const*, int, char const*)
```
With this patch, the compile error is gone and the symbol is properly
exported:
```
$ nm -a bin/libfmtd.so -C | grep assert_fail
U __assert_fail
00000000002366ba T fmt::v6::internal::assert_fail(char const*, int, char const*)
```
Change-Id: I96054e622d9a2ae81907e1b01a1033e629767a91
2020-01-30 06:26:18 -08:00
Victor Zverovich
f499b393d1
Apply coding conventions
2020-01-26 19:48:48 -08:00
zeffy
1acb73f970
Fix formatting std::chrono::duration types to wide strings ( #1533 )
...
* Fix formatting chrono durations to wide strings
* Make format buffers const correct
* Add FormatWide chrono test case
* Fix incorrect wide encoding of 'µs'
I think might be a source file encoding issue, so I used \u00B5 instead.
* Update FormatWide test to use proper encoding of µs
* Revert changes to format_localized's parameters
* Use different overload of `std::time_put<T>::put` to avoid needing a format string
* Use utf8_to_utf16 instead of having redundant overloads of get_units
* Revert some minor changes
* Remove FMT_CONSTEXPR from expression
This should hopefully fix compilation on VS <2019
* Make suggested changes from code review
* Run clang-format on chrono.h
* Make sure unit isn't null before constructing a string_view from it
2020-01-23 18:48:36 -08:00
Victor Zverovich
09a13244c8
Disallow passing non-string-literals to FMT_STRING
2020-01-22 21:05:46 -08:00
Victor Zverovich
419db8baa1
Fix length computation of constexpr C strings
2020-01-22 18:25:07 -08:00
dspc-douglas
9fc4161f5e
fix interal compiler error when building with mingw
2020-01-22 18:14:46 -08:00
Greg Sjaardema
25d6916b3a
Fix so can work without locale defined
...
If `FMT_STATIC_THOUSANDS_SEPARATOR` defined, then locale is not included or defined, so this call will be unresolved. I think this is the correct fix based on the code in `format-inl.h` and `format.h`
2020-01-22 07:26:03 -08:00
Victor Zverovich
fd1cabe464
Workaround a bogus MSVC warning
2020-01-20 06:56:22 -08:00
Victor Zverovich
b4218aa0f8
Test invalid fill
2020-01-19 16:52:36 -08:00
Victor Zverovich
8a3a8177d6
Bump version
2020-01-19 15:34:30 -08:00
Victor Zverovich
e5f2f8ce7a
Add variable-width fill support ( #1109 )
2020-01-19 14:49:51 -08:00
Victor Zverovich
75765bfad5
Avoid unnecessary unsigned overflows ( #1515 )
2020-01-18 08:19:27 -08:00
Victor Zverovich
9bd9738da0
Remove static and simplify names
2020-01-18 07:43:59 -08:00
Victor Zverovich
1f110702a1
Remove redundant braces
2020-01-15 15:07:30 -08:00
Jason Turner
4ccbe4b5f2
Avoid namespace clash for fmt
...
## Problem
In the case of an existing `fmt` namespace (in my project this looks like `Project::fmt`) it is possible to get a namespace clash in debug builds (MSVC 2017)
## Proposed Solution
When referencing `fmt` internally, be explicit that it is relative to the global namespace using `::fmt`
2020-01-15 11:23:24 -08:00
Greg Sjaardema
40638a75b3
Use C++11 compatible std::is_same operations
...
The `operator()` member function of `std::is_same` was added in C++14. For C++11, the `::value` needs to be used instead.
2020-01-15 11:20:47 -08:00
Victor Zverovich
c8dd9cc99d
Use type_identity to block unnecessary template argument deduction (thanks Tim Song)
2020-01-15 10:27:50 -08:00
Greg Sjaardema
4bbe57cebf
Work-around for nvcc
...
The nvcc compiler (at least up to 9.2) defines `__SIZEOF_INT128__`, but doesn't support 128-bit integers on device code:
```
error: "fmt::v6::format_arg_store<fmt::v6::basic_format_context<std::back_insert_iterator<fmt::v6::internal::buffer<char>>, char>, const char *, int, const char *>" contains a 128-bit integer, which is not supported in device code
```
2020-01-15 07:31:58 -08:00
Greg Sjaardema
55b6130055
Use C++11-compatible operations
...
The `std::is_base_of<T,U>()` and `std::is_reference<T>()` member functions were added in C++14. To maintain C++11 compatibility, use the `::value` instead.
Current code fails on intel-17 and other compilers if using strict C++11
2020-01-15 07:23:39 -08:00
Greg Sjaardema
ae3ea156ea
Fix for older versions of intel compiler
...
The intel-17 and intel-18 compilers seem to require that `u` be `const`:
```
/src/fmt/format.h(226): warning #437 : reference to local variable of enclosing function is not allowed
char data[sizeof(u)];
```
If `u` is declared as `const auto u =1u` instead of just `auto u=1u`, the file compiles with no warnings.
2020-01-14 17:56:06 -08:00
Tobias Hammer
77165fdf85
Use FMT_NOEXCEPT instead of noexcept directly
...
Otherwise breaks on compilers without noexcept support
2020-01-14 09:31:31 -08:00
Victor Zverovich
65ac626c58
Improve join docs
2020-01-12 07:26:16 -08:00
torsten
cd0b3f9695
check if _SECURE_SCL is defined not equal to 0
2020-01-09 15:01:48 -08:00
Victor Zverovich
cef1e4354b
Optimize grisu_gen_digits
2020-01-07 16:11:18 -10:00
Victor Zverovich
0201c8db21
Restructure float_format
2020-01-07 14:41:30 -10:00
Victor Zverovich
9e3f3e8cff
Fix handling of output iterators in format_to_n ( #1506 )
2020-01-05 09:59:01 -10:00
Victor Zverovich
aa07c57654
Move vprint_mojibake to the internal namespace
2020-01-04 08:31:18 -10:00
Victor Zverovich
a73d89e9c7
Catch invalid uses of fmt::arg
2020-01-04 07:11:35 -10:00
Victor Zverovich
b3fd0005dd
Suppress a bogus -Wdouble-promotion warning
2020-01-03 06:57:14 -10:00
Victor Zverovich
7b478f9dec
Simplify example
2020-01-02 07:31:45 -10:00
Victor Zverovich
c85efef312
More showpoint fixes and tests ( #1498 )
2019-12-30 13:08:35 -10:00
Victor Zverovich
455a7c0787
Clarify lifetime of basic_format_args
2019-12-30 08:51:47 -10:00
Ivan Shynkarenka
d2d1c9c560
warning C4267: 'argument': conversion from 'size_t' to 'DWORD', possible loss of data
2019-12-26 08:07:24 -08:00
Victor Zverovich
b6e19e5953
Update apidoc
2019-12-24 12:08:37 -08:00
Victor Zverovich
f219dcd59b
Add fmt::bytes
2019-12-24 10:45:15 -08:00
Victor Zverovich
dea7fde8b7
Deprecate u8string_view
2019-12-24 09:44:57 -08:00
Victor Zverovich
5390e29d42
Enable mojibake
2019-12-24 08:42:29 -08:00
Victor Zverovich
9f6434dcde
Improve UTF-8 handling on Windows
2019-12-23 16:19:11 -08:00
Victor Zverovich
dac9a7f99d
Improve UTF-8 handling on Windows
2019-12-22 12:05:28 -08:00
Victor Zverovich
3ca9533f38
Flatten forward
2019-12-22 08:23:54 -08:00
Victor Zverovich
7eec036d9a
Improve UTF-8 support
2019-12-21 19:53:52 -08:00
Victor Zverovich
e6b37b4aff
Handle block boundaries in utf8_to_utf16
2019-12-21 16:33:34 -08:00
Victor Zverovich
8cf4c52068
Apply clang-format
2019-12-21 13:10:45 -08:00
Victor Zverovich
74532c23a3
Make type a scoped enum
2019-12-21 12:22:17 -08:00
Victor Zverovich
b308159be5
Make round_direction a scoped enum
2019-12-21 09:24:42 -08:00
Victor Zverovich
8b41362a0a
Add trailing decimal point if # is specified ( #1476 )
2019-12-18 12:41:56 -08:00
Victor Zverovich
1b1c70108a
trailing_zeros -> showpoint
2019-12-18 12:12:09 -08:00
Victor Zverovich
d7e72a09e0
Simplify FMT_STRING_IMPL
2019-12-18 11:50:47 -08:00
Victor Zverovich
2201890d7a
Apply clang-format and update inclusion guards
2019-12-18 11:17:36 -08:00
Greg Sjaardema
6100ed4bb3
Eliminate NVCC NVidia compiler emits unreachable code warnings
...
Similar to the MSC Compiler, the NVidia NVCC compiler also
emits unreachable code warnings when there is a return
statement following an exception. These changes eliminate
those warnings.
2019-12-18 10:39:40 -08:00
Victor Zverovich
1afe201ae8
Handle block boundaries in utf8_to_utf16
2019-12-18 10:35:51 -08:00
parkertomatoes
9acf89fef6
Mitigate MSVC issue with min/max macros ( #1480 )
2019-12-16 08:24:00 -08:00
Victor Zverovich
9ea42fb26e
Rename posix-test to os-test
2019-12-15 16:43:40 -08:00
Victor Zverovich
da2569827e
posix.cc -> os.cc
2019-12-15 12:36:15 -08:00
Victor Zverovich
35959a31d7
Move OS-specific APIs to a separate header
2019-12-15 11:46:45 -08:00
Victor Zverovich
ec2463c905
Implement utf8_to_utf16 using utf8_decode
2019-12-15 09:35:26 -08:00
Victor Zverovich
0012917f69
Add a UTF-8 decoder
2019-12-15 07:28:19 -08:00
Victor Zverovich
9e450911fa
Give an error on precision overflow
2019-12-14 07:45:27 -08:00
Victor Zverovich
068d20bc31
Avoid shadowing warnings in FMT_STRING
2019-12-14 07:00:08 -08:00
iPherian
8ab1c5c6e8
Squelch MSVC warning exporting subclasses of runtime_error (fix for PR #1433 ) ( #1470 )
...
* Squelch MSVC warning exporting subclasses of runtime_error
When compiling {fmt} as a DLL, MSVC complains that we are exporting
classes that inherit from "std::runtime_error", which we are not
exporting.
In this case, it's not really a problem because that symbol is already
exported via the C++ stdlib. So we just add a pragma to silence the
warning.
* Fix compilation with MinGW
Commit 3bc28fcc6b
("Squelch MSVC warning exporting subclasses of
runtime_error", 2019-11-29) silenced a MSVC warning under. The MinGW
compiler also defines _WIN32, but does not support the "warning" pragma.
Introduce a helper macro to squelch the MSVC warning only when using the
Microsoft compiler.
Signed-off-by: Beat Bolli <dev@drbeat.li>
* Fix compilation with VS2015 (#1450 )
VS2015 does not support the __pragma(...) syntax in the midst of a
class declaration, so move it to just before the declaration.
2019-12-13 12:16:36 -08:00
Victor Zverovich
a770009fcc
Improve error reporting
2019-12-13 11:34:03 -08:00
Ivan Shynkarenka
598e6042d1
warning C4468: 'fallthrough': attribute must be followed by a case label or a default label
2019-12-12 06:25:33 -08:00
Federico
b272fb3605
Extend FMT_FALLTHROUGH compatibily to gcc and clang pre-C++17 ( #1469 )
2019-12-11 14:28:20 -08:00
Victor Zverovich
b7eb8c8921
Prepare for the next release
2019-12-10 21:50:14 -08:00
Victor Zverovich
9f2e7edaeb
Fix handling of types convertible to std::string_view
2019-12-09 13:25:08 -08:00
Victor Zverovich
f675cb887e
Remove redundant cast
2019-12-08 18:01:59 -08:00
Florin Iucha
72879db40e
Clean-up sign-conversion warnings in public headers
2019-12-08 16:07:55 -08:00
Deniz Evrenci
1ab80aa92c
Fix handling of types with custom formatters that are convertible to std::string_view
2019-12-06 11:40:21 -08:00
Victor Zverovich
f443bd3baf
Ditch decimal_formatter ( #1363 )
2019-12-05 19:07:45 -08:00
Victor Zverovich
1219b65f21
Relax fallthrough attribute detection
2019-12-05 10:40:15 -08:00
Victor Zverovich
02af5beb8a
Bump version and update changelog
2019-12-04 10:22:07 -08:00
Victor Zverovich
123e7f7fc3
Revert #1433 because of build failures ( #1450 )
2019-12-03 09:24:15 -08:00
Victor Zverovich
168460f02c
Remove TYPES
2019-12-03 06:45:00 -08:00
Egor Pugin
a64f60c849
Remove unneeded FMT_API.
2019-12-03 05:55:04 -08:00
Egor Pugin
1a599117d8
Export assert_fail with FMT_API. This fixes dll build.
2019-12-03 05:55:04 -08:00
Beat Bolli
5981588565
Fix compilation with MinGW
...
Commit 3bc28fcc6b
("Squelch MSVC warning exporting subclasses of
runtime_error", 2019-11-29) silenced a MSVC warning under. The MinGW
compiler also defines _WIN32, but does not support the "warning" pragma.
Introduce a helper macro to squelch the MSVC warning only when using the
Microsoft compiler.
Signed-off-by: Beat Bolli <dev@drbeat.li>
2019-12-02 12:56:46 -08:00
Victor Zverovich
8bbe76af3a
Add a missing decimal point in exponent notation with trailing zeros
2019-12-02 11:36:33 -08:00
Victor Zverovich
7111a1eb9f
Bump version
2019-12-01 16:50:07 -08:00
Victor Zverovich
1cbae6e9ba
Put vprint declarations in one place
2019-12-01 14:43:51 -08:00
Victor Zverovich
4b120b68ae
Clean up includes
2019-12-01 10:19:07 -08:00
Victor Zverovich
62da1db62a
Avoid wchar_t instantiations
2019-12-01 07:34:09 -08:00
Chris Martin
3bc28fcc6b
Squelch MSVC warning exporting subclasses of runtime_error
...
When compiling {fmt} as a DLL, MSVC complains that we are exporting
classes that inherit from "std::runtime_error", which we are not
exporting.
In this case, it's not really a problem because that symbol is already
exported via the C++ stdlib. So we just add a pragma to silence the
warning.
2019-11-30 12:00:25 -08:00
Victor Zverovich
ba6e330fd3
digits -> num_bits
2019-11-30 08:41:07 -08:00
Victor Zverovich
6037b3cae9
Fix dangling else problem in FMT_ASSERT
2019-11-30 07:52:33 -08:00
Victor Zverovich
fafb03fa6d
Fix handling of fallback_uintptr
2019-11-30 07:31:38 -08:00
Victor Zverovich
2f9acd1838
Remove dependency on <cassert>
2019-11-29 09:37:18 -08:00
Victor Zverovich
aaf829bfb1
Fix fallback pointer formatting on big endian, take 2
2019-11-29 07:07:08 -08:00
Victor Zverovich
b994a0ab13
Fix handling of missing fraction in snprintf_float
2019-11-29 06:17:29 -08:00
Victor Zverovich
bb205d940d
Fix fallback pointer formatting on big endian
2019-11-29 05:15:59 -08:00
Florin Iucha
ea54b21e78
Remove invalid noexcept annotation
...
buffered_file& operator=(buffered_file&& other) calls close which can
throw.
2019-11-28 06:43:08 -08:00
Florin Iucha
9cbf4b087c
Fix -Wconversion warnings
2019-11-28 06:43:08 -08:00
Victor Zverovich
c3be0f593d
Refactor floating-point formatting
2019-11-27 08:08:22 -08:00
Victor Zverovich
c68703c9f4
float_spec -> float_specs
2019-11-26 15:53:24 -08:00
Victor Zverovich
9a21728b0a
Remove gen_digits_params
2019-11-26 11:27:53 -08:00
Victor Zverovich
7ffa62db18
Fix precision handling in snprintf_float
2019-11-25 20:00:10 -08:00
Victor Zverovich
0d07db1234
Fix handling of streamable and convertible to string types
2019-11-25 16:46:33 -08:00
Victor Zverovich
d19ed6716d
Fix hexfloat buffer reallocation
2019-11-25 15:54:04 -08:00
Victor Zverovich
99b6e928d4
Fix handling of types with deleted rvalue conversion to string ( #1421 )
2019-11-25 08:30:47 -08:00
Victor Zverovich
57cd3f72e9
Update comment
2019-11-24 15:34:33 -08:00
Victor Zverovich
111fc127fe
Remove fp::operator-
2019-11-24 13:28:15 -08:00
Victor Zverovich
6003ec3f25
Simplify Grisu implementation
2019-11-24 13:24:28 -08:00
Victor Zverovich
75fff1db64
Minor cleanup
2019-11-24 08:43:56 -08:00
Victor Zverovich
28d7191c27
Don't print trailing zero with fixed, precision=0, and showpoint ( #1417 )
2019-11-24 08:23:10 -08:00
Victor Zverovich
43271ba8e8
Handle null terminator at the end of the buffer
2019-11-24 07:15:25 -08:00
Victor Zverovich
4cf59ce734
Integrate Grisu and sprintf digit generators
2019-11-23 06:56:29 -08:00
Victor Zverovich
7395472dde
Refactor floating-point formatting
2019-11-22 18:49:19 -08:00
Victor Zverovich
ded1e7679e
Refactor floating point formatting
2019-11-22 08:22:22 -08:00
Victor Zverovich
c7edd8e570
Cleanup FP formatting
2019-11-20 13:17:03 -08:00
Victor Zverovich
75108a56f6
Don't print % for nan and inf
2019-11-20 12:26:48 -08:00
Victor Zverovich
3e1f70fe02
Merge write_fp into write
2019-11-20 12:20:17 -08:00
Victor Zverovich
125fc5e520
Update comment
2019-11-20 11:45:25 -08:00
Victor Zverovich
4de41aa655
Move basic_writer::write_fp to where it belongs
2019-11-20 08:22:34 -08:00
Victor Zverovich
404a880bd4
Make parse_arg_id more readable
2019-11-20 08:12:23 -08:00
Victor Zverovich
092d2dc7b2
Merge safe-duration-cast.h into chrono.h
2019-11-20 08:05:18 -08:00
Victor Zverovich
093e554211
Remove redundant qualification
2019-11-20 07:44:34 -08:00
Ivan Shynkarenka
d0696b0aa6
warning C4456: declaration of 'num_digits' hides previous local declaration
2019-11-20 06:43:46 -08:00
Victor Zverovich
66d7746bb3
Use grisu for exponent notation
2019-11-19 16:55:11 -08:00
Victor Zverovich
e9bff78814
Don't parse % unless FMT_DEPRECATED_PERCENT is set
2019-11-19 11:54:18 -08:00
Victor Zverovich
57b6f2966d
Deprecate the fmt macro
2019-11-19 11:28:17 -08:00
Victor Zverovich
d79493e5ee
Remove Grisu2
2019-11-19 09:50:59 -08:00
Victor Zverovich
5420bcce2d
Make % an opt-in to improve compatibility with std::format
2019-11-18 08:04:43 -08:00
Victor Zverovich
56a2e2075c
Refactor float spec parsing
2019-11-18 07:37:36 -08:00
Victor Zverovich
ed117baa4f
Replace bool with float_format and add exponential
2019-11-17 15:52:13 -08:00
Victor Zverovich
f26446290b
Move float_spec_handler to internal namespace and update asserts
2019-11-17 13:47:00 -08:00
Victor Zverovich
f67783d7e6
Clarify that numeric alignment is deprecated
2019-11-17 10:24:55 -08:00
Victor Zverovich
c01ec54fde
Document and clean basic_format_parse_context
2019-11-17 09:28:26 -08:00
Victor Zverovich
b0c2ab93fa
Bump version
2019-11-17 08:35:26 -08:00
Victor Zverovich
9b7fe2a4a1
Don't use POSIX API on UWP
2019-11-17 08:29:08 -08:00
Daniel Laügt
c58b7d9c2f
Use overridden locale in ostream
2019-11-17 06:22:22 -08:00
Victor Zverovich
dcde089b4e
Improve POSIX API detection
2019-11-15 07:28:02 -08:00
David P. Sicilia
2145a7bdcc
Move has_formatter into the public fmt namespace. ( #1407 )
...
* Move has_formatter into the public fmt namespace.
This will allow users to do SFINAE-friendly checks for
the formattability of a type.
Fixes #1369
2019-11-14 07:08:24 -08:00
Victor Zverovich
0d6dd0cc6a
Correct basic_string_view from string ctor
2019-11-14 05:57:23 -08:00
Rosen Penev
1f918159ed
[clang-tidy] Replace deprecated C headers
...
Found with modernize-deprecated-headers
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-08 09:35:26 +00:00
Rosen Penev
6868f888b2
[clang-tidy] Add missing override
...
Found with hicpp-use-override
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-08 09:35:26 +00:00
Rosen Penev
87cd545a1e
[clang-tidy] Replace {} with = default
...
Found with hicpp-use-equals-default
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-08 09:35:26 +00:00
Rosen Penev
12f9437e22
[clang-tidy] Use auto
...
Found with hicpp-use-auto
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-08 09:35:26 +00:00
Rosen Penev
bb0c8bfea8
[clang-tidy] Add noexcept where move is used
...
Found with performance-noexcept-move-constructor
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-08 09:35:26 +00:00
Rosen Penev
e6e8298904
[clang-tidy] Add parentheses to macro arguments
...
Found with bugprone-macro-parentheses
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-08 09:35:26 +00:00
Rosen Penev
0f0848e4f4
[clang-tidy] Use braced init list
...
Found with modernize-return-braced-init-list
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-08 09:35:26 +00:00
Rosen Penev
a1fb5c7337
[clang-tidy] Changes suffixes to uppercase
...
Found with hicpp-uppercase-literal-suffix
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-08 09:35:26 +00:00
Rosen Penev
8a411c2bca
[clang-tidy] Turn deleted function to public
...
Found with modernize-use-equals-delete
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-08 09:35:26 +00:00
Victor Zverovich
0047dc10a2
Mark apidoc as rst
2019-11-06 15:16:02 +00:00
daniel
f1559e1d56
Use grouping() from locale for specifier 'n'
2019-11-05 07:22:12 +00:00
Victor Zverovich
ffd05e65ed
basic_parse_context -> basic_format_parse_context per standard and document
2019-11-05 07:13:58 +00:00
Attila Tajti
0889856d61
Fix UTF-8 truncation
2019-11-03 11:53:15 +00:00
Victor Zverovich
d6eede9e08
Remove redundant ctor
2019-11-01 12:09:04 -07:00
Victor Zverovich
213e09644f
Workaround X11 madness ( #1388 )
2019-11-01 08:47:11 -07:00
Victor Zverovich
6bfc9af8c9
Add double support to compile
2019-10-30 20:45:29 -07:00
Victor Zverovich
3487f1b9cd
Always inline grisu_gen_digits and disable grisu2 by default
2019-10-30 16:52:00 -07:00
Victor Zverovich
791294d17b
Apply get_cached_power optimization by jk-jeon
2019-10-30 08:07:01 -07:00
Victor Zverovich
8e700619b7
Simplify format_handler
2019-10-30 07:02:38 -07:00
Victor Zverovich
58c6f8c7f5
Make unsigned-integer-overflow sanitizer happy ( #1377 )
2019-10-28 14:41:09 -07:00
Victor Zverovich
40414b3446
Don't emit trailing zeros in exponential notation ( #1376 )
2019-10-28 12:31:00 -07:00
Victor Zverovich
b7a157401e
Simplify grisu_writer
2019-10-23 13:52:09 -07:00
Victor Zverovich
7aa58c30bf
Simplify NVCC checks
2019-10-23 11:32:35 -07:00
Victor Zverovich
8e9bffa986
clang-format
2019-10-23 11:20:21 -07:00
Victor Zverovich
ce4d87acd4
Remove obsolete comment and clang-format
2019-10-23 11:15:43 -07:00
Ivan Shynkarenka
21acc2af43
Fix more Visual Studio 2019 pedantic warnings ( #1371 )
...
* format-inl.h(444,1): warning C4804: '>>': unsafe use of type 'bool' in operation
format.h(2808,1): warning C4127: conditional expression is constant
* More fixes for VS2019 pedantic warnings
* Fix "conditional expression is constant" VS2019 warning in more specific way
* Use const_check to silence constexpr warning
2019-10-22 17:13:03 -07:00
kent-tri
00669427df
Patch compiler error when building using nvcc
...
If you compile using `nvcc` and pass the option `--expt-relaxed-constexpr` it will crash with an internal compiler error. This modification prevents using `constexpr` in `fmtlib` when compiling using `nvcc` and prevents the crash.
2019-10-22 08:34:52 -07:00
Victor Zverovich
d39ebf3ff2
Optimize counting
2019-10-21 06:57:42 -07:00
Victor Zverovich
6498bc6d31
Simplify grisu_writer
2019-10-20 19:29:24 -07:00
Victor Zverovich
a967dcbe20
Improve handling of signs
2019-10-20 19:05:38 -07:00
Victor Zverovich
8498bc97dd
Initialize all the things
2019-10-20 17:53:18 -07:00
Victor Zverovich
e2ea940673
Handle assymetric boundaries
2019-10-20 07:55:05 -07:00
Victor Zverovich
2bc5585ff0
Fix computing lower boundaries for smallest normalized double
2019-10-18 17:56:52 -07:00
Victor Zverovich
bb728a572a
packed_arg_bitsize -> packed_arg_bits and remove packed_arg_mask
2019-10-18 10:06:57 -07:00
Victor Zverovich
36d1390e67
Implement round half to even
2019-10-18 07:21:12 -07:00
Orivej Desh
599e0aef45
Support single precision floats in grisu formatting
...
Fixes #1336
2019-10-18 07:08:41 -07:00
Ivan Shynkarenka
91f7619cc9
Fix Visual Studio 2019 pedantic warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
2019-10-14 08:55:18 -07:00
Victor Zverovich
c4dc6bef24
Apply clang-format
2019-10-13 18:31:09 -07:00
Victor Zverovich
646966e973
Reduce bigint capacity
2019-10-13 14:06:38 -07:00
Victor Zverovich
a5abe5d95c
Handle negative exponent and nonnegative power
2019-10-13 13:16:09 -07:00
Victor Zverovich
1cbc5fa6cb
Handle negative exponent and rename value/pow10 to numerator/denominator
2019-10-13 12:50:48 -07:00
Victor Zverovich
f7a5748fd3
Partially implement (FPP)^2
2019-10-13 09:28:35 -07:00
Victor Zverovich
0e94b931a2
Fix a linkage error introduced by #1360 ( #1362 )
2019-10-13 08:23:47 -07:00
Victor Zverovich
5e58eb97b1
Implement add_compare
2019-10-13 08:05:06 -07:00
Orivej Desh
3a15ea3ea5
Rename write_double to write_fp
...
It handles all floating point types, not just doubles.
2019-10-12 11:41:24 -07:00
Orivej Desh
b87ac4d840
Distinguish float from double
2019-10-12 11:41:24 -07:00
Orivej Desh
a927dda9bb
Use words for packed constants
2019-10-12 11:41:24 -07:00
Orivej Desh
dd11d45847
Encode types using 5 bits
...
This is needed to support more than the current 16 types.
2019-10-12 11:41:24 -07:00
Victor Zverovich
b55551f900
Implement more comparison operators
2019-10-12 09:22:24 -07:00
Deniz Evrenci
96f91428c6
Add defaulted copy and move operations to format_error and system_error ( #1347 )
...
* Avoid weak vtables by providing a private virtual member function
* Add warning Wweak-vtables to clang when FMT_PEDANTIC is on
* Add defaulted copy and move operations to format_error and system_error
Compiler generated copy operations are deprecated and move operations
are not generated altogether.
* Add warning Wdeprecated to clang when FMT_PEDANTIC is on
2019-10-11 10:44:20 -07:00
Orivej Desh
b732f28c00
Deduplicate color vformat and vprint
...
After #1351 they became essentially the same.
2019-10-11 10:42:11 -07:00
Tanki Zhang
a82c1dc6d9
use memory_buffer to make color print behave atomic #1348 ( #1351 )
2019-10-10 08:28:56 -07:00
Victor Zverovich
2730e90186
Fix compile error in printf with gcc9 ( #1354 )
2019-10-09 18:58:40 -07:00
Victor Zverovich
e4d6d9d7c8
Implement divmod
2019-10-09 13:40:50 -07:00
Orivej Desh
b66bb6b71f
Fix undefined in core-test and printf-test ( #1345 )
...
* Fix undefined in core-test
Fixes "reference binding to null pointer" in BufferTest.Ctor
buffer.operator[] attempts to return a reference to `buffer.ptr_[0]` when `ptr_`
in `mock_buffer<int> buffer` is null.
* Fix undefined in printf-test
Fixes "signed integer overflow" in PrintfTest.Length
This occurs in `TestLength<long long>("ll")`, since its minimum value minus one
does not fit in long long.
* Fix undefined in printf %0$
Printf counts arguments from 1.
Fixes "shift exponent -4 is negative" in PrintfTest.InvalidArgIndex.
`do_get` is called with index -1 when `basic_printf_context.arg` is called with
id 4294967295 when basic_printf_context::get_arg subtracts 1 from arg_index 0 in
the format string "%0$d".
2019-10-08 06:28:39 -07:00
Victor Zverovich
b60114533f
Implement more bigint operations
2019-10-06 12:49:23 -07:00
Victor Zverovich
c41cea8b18
Initial implementation of square
2019-10-05 16:37:52 -07:00
Victor Zverovich
0c7650373c
Fix handling of types convertible to std::string_view
2019-10-05 06:58:37 -07:00
Victor Zverovich
0fc7bd1573
Fix ambiguity for types with dodgy conversions
2019-09-28 11:35:20 -07:00
Jeremy Ong
b4f1988c4b
Provide overload for fmt::join
that handles std::tuple
s
...
Address enhancement request #1322 .
The overload is provided in `ranges` (original `fmt::join` exists
currently in `format.h` for historical reasons.
Tests for prvalue and lvalue tuple arguments as well as the empty
tuple are provided in `ranges-test.cc`.
2019-09-27 14:05:35 -07:00
mwinterb
ac59d9f3a4
workaround VS2019 Update 3 compiler bug. ( #1328 )
2019-09-24 11:29:29 -07:00
Daumantas Kavolis
89b0c71fa9
fix name clash in header-only mode
2019-09-24 06:25:21 -07:00
Daumantas Kavolis
f6a783ad2e
fix get
2019-09-24 06:25:21 -07:00
Victor Zverovich
ccc8f5db02
Disable integral operator<< ( #1316 )
2019-09-23 20:34:08 -07:00
Victor Zverovich
f29901097f
Don't use const char* overload of operator<< ( #1309 )
2019-09-23 12:35:08 -07:00
Victor Zverovich
758446c80d
Fix a warning ( #1319 ) and simplify code
2019-09-19 16:00:40 -07:00
Victor Zverovich
c6d1a94a9f
Fix fallback_format ( #1306 )
2019-09-09 17:28:53 -07:00
Victor Zverovich
0656045d02
Fix format overload that takes text_style ( #1305 )
2019-09-08 18:41:02 -07:00
Victor Zverovich
c85ae23c73
Add max_value
2019-09-08 09:21:30 -07:00
Victor Zverovich
b3bf665764
Implement multiplication and part of assignment from pow of 10
2019-09-08 08:27:00 -07:00
Victor Zverovich
0887887e23
Implement left shift
2019-09-07 18:10:36 -07:00
Victor Zverovich
ac71d853be
Refactor normalize and clean up
2019-09-07 17:28:59 -07:00
Victor Zverovich
6649b8e0ca
value -> bigit
2019-09-07 14:23:19 -07:00
Victor Zverovich
56b5c192a0
Add a bigint stub and reenable grisu
2019-09-07 13:50:22 -07:00
Victor Zverovich
b2f0b6e44e
Tweak comment
2019-09-07 08:43:35 -07:00
Victor Zverovich
3d9f3c163b
Integrate new format string compilation
2019-09-07 07:01:51 -07:00
gabime
df4dcf2ece
Fixed vs 2015 warning about unused variable when grisu is off
2019-09-06 11:29:56 -07:00
Victor Zverovich
f7a4b4ab91
Make numeric alignment optional
2019-09-06 09:43:53 -07:00
Victor Zverovich
611cf0b3c6
Format octal 0 as 0
2019-09-06 07:03:47 -07:00
Victor Zverovich
1882b9687b
Reduce the numer of ifdefs with an empty (u)int128_t fallback
2019-09-05 18:03:47 -07:00
Deniz Evrenci
6de0454b42
Add support for built-in __int128 when available
2019-09-04 07:05:08 -07:00
Deniz Evrenci
16e3c48bb0
Move definition of FMT_USE_INT128 to core.h
2019-09-04 07:05:08 -07:00
Deniz Evrenci
8ce5f680f2
Rename internal::is_integral and internal::is_arithmetic
...
To reserve space for the type traits sharing the same name as the ones
from standard library.
2019-09-04 07:05:08 -07:00
Victor Zverovich
2fd8f9ec8a
Initial implementation of optimal compile-time formatter generation
2019-09-02 19:50:30 -07:00
Victor Zverovich
a128b5b2cb
Simplify format string compilation
2019-09-02 06:48:19 -07:00
Victor Zverovich
466128de00
Remove unused code and refactor
2019-09-01 13:08:53 -07:00
Victor Zverovich
22e98a5b6a
Make compile work with user-defined types
2019-09-01 11:49:27 -07:00
Victor Zverovich
f18a3f36a7
Remove string_view_metadata
...
string_view_metadata was introduced to make compiled format relocatable.
However, format string compilation is an optimization and therefore
adding overhead and extra complexity for relocation is undesirable.
In most cases the string will be either static or outlive compilation
and formatting and if it doesn't, it's possible to make compiled
representation relocatale by other means.
2019-09-01 11:10:49 -07:00
Victor Zverovich
7cad33563c
Refactor format string compilation
2019-09-01 10:28:41 -07:00
Victor Zverovich
e1ab6bc006
Simplify format string compilation
2019-09-01 08:31:32 -07:00
Victor Zverovich
422e7b9d70
Fix compile-time checks for user-defined types ( #1292 )
2019-08-31 08:35:38 -07:00
Victor Zverovich
9a56a608ee
Fix warnings ( #1288 )
2019-08-31 08:16:47 -07:00
Victor Zverovich
c76957565c
FixedEnum -> StrongEnum and make it a regression test
2019-08-31 08:16:47 -07:00
Rosen Penev
200ee6f108
Fix minor clang-tidy warnings
...
using instead of typedef.
climits instead of limits.h
Added missing cast to size_t.
2019-08-31 07:02:21 -07:00
Egor Seredin
bcd9b9331a
Map not int enum to correct underlying_type ( #1286 )
...
* Map not int enum to correct underlying_type
* Use non-zero constant in TestFixedEnum
2019-08-31 06:25:38 -07:00
luncliff
345ba07f1d
Add a CUDA test
...
test cuda: import fmt in CUDA source code
Current test is only for Windows(cl.exe).
Need to test more with the other host compilers...
* Activate the test when `find_package(CUDA)` worked
* The test runs with C++14
Detailed comments in 'test/cuda-test'
test cuda: add more comment / macro check
* checks both `__NVCC__` and `__CUDACC__`
More comments for CMake and CUDA source file.
test cuda: <fmt/core.h> checks NVCC and CUDA
The header file checks 2 things.
* __NVCC__: if the compiler is from NVIDIA
* __CUDACC__: if the source code is CUDA(.cu) file
Since we can't sure all users prefer latest, Version for
`find_pacakge(CUDA)` is downgraded to 9.0.
This is the minimum version for C++14 in CUDA
2019-08-30 17:45:50 -07:00
hhb
9e2490be4c
Rename precision parameter
...
To avoid clang warning:
fmtlib/include/fmt/chrono.h:753:32: error: declaration shadows a field of 'formatter<duration<type-parameter-0-0, type-parameter-0-1>, type-parameter-0-2, void>' [-Werror,-Wshadow]
2019-08-28 07:29:04 -07:00
Victor Zverovich
3f75e2b69e
Make buffer_range public and update custom formatting docs ( #1281 )
2019-08-28 06:50:20 -07:00
Victor Zverovich
744302add0
Workaround broken [[deprecated]] in Intel compiler ( #1273 )
2019-08-28 05:58:09 -07:00
Greg Sjaardema
f5556225a4
Eliminate shadow variable warning
...
gcc-9 gives the following shadow warning:
```
In file included from /Users/libraries/ioss/src/fmt/ostream.h:12,
from /Users/libraries/ioss/src/Ioss_DatabaseIO.C:59:
/Users/libraries/ioss/src/fmt/format.h: In function 'void fmt::v6::internal::parse_format_string(fmt::v6::basic_string_view<Char>, Handler&&)':
/Users/libraries/ioss/src/fmt/format.h:2442:10: warning: declaration of 'struct fmt::v6::internal::parse_format_string(fmt::v6::basic_string_view<Char>, Handler&&)::writer' shadows a global declaration [-Wshadow]
2442 | struct writer {
| ^~~~~~
/Users/libraries/ioss/src/fmt/format.h:1703:7: note: shadowed declaration is here
1703 | using writer = basic_writer<buffer_range<char>>;
| ^~~~~~
```
Since the `writer` struct is only used internally in the `parse_format_string` function, its name can be changed somewhat aribtrarily to avoid conflicts with names in an outer scope.
Note that this warning is also present in the 6.0.0 release.
2019-08-27 14:29:39 -07:00
Bruce Mitchener
ad3c7855e2
Fix typos.
2019-08-27 06:26:17 -07:00
Victor Zverovich
9bd2f1f9af
Temporarily disable Grisu
2019-08-26 06:11:44 -07:00
Victor Zverovich
b9815cf048
Simplify part_counter
2019-08-25 08:30:59 -07:00
Victor Zverovich
fe00cddde2
Move part counter to the namespace scope
...
to reduce the number of instantiations
2019-08-25 08:22:43 -07:00
Victor Zverovich
1a7d172dc7
which_value -> kind
2019-08-25 08:08:46 -07:00
Victor Zverovich
006c2546f2
Get rid of basic_prepared_format
2019-08-25 07:57:56 -07:00
Victor Zverovich
4ce006fb6e
Simplify format string compilation
2019-08-25 07:48:09 -07:00
Victor Zverovich
e2e557e273
Remove preparator
2019-08-25 06:47:15 -07:00
Victor Zverovich
a5f470eb10
Test and fix compiled format_to_n and formatted_size
2019-08-25 06:38:41 -07:00
Victor Zverovich
f8b59251c4
Remove unused preparator
2019-08-24 12:48:24 -07:00
Victor Zverovich
643aa4c8c4
Simplify format string compilation
2019-08-24 09:39:40 -07:00
Victor Zverovich
ffe29a92f4
Get rid of internal::compile
2019-08-24 09:04:03 -07:00
Victor Zverovich
e94d723667
Fix compiled format string version of format_to_n
2019-08-24 09:00:30 -07:00
Victor Zverovich
a9337395a2
Remove unused variable
2019-08-24 08:46:15 -07:00
Victor Zverovich
562a9f4991
Remove parts_container_concept_check
2019-08-24 08:41:43 -07:00
Victor Zverovich
b257c56e51
Fix size types
2019-08-24 08:36:14 -07:00
Victor Zverovich
1488df3395
Bump version
2019-08-24 07:31:25 -07:00
Victor Zverovich
45dc3486fe
Update license
2019-08-22 08:37:36 -07:00
Victor Zverovich
b2d4ca1546
Workaround an issue with std::filesystem::path being an infinitely deep range ( #1268 )
2019-08-21 11:22:59 -07:00
Victor Zverovich
c1e97392be
Fix warnings
2019-08-11 08:44:12 -07:00
Victor Zverovich
e8219952c6
Restrict fmt::compile to literal strings
...
to make sure we don't break the API too much when making all of this
compile-time only.
2019-08-10 13:18:11 -07:00
Victor Zverovich
5360ab0b59
Fix iteration over named arguments ( #1168 )
2019-08-09 11:53:07 -07:00
Victor Zverovich
22a42c0b01
Cleanup compile implementation
2019-08-04 11:15:43 -07:00
Victor Zverovich
211d312406
Don't terminate on I/O errors in report_error
2019-08-04 09:38:47 -07:00
Victor Zverovich
ba63ac8c18
Make format_to a non-member
2019-08-04 06:47:49 -07:00