Commit Graph

2835 Commits

Author SHA1 Message Date
Victor Zverovich
72e883e163 Diagnose unsupported code unit types 2023-10-01 08:37:21 -07:00
Victor Zverovich
2dd4fa8742 Remove an ostream hack incompatible with libc++ 17 2023-09-26 12:42:37 -07:00
Victor Zverovich
06b20387ae Optimize fractional_part_rounding_thresholds 2023-09-22 13:26:57 -07:00
Victor Zverovich
649f2460db Apply clang-format 2023-09-22 09:07:43 -07:00
Greg Sjaardema
7529af8f99 Workaround intel bug (#3652)
* Workaround intel bug

Potential workaround / restructure for the intel bug that is the cause of #3645.

Make the variable in the external struct instead an embedded static constexpr variable in the only function that uses the variable.

* Finish the proposed change -- remove struct accessor

* Refactor proposed intel fix.

Moved variable out of function to avoid specialization on Float.  Made it a separate function that is called from format_float.

* Fix incorrect function name.

* Add missing inline.
2023-09-20 18:57:55 -07:00
Giel van Schijndel
a3a74fa7f3 fix: mark fmt::streamed() as constexpr (#3650)
Because it's just performing a very basic type conversion that can be
done at constexpr time.

My use case simultaneously creates a
`fmt::basic_format_string<some_type_conversion<Args...>>` instance and
performs `some_type_conversion<Args>(args)...`. `some_type_conversion`
optionally applies `fmt::streamed(arg)` to a subset of types. This needs
to be `constexpr` because `basic_format_string`'s constructor is
`consteval`.
2023-09-19 08:42:34 -07:00
Sascha Scandella
8ef4db4b96 Use datatype of underlying data (#3647) 2023-09-19 07:31:36 -07:00
Victor Zverovich
0e01e46c11 Implement nested formatter 2023-09-18 14:21:21 -07:00
Dana Jansens
f6ca4ea199 Avoid a space in the UDL definition (#3610)
* Avoid a space in the UDL definition except on GCC before 4.9

Clang 18 has grown a warning about the space being deprecated which
is enabled by default in their nightly binaries. However GCC before 4.9
will reject the UDL definition unless there is a space there, so we need
to keep the space conditionally for it.

* Remove UDLs on GCC before 4.9 to simplify things

GCC before 4.9 rejects the syntax that is now
rejected on more modern compilers.

* Disable compile-error-test on GCC < 4.9

This avoids the UDL tests failing as GCC < 4.9 can not parse UDLs
without a space, but the space is malformed in modern compilers.
2023-09-18 08:09:42 -07:00
Gleb Mazovetskiy
a8a73da7e4 Add an option to avoid wchar APIs on Windows (#3636)
With this, fmt can be used on Windows 98 and the Original Xbox with:

    set(FMT_OS OFF)

It is not exposed as a CMake option but one can define it manually
in the fmt subproject, e.g.:

    target_compile_definitions(fmt PUBLIC FMT_WINDOWS_NO_WCHAR)

Fixes #3631
2023-09-17 08:49:51 -07:00
Victor Zverovich
bfdf50d183 Minor cleanup 2023-09-16 08:16:59 -07:00
Chloe
571a9b7b26 Replace usage of C++17 library feature with C++11 (#3638) 2023-09-16 08:07:03 -07:00
Victor Zverovich
6c088be8ec Cleanup handling of visibility 2023-09-16 07:40:08 -07:00
Vladislav Shchapov
016b1faede Fix symbol leak (#3627)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2023-09-16 07:26:36 -07:00
Victor Zverovich
d4987546a4 Add an experimental nested formatter 2023-09-10 11:56:55 -07:00
Victor Zverovich
5bdce181f1 Mark styled_arg as a view to prevent lifetime issues 2023-09-09 08:16:45 -07:00
cyy
a4b7b24b7b fix redundant redeclaration of ‘constexpr’ static data member (#3630) 2023-09-08 16:20:32 -07:00
Vinay Yadav
fac60bd4f5 Remove type cast as mxe(mingw32) compiler complains about useless-cast (#3624)
Remove type cast as mxe(mingw32) compiler complains about useless-cast
when FMT_PEDANTIC && FMT_WERROR options are enabled
"""
error: useless cast to type 'class fmt::v10::basic_format_args<fmt::v10::basic_format_context<fmt::v10::appender, char> >' [-Werror=useless-cast]
 1449 |                      basic_format_args<buffer_context<char>>(args));
"""
2023-09-05 07:37:27 -07:00
Victor Zverovich
84e6661517 Workaround a gcc 6.4 issue 2023-09-04 11:23:14 -07:00
Victor Zverovich
e1fc481d65 Merge the copyright comment since there are many contributors 2023-09-04 06:54:07 -07:00
Victor Zverovich
28e2d3b640 Bump version 2023-08-26 08:29:50 -07:00
Alex Guteniev
9b74160817 atomic_flag formatting (#3594) 2023-08-25 08:06:10 -07:00
Victor Zverovich
a21690bdfa Coding conventions 2023-08-25 07:46:32 -07:00
Mathew Benson
e786824053 Refactor Improvement on umul128 function
- Removal of direct access to members of uint128_fallback and instead
  create the values at the callsite and pass them via the constructor of
  uint128_fallback on the return statement.
2023-08-25 13:21:52 +03:00
Mathew Benson
2b20d7be6f Refactor To remove friend function private access
- Remove umul128 friend function from uint128_fallback class using
  non-const member access functions instead.
2023-08-24 00:55:43 +03:00
Mathew Benson
1f38ebbdb1 Add condition to include friend function in win32 2023-08-22 23:07:04 +03:00
Mathew Benson
e418179694 Fix for FMT_MODULE not compiling on GCC 2023-08-22 21:11:53 +03:00
lukester1975
cc077a5e3b Fix FMT_NO_UNIQUE_ADDRESS warning with clang-cl. (#3600)
See https://reviews.llvm.org/D110485 for info.
2023-08-20 10:21:50 -07:00
Mathew Benson
a992b3d1fc Fix for Compilation Error When Using FMT_MODULE (#3597)
* FMT_EXPORT reorganization to fix compile error

- When compiling with FMT_MODULE, an error was being generated due to
  use of FMT_EXPORT on a declaration within FMT_BEGIN_EXPORT and
  FMT_END_EXPORT on `include/core.h`

- On `include/format.h` had to exclude the function vformat_to by ending
  the export block just before it and beginning a new one after it.
2023-08-20 07:32:36 -07:00
YuHuanTin
bd868f3a51 Improve compatibility with GBK #3598 (#3599) 2023-08-19 08:13:20 -07:00
Victor Zverovich
bbb784fb1b Fix a gcc error about partial specialization after instantiation 2023-08-19 07:22:40 -07:00
Ben Deane
6c845f57e5 Fix formatted_size with FMT_COMPILE and format specs (#3588)
Addresses issue #3586
2023-08-15 06:45:48 -07:00
Zhanwei Wang
5a866fe852 Add formatter for std::atomic (#3574) 2023-08-14 08:34:31 -07:00
Vladislav Shchapov
e150ea0cc2 to_string supports types with format_as
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2023-08-13 08:39:52 -07:00
Victor Zverovich
e1acd5f4d9 Bump version 2023-08-12 06:52:15 -07:00
Victor Zverovich
d424862319 Fix fixed precision handling during rounding in long double 2023-08-07 13:56:53 -07:00
Victor Zverovich
7a2f6ac210 Fix a comment 2023-08-07 09:33:45 -07:00
Victor Zverovich
ebb10347c4 Merge branch 'master' of github.com:fmtlib/fmt 2023-08-07 08:18:13 -07:00
Victor Zverovich
1005720169 Clarify that visit_format_arg is deprecated 2023-08-07 08:17:55 -07:00
Vladislav Shchapov
aeb6ad4dd0 Added formatter for bit_reference-like types (#3570)
* Add test for std::vector<bool>::reference

Co-authored-by: Felix <felix-antoine.constantin@polymtl.ca>
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>

* Add test for std::bitset<N>::reference

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>

* Add test for const std::bitset<N>::reference and const std::vector<bool>::reference

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>

* Add bit_reference-like formatter

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>

* Use std::addressof

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>

---------

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
Co-authored-by: Felix <felix-antoine.constantin@polymtl.ca>
2023-08-06 11:36:30 -07:00
5chmidti
8a4bec5cf5 fix ambiguous formatter lookup for flat_set (#3561) 2023-07-31 09:26:33 -07:00
razaqq
757564f5cd add missing inline specifier (#3552) 2023-07-27 12:12:00 -07:00
Jürgen Hock
f4214ae8dd Use the U literal for unsigned integer constants. (#3549)
Fix MSVC Error C2398 Element '1': conversion from 'int' to 'const uint32_t' requires a narrowing conversion.
2023-07-27 11:43:00 -07:00
Victor Zverovich
aecf80d304 Update a comment 2023-07-26 15:10:12 -07:00
Martin Jeřábek
503d49286d expose detail::throw_format_error (#3551)
This enables to only #include <fmt/core.h> when defining formatters.
2023-07-26 13:21:38 -07:00
Ozomahtli
4f46cb82f3 Remove std::copy usage. (#3550) 2023-07-26 07:27:01 -07:00
Victor Zverovich
3dec65b7fd Use replacement character in path 2023-07-22 09:07:28 -07:00
Dmitry Alexeev
dbabb305c3 Turn off error-producing NVCC workaround when using c++20 (#3544) 2023-07-21 11:29:15 -07:00
Victor Zverovich
ac0ab8eff3 Improve path formatter 2023-07-20 17:49:12 -07:00
Victor Zverovich
40f35d6f04 Cleanup std formatters 2023-07-20 16:26:27 -07:00