Commit Graph

6409 Commits

Author SHA1 Message Date
June Liu
2ac6c5ca8b
Fix error C2668 on Windows with option /std:c++latest (#3680)
* Namespace-qualify to avoid ambiguity with std::format_to for format-test.cc

When build fmt with MSVC under option /std:c++latest, it failed due to `error 2668: 'std::format_to': ambiguous call to overloaded function`, so add namespace to qualify the call to format_to to avoid this issue.
2023-10-16 09:54:02 -07:00
Victor Zverovich
d9063baf22 Fix perf regression in ostream::print 2023-10-15 08:23:36 -07:00
Victor Zverovich
f7542c5761 Apply clang-format 2023-10-14 06:52:43 -07:00
Victor Zverovich
130cf54cbc Use a more sensible locale in tests 2023-10-08 10:49:21 -07:00
Victor Zverovich
8e0ca0589f Use a more sensible locale in tests 2023-10-08 09:21:02 -07:00
Victor Zverovich
bf497ac068 Cleanup test 2023-10-08 07:30:08 -07:00
Richard Kellnberger
bb8d50f04b
add a suffix for days and fix the one for minutes (#3664) 2023-10-07 12:45:34 -07:00
Giel van Schijndel
f76603f21e
fix: make std::bitset formattable again (#3660)
* fix: make std::bitset formattable again

It used to be formattable via operator<<(ostream&) implicitly. Make it
formattable again, but this time via formatter specialization.

* fix: make nested_formatter constexpr default constructible
2023-10-03 09:53:47 -07:00
dependabot[bot]
f918289363
Bump actions/checkout from 4.0.0 to 4.1.0 (#3666)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.0.0 to 4.1.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](3df4ab11eb...8ade135a41)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-01 09:49:05 -07:00
Victor Zverovich
72e883e163 Diagnose unsupported code unit types 2023-10-01 08:37:21 -07:00
Christoph Reiter
b3bf23f3c4
Remove leftover usage of the __std_stream header (#3663)
2dd4fa8742 removed all usage of __std_stream because
it is no longer available with clang v17. That commit missed one place
where the header was still used (only used when building with -DFMT_MODULE=ON).
Remove it there too.

See #3654
2023-10-01 08:16:42 -07:00
Joyce
349e1c48d1
Update README.rst (#3661)
Signed-off-by: Joyce <joycebrum@google.com>
2023-09-30 07:16:04 -07:00
Joyce
79dbd3f192
feat: add security policy to readme (#3655)
Signed-off-by: Joyce <joycebrum@google.com>
2023-09-28 16:50:14 -07:00
Victor Zverovich
2dd4fa8742 Remove an ostream hack incompatible with libc++ 17 2023-09-26 12:42:37 -07:00
Per Lundberg
44f3d8a77c
README.rst: fix broken LICENSE link (#3653)
The `.rst` suffix was dropped for this file a while ago.
2023-09-22 15:54:40 -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
Vladislav Shchapov
492a99c964
Fix error: 'char_traits<custom_char>' is deprecated: char_traits<T> for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided for a temporary period. It will be removed in LLVM 18, so please migrate off of it. [-Werror,-Wdeprecated-declarations] (#3634)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2023-09-18 15:46:17 -07:00
Victor Zverovich
3baaa8d899 Update docs 2023-09-18 14:54:52 -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
aa3c5a4127 Clarify I/O error handling 2023-09-16 08:20:27 -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
Dzmitry Ivaniuk
e25370093a
Remove unnecessary spaces (#3642) 2023-09-16 06:55:22 -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
dependabot[bot]
f5be4a8a9a
Bump actions/checkout from 3.5.3 to 4.0.0 (#3623)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.3 to 4.0.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](c85c95e3d7...3df4ab11eb)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-04 11:24:28 -07:00
Victor Zverovich
84e6661517 Workaround a gcc 6.4 issue 2023-09-04 11:23:14 -07:00
Victor Zverovich
ac3240439c
Update dependabot.yml 2023-09-04 10:23:00 -07:00
dependabot[bot]
8894ae87fe
Bump github/codeql-action from 2.21.4 to 2.21.5 (#3622)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.21.4 to 2.21.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](a09933a12a...00e563ead9)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-04 10:19:51 -07:00
Victor Zverovich
ca608547e5 Workaround a C++11 issue 2023-09-04 10:07:14 -07:00
Victor Zverovich
23cf4055a0 Simplify URLs 2023-09-04 10:00:13 -07:00
Victor Zverovich
46c8301ee9 Remove rst2md 2023-09-04 09:38:06 -07:00
Victor Zverovich
a79a979828 Cleanup ranges test 2023-09-04 09:19:40 -07:00
Victor Zverovich
457bb6a98f Merge the copyright comment since there are many contributors 2023-09-04 09:09:01 -07:00
Victor Zverovich
61aef41110 Cleanup changelog 2023-09-04 09:05:07 -07:00
Victor Zverovich
2a45fd30fe Drop the rst suffix from the license file 2023-09-04 08:18:03 -07:00
Victor Zverovich
24296cff1c
Update ChangeLog.md 2023-09-04 08:16:16 -07:00
Victor Zverovich
3d1d20a6ac
Update ChangeLog.md 2023-09-04 08:10:34 -07:00
Victor Zverovich
0302c527c6
Update ChangeLog.md 2023-09-04 07:59:30 -07:00
Victor Zverovich
154eccfeb1 Convert changelog to markdown for compatibility with release notes 2023-09-04 07:15:18 -07:00