Commit Graph
1344 Commits
Author SHA1 Message Date
Victor Zverovich ba36a04811 Remove counting_iterator 2024-07-22 16:24:13 -07:00
Victor Zverovich f6b4a23b83 Unbloat chrono 2024-07-22 15:46:58 -07:00
Victor Zverovich 7f157dca0a Workaround gcc stringop-overflow bug 2024-07-22 11:31:35 -07:00
Victor Zverovich bdc45eef76 Simplify on_text 2024-07-21 08:31:03 -07:00
Victor Zverovich de684ef776 Make appender compatible with fill 2024-07-19 15:21:57 -07:00
Victor Zverovich 0f87d6ffa6 Improve sign processing 2024-07-17 16:13:27 -07:00
Victor Zverovich f97deb0d7d Minor cleanup 2024-07-14 11:14:49 -07:00
Victor Zverovich 3541353512 Apply minor optimization 2024-07-14 09:52:44 -07:00
Justin Riddell 5ef93a9f80 Expand FMT_FORMAT_AS to include implicit conversions (#4055)
Allows (for example) types convertible to std::string_view to inherit
from the fmt::formatter<fmt::string_view> to work etc.
2024-07-14 09:51:49 -07:00
Victor Zverovich c9102619da Avoid extra reserve 2024-07-14 08:41:35 -07:00
Dix Lorenz 7ae102bd66 make format_int constexpr (#4032)
* make format_int constexpr

* format_int can only be constexpr in C++20

* apply clang-format

* drop constexpr for str()
2024-06-23 06:28:39 -07:00
Victor Zverovich febd8ed5fe Cleanup includes 2024-06-16 10:59:06 -07:00
Victor Zverovich 2a2048a785 Don't pass seconds as a double in examples 2024-06-15 09:26:49 -07:00
LoveSy 8687315e86 Guard more system headers by FMT_MODULE (#4006)
* Guard more system headers by `FMT_MODULE`

* Merge FMT_MODULE and FMT_IMPORT_STD
2024-06-14 10:53:51 -07:00
LoveSy a9b8517638 Use native c++ module support from CMake
also fix some clang compilation issues when using c++ modules
2024-06-05 21:01:42 -07:00
Victor Zverovich ab29ef37d9 Migrate docs and cleanup 2024-06-02 13:17:04 -07:00
Victor Zverovich 97117cbb51 Migrate to mkdocs 2024-06-02 12:21:11 -07:00
Victor Zverovich 38ba3d3993 Migrate to mkdocs 2024-06-02 08:26:56 -07:00
Victor Zverovich 03d14c3beb Add support for multiple namespaces 2024-06-02 07:01:40 -07:00
Victor Zverovich a10e032148 Improve docs 2024-06-01 20:08:41 -07:00
Victor Zverovich 75e892420e Minor cleanup 2024-05-16 10:45:23 -07:00
Justin Riddell 8e728044f6 Fix format_as for non-const begin/end views (#3955)
base::format does not accept rvalues, using the result of format_as
directly means it is passed one. Doesn't matter for ranges with a const
begin and end, but filter_view caches, so it only has mutable begin/end.
Use auto&& to avoid copy if format_as returns const ref
2024-05-13 09:35:55 -07:00
Victor Zverovich 7d6ae972b9 Cleanup unicode checks 2024-05-11 19:43:46 -07:00
Victor Zverovich 328d256c60 Apply coding conventions 2024-05-06 15:10:29 -07:00
Alex Dewar 8a8f4825a3 Fix: isnan() shouldn't cause FP exceptions
Fixes #3948.
2024-05-02 09:36:21 -07:00
Diego Ramírez cf1f55f798 Specialize formatter for all std::basic_string types (#3943)
* Specialize `formatter` for all `std::basic_string` types

* mock-allocator: add member types to make GCC 4.8 happy
2024-04-23 08:44:41 -07:00
Matthias Moulin 116a9ce488 Added FMT_IMPORT_STD feature macro (#3928) 2024-04-10 11:48:32 -07:00
ShifftC 5eb68c0ef2 Fix mix-up of 'FMT_BEGIN_EXPORT' and 'namespace detail'. (#3924) 2024-04-08 09:46:20 -07:00
Philippe Proulx 4e8640ed90 Fix: enable FMT_NORETURN without exception support too (#3917)
When building `format.cc` as such with GCC 13.2.1:

    $ g++ -c format.cc -DFMT_EXCEPTIONS=0 -Wmissing-noreturn -Werror

I get:

    In file included from format.cc:8:
    fmt/format-inl.h: In function ‘void fmt::v10::detail::assert_fail(const char*, int, const char*)’:
    fmt/format-inl.h:30:15: error: function might be candidate for attribute ‘noreturn’ [-Werror=suggest-attribute=noreturn]
       30 | FMT_FUNC void assert_fail(const char* file, int line, const char* message) {
          |               ^~~~~~~~~~~
    fmt/format-inl.h: In function ‘void fmt::v10::report_error(const char*)’:
    fmt/format-inl.h:129:15: error: function might be candidate for attribute ‘noreturn’ [-Werror=suggest-attribute=noreturn]
      129 | FMT_FUNC void report_error(const char* message) {
          |               ^~~~~~~~~~~~
    cc1plus: all warnings being treated as errors

Note that, with `FMT_EXCEPTIONS` defined to 0:

‣ report_error(const char *) uses FMT_THROW() which expands to calling
  assert_fail().

‣ assert_fail() calls std::terminate() which has the `[[noreturn]]`
  attribute since C++11 [1].

Therefore, with `FMT_EXCEPTIONS` defined to 0, both assert_fail() and
report_error() need to have the `[[noreturn]]` attribute too (if
available). In other words, `FMT_NORETURN` doesn't depend on
`FMT_EXCEPTIONS`.

Also adding `FMT_NORETURN` to two on_error() functions which call
report_error(const char *).

Other report_error() overloads eventually return, therefore they don't
need `FMT_NORETURN`.

[1]: https://en.cppreference.com/w/cpp/error/terminate

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
2024-04-04 17:15:18 -07:00
Victor Zverovich 5d63e87d23 Add a formatter for float128 2024-03-22 15:41:50 +09:00
Victor Zverovich aecec01b34 Initial support for extended FP types 2024-03-22 15:08:25 +09:00
Victor Zverovich 5af88653eb Cleanup 2024-03-22 13:46:03 +09:00
Vladislav Shchapov 6c7cc6a06f Fix group_digits for negative integers (#3901)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-03-19 13:03:57 -07:00
Vladislav Shchapov 9f3fc6e38b Add XChar support into nested_formatter
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-03-17 15:26:18 -07:00
Baardi ae1e93d34d Fix warning C4702 emitted from format.h (MSVC) (#3866) 2024-02-28 07:47:13 -08:00
Bruce Mitchener 0879504796 Fix typo in typename. containter_type -> container_type. (#3844) 2024-02-08 06:24:55 -08:00
Victor Zverovich 06311ed1ce Fix fixed rounding around zero in Dragon 2024-02-03 10:13:58 -08:00
Frank Richter 71a4a8d479 Really fix MSVC warning about <bit> only being available in C++20. (#3832)
* Really fix MSVC warning about <bit> only being available in C++20.

The warning states "The contents of <bit> are available only with C++20 or later.",
but the check was for C++17 and later.

* Change <bit> inclusion check per https://github.com/fmtlib/fmt/pull/3832#discussion_r1471144867
2024-01-30 10:42:35 -08:00
Victor Zverovich 4c5b4af04d Improve name argument validation 2024-01-19 16:13:43 -08:00
Victor Zverovich b2cde48de5 Reduce usage of float_specs 2024-01-17 08:27:03 -08:00
Victor Zverovich 8510838db1 Make format_specs not depend on code unit type 2024-01-17 07:50:52 -08:00
Victor Zverovich 090ee13595 Pass char type to write 2024-01-17 06:07:29 -08:00
Victor Zverovich e954823531 Make fill independent on code unit type 2024-01-15 15:00:28 -08:00
Victor Zverovich fe0d910a7d Replace multiple error reporting mechanisms with report_error 2024-01-15 07:23:06 -08:00
Victor Zverovich f9294f0e60 Improve handling of format specs 2024-01-15 06:31:24 -08:00
Victor Zverovich c98a5a599f Remove unnecessary checks 2024-01-14 17:41:49 -08:00
Victor Zverovich d70729215f Fix constness 2024-01-14 06:44:38 -08:00
Victor Zverovich cacdf1439f Remove nonstandard alias 2024-01-13 15:56:16 -08:00
Victor Zverovich d0963d4823 Make ranges only depend on fmt/base.h 2024-01-13 09:54:19 -08:00
Victor Zverovich da0f84c42c Cleanup copy functions and move to base.h 2024-01-13 09:31:20 -08:00