Commit Graph

311 Commits

Author SHA1 Message Date
Victor Zverovich
bb827341ed Add FMT_FUNC where necessary 2019-06-18 09:48:23 -07:00
Victor Zverovich
1c3197b8d8 Fix warnings 2019-06-17 09:21:29 -07:00
Victor Zverovich
e29708ee57 uintptr -> fallback_uintptr to avoid confusion with uintptr_t 2019-06-14 18:47:36 -07:00
Victor Zverovich
f03a6c5325 Cleanup 2019-06-14 13:38:44 -07:00
Victor Zverovich
6c3d584e67 Simplify warning suppression 2019-06-14 13:03:34 -07:00
Victor Zverovich
cbbee1b385 Fix handling of hexfloat 2019-06-12 20:53:01 -07:00
Victor Zverovich
e5422db4b2 Fix handling of uintptr_t 2019-06-12 08:16:41 -07:00
mocabe
1653244c69 Fix compilation issue on VS2019 (#1186) (#1191) 2019-06-03 08:34:27 -07:00
Victor Zverovich
d54e64b3c8 Make buffer_context an alias template 2019-06-02 18:28:49 -07:00
Victor Zverovich
67feef5589 Make enable_if_t more std-like and move to fmt namespace 2019-06-01 10:05:16 -07:00
Christopher Di Bella
c929684e33 inlines count_code_points(basic_string_view<char8_t)
count_code_points(basic_string_view<char8_t>) was defined in
fmt/format-inl.h, and only declared in fmt/format.h, but not defined
in src/format.cc. This commit moves the overload to fmt/format.h and
inlines it.
2019-06-01 07:17:22 -07:00
Victor Zverovich
f57227a148 FMT_ENABLE_IF -> enable_if_t 2019-05-31 20:09:19 -07:00
Victor Zverovich
d07cc2026b FMT_EXPLICIT -> explicit, FMT_NULL -> nullptr 2019-05-30 07:42:36 -07:00
Victor Zverovich
d179ec5f8b Simplify Grisu 2019-05-15 08:40:21 -07:00
Victor Zverovich
98b3775297 Add support for exotic string_view iterators (#1156) 2019-05-12 11:07:49 -07:00
Victor Zverovich
b488df6cfe Fix Grisu3 stopping conditions 2019-05-12 08:56:50 -07:00
denchat
f4dfd6e30f Suppress all clang-target-msvc test warning in CMake and other misc fixes (#1151)
* Fix conditional `char8_t` from `format.h` and fix `-Wunused-result` of [[no_discard]] begin() when in c++17

* Suppress `-Winconsistent-dllimport` when in clang-target-msvc

* Suppress warning _CRT_SECURE_NO_WARNINGS in MSVC and -Wdeprecated-declarations

Suppress warning _CRT_SECURE_NO_WARNINGS in MSVC and -Wdeprecated-declarations of POSIX functions in Clang target MSVC.
Those functions are used by gtest.

* Remove FMT_FUNC, mark FMT_API to export
2019-05-11 11:48:27 -07:00
mocabe
6828d549e8 Add FMT_ENABLE_IF_T
for definitions of functions which declared using FMT_ENABLE_IF
2019-05-08 11:20:55 -07:00
Victor Zverovich
8d8ea21c69 Partially implement Grisu3 2019-04-27 12:17:21 -07:00
Victor Zverovich
946498cfbc Fix handling of zero precision 2019-04-19 15:10:12 -07:00
Victor Zverovich
dc94010fa5 Remove char_traits (#1117) 2019-04-16 17:08:24 -07:00
Victor Zverovich
bade46aae5 Optimize grisu using uint128_t 2019-04-13 13:44:41 -07:00
Victor Zverovich
2808395481 basic_buffer -> buffer
This reduces symbol sizes and gets rid of shadowing warnings.
2019-04-07 20:32:28 -07:00
Victor Zverovich
bd8177177a Add support for platforms without uintptr_t 2019-04-06 08:11:03 -07:00
Billy Donahue
1987db663b clang-format 2019-03-30 07:48:53 -07:00
Billy Donahue
a6d1ad741d handle fwrite results #1098 2019-03-30 07:48:53 -07:00
Victor Zverovich
0faa968cc3 Make floating-point formatting locale-independent 2019-03-17 13:26:56 -07:00
Victor Zverovich
76d326a2a2 Enable grisu for general format 2019-03-17 09:48:50 -07:00
Victor Zverovich
c21c6b8c4b Move enable_if to template params 2019-03-16 15:15:38 -07:00
Victor Zverovich
97619e27a2 More fixed precision tests 2019-03-15 10:20:20 -07:00
Victor Zverovich
a82b3680dc More tests and fixed precision fixes 2019-03-13 19:47:07 -07:00
Victor Zverovich
e28429ee73 Prevent overflow with zero precision 2019-03-13 10:46:25 -07:00
Victor Zverovich
49bbf3c876 Simplify shadowing warning fix 2019-03-13 08:29:37 -07:00
Ivan Shynkarenka
e06523361d Visual Studio 2017: warning C4456: declaration of 'result' hides previous local declaration 2019-03-11 14:15:23 -07:00
Victor Zverovich
4c66dad8c1 Refactor digit generation 2019-03-10 15:45:06 -07:00
Victor Zverovich
b1f7cca89e stop -> handler and swap args 2019-03-10 14:43:26 -07:00
Victor Zverovich
f90d33ca12 error_ulp -> error 2019-03-10 14:29:28 -07:00
Victor Zverovich
1632f72cbe Test get_round_direction 2019-03-10 11:14:50 -07:00
Victor Zverovich
8407f4cb24 Round close to zero fixed precision 2019-03-09 15:18:34 -08:00
Victor Zverovich
49d244c065 Don't emit more than precision digits (#1072) 2019-03-09 13:53:23 -08:00
Victor Zverovich
93d22dec35 Implement rounding up and clean up FP formatting 2019-03-09 10:40:36 -08:00
gawain
79b79f329e Add support for '%' type to output floating point values as a
percentage.

This helps with compatibility with Python's format strings.
2019-03-05 17:36:20 -08:00
Victor Zverovich
a97757736b Use grisu for fixed precision 2019-02-23 15:50:50 -10:00
Victor Zverovich
8af651be39 Implement fixed precision 2019-02-22 10:47:27 -10:00
Victor Zverovich
5b0006476a Make stopping condition configurable in grisu 2019-02-14 18:25:13 -08:00
Victor Zverovich
a44238f2ef Improve grisu 2019-02-13 20:03:27 -08:00
Victor Zverovich
83808076e3 Minor cleanup 2019-02-13 19:28:02 -08:00
Victor Zverovich
467520e7a4 Remove unused macro 2019-02-06 11:34:59 -08:00
Victor Zverovich
5a314a5288 Eliminate extra copy on floating-point formatting 2019-02-06 10:17:50 -08:00
Daniela Engert
31510cb437 Fix warnings from Visual Studio
Name hiding.

Signed-off-by: Daniela Engert <dani@ngrt.de>
2019-02-04 11:58:56 -08:00
Victor Zverovich
864b9a2202 Correct the comment 2019-02-04 08:29:39 -08:00
Victor Zverovich
1538336836 Remove unnecessary checks 2019-02-04 08:25:41 -08:00
Victor Zverovich
355eb6d29a Enable grisu for shortest roundtrip (default) formatting 2019-02-03 10:38:28 -08:00
Victor Zverovich
b8d34e0db3 Fix rounding 2019-02-02 09:19:46 -08:00
Victor Zverovich
e61cac687d Minor grisu improvements 2019-02-02 07:41:52 -08:00
Victor Zverovich
7ca8fc3b17 Fix a bogus warning 2019-01-30 07:06:40 -08:00
Victor Zverovich
58b6f8db48 Format the code using clang-format 2019-01-13 06:58:20 -08:00
Sign Bit
0bbdca5b8b Fix conversion warnings (#989)
* Fix sign conversion warnings

* Ignore unused local typedefs

* Remove cast reported as useless on GCC

* Remove warning on unused variable

* Enable conversion warning checking for pedantic build

* Fix sign-conversion warnings in headers
2018-12-20 06:24:19 -08:00
Victor Zverovich
0497875ff3 Stop the orgy of casts 2018-12-05 06:27:31 -08:00
Florin Iucha
77656c672c Fix sign-conversion warnings reported by Clang7 2018-12-03 16:22:59 -08:00
Victor Zverovich
9dcf127fa5 Workaround a bogus MSVC warning 2018-11-30 13:47:04 -08:00
Victor Zverovich
b8b06e3e10 Fix conversion warnings in Grisu 2018-11-30 10:37:40 -08:00
Victor Zverovich
fa1d4dbcfd Fix warnings 2018-11-28 16:15:15 -08:00
Victor Zverovich
b7b8548559 thousands_sep -> thousands_sep_impl (#939) 2018-11-20 15:43:17 -08:00
Victor Zverovich
f2ee988105 Improve locale support 2018-11-14 12:07:39 -08:00
Victor Zverovich
324eac1aa5 Make locales work with any character type 2018-10-28 09:03:27 -07:00
Victor Zverovich
0a96c032b9 Parameterize v*printf on string type (#920) 2018-10-25 13:52:08 -07:00
Victor Zverovich
2d2326a76d Fix compilation with older gcc 2018-10-23 07:31:24 -07:00
Victor Zverovich
13d472bd8c Compute output size for grisu 2018-10-18 17:16:50 -07:00
Victor Zverovich
dda47c9466 Merge min_digits and max_digits 2018-10-17 10:49:30 -07:00
Victor Zverovich
2924622157 Fix naming of basic_format_specs members 2018-10-17 10:13:10 -07:00
Victor Zverovich
bda5f9a556 Replace grisu2_specs with core_format_specs 2018-10-17 08:55:45 -07:00
Victor Zverovich
e8efdef8de Avoid extra copy 2018-10-17 08:19:46 -07:00
Victor Zverovich
50b18a3c10 Integrate Grisu 2018-10-14 14:33:25 -07:00
Victor Zverovich
699297520a Implement Grisu rounding 2018-10-13 11:18:54 -07:00
superfunc
939fbe5567 Remove basic_fixed_buffer.
Issue #873 indicates that this class is no longer required,
as it has been superseded by a new API.

Fixes #873
2018-10-09 06:51:01 -07:00
Victor Zverovich
38325248e5 Count width in code points (#628) 2018-10-03 20:09:46 -07:00
Victor Zverovich
f8027414f5 Impelement char8_t support 2018-09-30 12:31:25 -07:00
Victor Zverovich
5bced12421 Parameterize more functions on string type 2018-09-30 08:02:19 -07:00
Victor Zverovich
e4fea22d15 Make char8_t a strongly-typed enum 2018-09-30 07:11:37 -07:00
Victor Zverovich
d7f17613f5 Fix compilation on platforms with exotic double (#878) 2018-09-26 08:45:34 -07:00
Daniela Engert
73c53d7833 Parameterize 'printf(rgb color, ...)' and 'vprint_rgb(rgb color, ...)' on the type of the format string.
Signed-off-by: Daniela Engert <dani@ngrt.de>
2018-09-23 09:15:27 -07:00
Victor Zverovich
bc26fbf1b0 Move experimental color API to fmt/color.h 2018-09-12 09:04:26 -07:00
medithe
8cbfb6e727 Get rid of conversion warning in gcc-4.8 (#854)
Get rid of conversion warning in gcc-4.8 

Get rid of the following warning:
conversion to ‘int’ from ‘long unsigned int’ may alter its value [-Werror=conversion]
2018-09-11 06:14:39 -07:00
medithe
981797f059 Get rid of implicit-fallthrough warn. in GCC 7 and 8
This change enables FMT_FALLLTHROUGH also for GCC-Compilers in the versions 7 and 8.
2018-09-07 12:43:32 -07:00
Victor Zverovich
1489d3b7fa Implement exponential notation 2018-08-29 18:55:57 -07:00
Victor Zverovich
dd8c5ce442 Implement more FP formatting options 2018-08-29 09:34:57 -07:00
medithe
95a718992c Remove conversion compiler warnings (#844)
* Remove conversion compiler warning

When compiling with g++8, I get the following two errors:
include/fmt/format-inl.h:400:29: error: conversion from ‘int’ to ‘char’ may change value [-Werror=conversion]
       buffer[size++] = zero + static_cast<char>(digit);
                        ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
include/fmt/format-inl.h:416:28: error: conversion from ‘int’ to ‘char’ may change value [-Werror=conversion]
       buffer[size++] = '0' + digit;
                        ~~~~^~~~~~~

With this change, the errors are gone.
2018-08-29 06:38:56 -07:00
Victor Zverovich
e483a01a0f Implement some formatting options in Grisu 2018-08-27 17:51:49 -07:00
Victor Zverovich
f51080916e Revert "Implement some formatting options in Grisu"
This reverts commit 2a952dd0b2.
2018-08-27 17:51:27 -07:00
Victor Zverovich
2a952dd0b2 Implement some formatting options in Grisu 2018-08-26 09:51:49 -07:00
Victor Zverovich
0de44a469a Implement exponent formatting 2018-08-26 08:12:35 -07:00
Victor Zverovich
f0d0a1ebd7 Implement Grisu2 digit generation 2018-08-25 20:45:50 -07:00
Thomas Bernard
abde38b4fb Add compilation support with Newlib nano for embedded targets
Remove the dependency on std::locale to reduce executable sizes

For embedded target the usage of locale bring a huge amount of code to the executable, just to get hold of the thousands separator. Using a static defined thousands separator makes libfmt embedded target friendly.
2018-08-19 07:40:34 -07:00
Victor Zverovich
9de312112a Reformat and add a comment 2018-08-15 06:54:43 -07:00
Victor Zverovich
2a4e948864 Add UTF-8 types 2018-07-22 06:36:21 -07:00
Dhruv Paranjape
ec218a3ad1 Fix redefinition warning for RESET_COLOR 2018-07-04 07:52:19 -07:00
Remotion
ce500635c7 Renamed enum color to colors.
Added enum colors conversion to rgb struct.
Added colors_test.cpp.

Removed print_colored.
Renamed enum colors back to color.

Removed unnecessary inline keyword.
Removed print_rgb.
2018-06-23 06:14:44 -07:00
Elias Kosunen
691a7a91a1 Add more compilers to CI and increase FMT_PEDANTIC warning levels (#736)
* Add a _lot_ more warnings to FMT_PEDANTIC
Fix these warnings

* Add more compilers to CI
Fix (some) of the compiler errors with them

* Enable -Werror on CI
Increase warning level on MSVC when compiling with FMT_PEDANTIC

* Add VS 2013 and 2015 to Appveyor

* Fix Appveyor tests
Formatting

* Implement requested changes
Fix some of the MSVC warnings
Implement C++11 integer_sequence

* Reintroduce appveyor-build.py

* Remove ranges-test from tests

* Remove (some) explicit warning suppressions
Fix C++ standard setting in CI

* Remove (some) explicit warning suppressions
Fix C++ standard setting in CI

* Fix test builds with C++11

* Enable pedantic warnings on tests

* Fix warnings from edits to master

* Cleanups

* Add C++11 support to ranges.h
Re-enable ranges-test
Fix a Visual Studio error about function not returning a value in printf.h
Fix a bug in .travis.yml
2018-06-06 15:57:59 +02:00
Victor Zverovich
b60a5c5d49 Improve floating-point formatting 2018-05-28 20:16:30 -07:00
Victor Zverovich
4e4b8570e5 Implement simple version of Grisu 2018-05-28 11:25:07 -07:00
Victor Zverovich
468c243ca8 Add a function to get cached power of 10 2018-05-27 10:57:26 -07:00
Victor Zverovich
2f257b7291 Implement normalization and simplify power table 2018-05-27 08:04:30 -07:00
Victor Zverovich
6ebc1a967d Merge locale.h into format-inl.h 2018-05-20 17:16:34 -07:00
Victor Zverovich
69823bf852 Improve naming consistency 2018-05-19 08:59:37 -07:00
Victor Zverovich
838400d29b Add inline namespace fmt::v5 2018-05-12 11:02:15 -07:00
Daniela Engert
2570f1afdc Provide more overloads for the wide string flavour
Signed-off-by: Daniela Engert <dani@ngrt.de>
2018-05-05 07:31:44 -07:00
Daniela Engert
6cd666100f remove trailing spaces.
Signed-off-by: Daniela Engert <dani@ngrt.de>
2018-05-01 07:10:05 -07:00
Victor Zverovich
2768af2388 Add cached powers of 10 2018-04-29 06:33:05 -07:00
Victor Zverovich
cd90097ca4 Implement handmade FP 2018-04-21 17:26:24 -07:00
Victor Zverovich
3da71d51e0 Move source files to the src directory 2018-03-21 07:50:59 -07:00