Commit Graph

1028 Commits

Author SHA1 Message Date
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