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
Victor Zverovich
3fe49163bd
Revert "Make format_to a non-member"
...
This reverts commit a5bd3ddb28
.
2019-08-03 16:12:34 -07:00
Victor Zverovich
a5bd3ddb28
Make format_to a non-member
2019-08-03 08:36:53 -07:00
Victor Zverovich
3df0ea34e5
Remove unnecessary overloads
2019-08-03 08:26:51 -07:00
Victor Zverovich
436acf3489
Make formatted_size & format_to_n non-members
2019-08-03 07:54:49 -07:00
Victor Zverovich
823128049b
Make format a non-member
2019-08-03 06:31:24 -07:00
Charles Milette
1dfa2591b3
Make operator _a constexpr
2019-08-01 16:56:49 -07:00
Charles Milette
6f2dd30e38
Simplify udl_formatter return type
2019-08-01 16:56:49 -07:00
Charles Milette
431d0f85cf
Use basic_string_view in non-template UDL
2019-08-01 16:56:49 -07:00
Charles Milette
ad71f5a706
Use forwarding references in UDL template
2019-08-01 16:56:49 -07:00
Victor Zverovich
eac2796ce3
Fix locale detection
2019-07-26 12:13:05 +03:00
Victor Zverovich
ee36257469
Internalize format_part
2019-07-26 09:02:45 +03:00
Victor Zverovich
bbf0bada33
Simplify compile
2019-07-26 07:58:19 +03:00
Victor Zverovich
3730b4f039
Cleanup compile implementation
2019-07-25 21:26:22 +03:00
Victor Zverovich
9393fe26f6
prepare -> compile
2019-07-25 19:39:41 +03:00
Victor Zverovich
3268531bc9
Workaround a broken C locale on Windows
2019-07-25 12:55:23 +03:00
Jack Andersen
8bd59ec936
Use fputws for outputting wide strings
...
Also adds fwide byte/wide orientation checking to verify streams are
able to receive the character type in question.
On Windows, the fwide calls are no-ops that pass through the second
arg and optimize out the if statement entirely.
2019-07-25 10:29:32 +03:00
Victor Zverovich
6bcc3fd216
Fix warnings
2019-07-19 13:27:41 +02:00
Victor Zverovich
6a497e1d06
Fix warnings
2019-07-19 06:18:46 +02:00
Victor Zverovich
e9b9b0aefa
clang-format
2019-07-18 06:28:53 +02:00
Victor Zverovich
ec24342b2b
Fix more warnings
2019-07-18 06:28:17 +02:00
Victor Zverovich
230b24944c
Fix sign conversion warnings
2019-07-17 21:18:55 +02:00
Daan De Meyer
cadd92d69f
Fix #1232 .
2019-07-17 11:52:10 +02:00
Daan De Meyer
41076d1de3
Use FMT_THROW
in fmt/color.h.
...
This allows fmt to be compiled with `-fno-exceptions`.
2019-07-17 10:15:31 +02:00
Jack Andersen
d561cb47a7
Opt-in macro to enforce use of compile-time format strings
2019-07-16 07:08:59 +02:00
Jack Andersen
699fe8e711
Remove const qualification in compile-time checks
2019-07-15 09:20:16 +02:00
Victor Zverovich
af4734fd15
Fix warnings
2019-07-12 16:03:12 -07:00
Victor Zverovich
dd8cc8b0ba
Disallow passing views as lvalues
2019-07-09 12:18:48 -07:00