Skip to content

Commit

Permalink
Merge branch 'fmtlib:master' into zig-pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
kassane committed Aug 12, 2023
2 parents 55d7142 + 4c56612 commit a098c64
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 15 deletions.
164 changes: 152 additions & 12 deletions ChangeLog.rst
Original file line number Diff line number Diff line change
@@ -1,42 +1,182 @@
10.1.0 - TBD
------------

* Fixed ambiguous formatter specialization for containers that look like
container adaptors (`#3556 <https://github.com/fmtlib/fmt/issues/3556>`_,
* Optimized format string compilation resulting in up to 40% speed up in
compiled ``format_to`` and ~4x speed up in compiled ``format_to_n`` on a
concatenation benchmark (`#3133 <https://github.com/fmtlib/fmt/issues/3133>`_,
`#3484 <https://github.com/fmtlib/fmt/issues/3484>`_).

{fmt} 10.0::

---------------------------------------------------------
Benchmark Time CPU Iterations
---------------------------------------------------------
BM_format_to 78.9 ns 78.9 ns 8881746
BM_format_to_n 568 ns 568 ns 1232089

{fmt} 10.1::

---------------------------------------------------------
Benchmark Time CPU Iterations
---------------------------------------------------------
BM_format_to 54.9 ns 54.9 ns 12727944
BM_format_to_n 133 ns 133 ns 5257795

* Optimized storage of an empty allocator in ``basic_memory_buffer``
(`#3485 <https://github.com/fmtlib/fmt/pull/3485>`_).
Thanks `@Minty-Meeo <https://github.com/Minty-Meeo>`_.

* Added formatters for proxy references to elements of ``std::vector<bool>`` and
``std::bitset<N>`` (`#3567 <https://github.com/fmtlib/fmt/issues/3567>`_,
`#3570 <https://github.com/fmtlib/fmt/pull/3570>`_).
For example (`godbolt <https://godbolt.org/z/zYb79Pvn8>`__):

.. code:: c++

#include <vector>
#include <fmt/std.h>

int main() {
auto v = std::vector<bool>{true};
fmt::print("{}", v[0]);
}

Thanks `@phprus (Vladislav Shchapov) <https://github.com/phprus>`_ and
`@felix642 (Félix-Antoine Constantin) <https://github.com/felix642>`_.

* Fixed an ambiguous formatter specialization for containers that look like
container adaptors such as ``boost::flat_set``
(`#3556 <https://github.com/fmtlib/fmt/issues/3556>`_,
`#3561 <https://github.com/fmtlib/fmt/pull/3561>`_).
Thanks `@5chmidti <https://github.com/5chmidti>`_.

* Fixed compilation when formatting durations not convertible from
``std::chrono::seconds`` (`#3430 <https://github.com/fmtlib/fmt/pull/3430>`_).
Thanks `@patlkli (Patrick Geltinger) <https://github.com/patlkli>`_.

* Made the ``formatter`` specialization for ``char*`` const-correct
(`#3432 <https://github.com/fmtlib/fmt/pull/3432>`_).
Thanks `@timsong-cpp <https://github.com/timsong-cpp>`_.

* Made ``{}`` and ``{:}`` handled consistently during compile-time checks
(`#3526 <https://github.com/fmtlib/fmt/issues/3526>`_).

* Disallowed passing temporaries to ``make_format_args`` to improve API safety
by preventing dangling references.

* Made floating-point formatting tests more platform-independent
(`#3433 <https://github.com/fmtlib/fmt/issues/3433>`_,
* Improved the compile-time error for unformattable types
(`#3478 <https://github.com/fmtlib/fmt/pull/3478>`_).
Thanks `@BRevzin (Barry Revzin) <https://github.com/BRevzin>`_.

* Improved the floating-point formatter
(`#3448 <https://github.com/fmtlib/fmt/pull/3448>`_,
`#3450 <https://github.com/fmtlib/fmt/pull/3450>`_).
Thanks `@florimond-collette (Florimond Collette)
<https://github.com/florimond-collette>`_.

* Fixed handling of precision for ``long double`` larger than 64 bits.
(`#3539 <https://github.com/fmtlib/fmt/issues/3539>`_,
`#3564 <https://github.com/fmtlib/fmt/issues/3564>`_).

* Made floating-point and chrono tests less platform-dependent
(`#3337 <https://github.com/fmtlib/fmt/issues/3337>`_,
`#3433 <https://github.com/fmtlib/fmt/issues/3433>`_,
`#3434 <https://github.com/fmtlib/fmt/pull/3434>`_).
Thanks `@phprus (Vladislav Shchapov) <https://github.com/phprus>`_.

* Removed the remnants of the Grisu floating-point formatter that has been
replaced by Dragonbox in earlier versions.

* Added ``throw_format_error`` to the public API
(`#3551 <https://github.com/fmtlib/fmt/pull/3551>`_).
Thanks `@mjerabek (Martin Jeřábek) <https://github.com/mjerabek>`_.

* Made ``FMT_THROW`` assert even if assertions are disabled when compiling with
exceptions disabled (`#3418 <https://github.com/fmtlib/fmt/issues/3418>`_,
`#3439 <https://github.com/fmtlib/fmt/pull/3439>`_).
`@BRevzin (Barry Revzin) <https://github.com/BRevzin>`_.
Thanks `@BRevzin (Barry Revzin) <https://github.com/BRevzin>`_.

* Made ``format_as`` and ``std::filesystem::path`` formatter work with exotic
code unit types.
(`#3457 <https://github.com/fmtlib/fmt/pull/3457>`_,
`#3476 <https://github.com/fmtlib/fmt/pull/3476>`_).
Thanks `@gix (Nico Rieck) <https://github.com/gix>`_,
`@hmbj (Hans-Martin B. Jensen) <https://github.com/hmbj>`_.

* Deprecated the wide stream overload of ``printf``.

* Removed unused ``basic_printf_parse_context``.

* Improved documentation.
* Improved RTTI detection used when formatting exceptions
(`#3468 <https://github.com/fmtlib/fmt/pull/3468>`_).
Thanks `@danakj (Dana Jansens) <https://github.com/danakj>`_.

* Improved build configuration
(`#3563 <https://github.com/fmtlib/fmt/pull/3563>`_).
Thanks `@abouvier (Alexandre Bouvier) <https://github.com/abouvier>`_.
* Improved compatibility with VxWorks7
(`#3467 <https://github.com/fmtlib/fmt/pull/3467>`_).
Thanks `@wenshan1 (Bin Lan) <https://github.com/wenshan1>`_.

* Improved documentation
(`#3174 <https://github.com/fmtlib/fmt/issues/3174>`_,
`#3423 <https://github.com/fmtlib/fmt/issues/3423>`_,
`#3454 <https://github.com/fmtlib/fmt/pull/3454>`_,
`#3458 <https://github.com/fmtlib/fmt/issues/3458>`_,
`#3461 <https://github.com/fmtlib/fmt/pull/3461>`_,
`#3487 <https://github.com/fmtlib/fmt/issues/3487>`_,
`#3515 <https://github.com/fmtlib/fmt/pull/3515>`_).
Thanks `@zencatalyst (Kasra Hashemi) <https://github.com/zencatalyst>`_,
`@rlalik <https://github.com/rlalik>`_,
`@mikecrowe (Mike Crowe) <https://github.com/mikecrowe>`_.

* Improved build and CI configurations
(`#3449 <https://github.com/fmtlib/fmt/issues/3449>`_,
`#3451 <https://github.com/fmtlib/fmt/pull/3451>`_,
`#3452 <https://github.com/fmtlib/fmt/pull/3452>`_,
`#3453 <https://github.com/fmtlib/fmt/pull/3453>`_,
`#3459 <https://github.com/fmtlib/fmt/pull/3459>`_,
`#3481 <https://github.com/fmtlib/fmt/issues/3481>`_,
`#3486 <https://github.com/fmtlib/fmt/pull/3486>`_,
`#3489 <https://github.com/fmtlib/fmt/issues/3489>`_,
`#3496 <https://github.com/fmtlib/fmt/pull/3496>`_,
`#3517 <https://github.com/fmtlib/fmt/issues/3517>`_,
`#3523 <https://github.com/fmtlib/fmt/pull/3523>`_,
`#3563 <https://github.com/fmtlib/fmt/pull/3563>`_).
Thanks `@joycebrum (Joyce) <https://github.com/joycebrum>`_,
`@glebm (Gleb Mazovetskiy) <https://github.com/glebm>`_,
`@phprus (Vladislav Shchapov) <https://github.com/phprus>`_,
`@petrmanek (Petr Mánek) <https://github.com/petrmanek>`_,
`@setoye (Alta) <https://github.com/setoye>`_,
`@abouvier (Alexandre Bouvier) <https://github.com/abouvier>`_.

* Fixed various warnings and compilation issues
(`#3444 <https://github.com/fmtlib/fmt/issues/3444>`_,
`#3446 <https://github.com/fmtlib/fmt/pull/3446>`_).
Thanks `@adesitter (Arnaud Desitter) <https://github.com/adesitter>`_.
(`#3408 <https://github.com/fmtlib/fmt/issues/3408>`_,
`#3424 <https://github.com/fmtlib/fmt/issues/3424>`_,
`#3444 <https://github.com/fmtlib/fmt/issues/3444>`_,
`#3446 <https://github.com/fmtlib/fmt/pull/3446>`_,
`#3475 <https://github.com/fmtlib/fmt/pull/3475>`_,
`#3482 <https://github.com/fmtlib/fmt/pull/3482>`_,
`#3492 <https://github.com/fmtlib/fmt/issues/3492>`_,
`#3493 <https://github.com/fmtlib/fmt/pull/3493>`_,
`#3508 <https://github.com/fmtlib/fmt/pull/3508>`_,
`#3509 <https://github.com/fmtlib/fmt/issues/3509>`_,
`#3533 <https://github.com/fmtlib/fmt/issues/3533>`_,
`#3542 <https://github.com/fmtlib/fmt/pull/3542>`_,
`#3543 <https://github.com/fmtlib/fmt/issues/3543>`_,
`#3540 <https://github.com/fmtlib/fmt/issues/3540>`_,
`#3544 <https://github.com/fmtlib/fmt/pull/3544>`_,
`#3548 <https://github.com/fmtlib/fmt/issues/3548>`_,
`#3549 <https://github.com/fmtlib/fmt/pull/3549>`_,
`#3550 <https://github.com/fmtlib/fmt/pull/3550>`_,
`#3552 <https://github.com/fmtlib/fmt/pull/3552>`_).
Thanks `@adesitter (Arnaud Desitter) <https://github.com/adesitter>`_,
`@hmbj (Hans-Martin B. Jensen) <https://github.com/hmbj>`_,
`@Minty-Meeo <https://github.com/Minty-Meeo>`_,
`@phprus (Vladislav Shchapov) <https://github.com/phprus>`_,
`@TobiSchluter (Tobias Schlüter) <https://github.com/TobiSchluter>`_,
`@kieranclancy (Kieran Clancy) <https://github.com/kieranclancy>`_,
`@alexeedm (Dmitry Alexeev) <https://github.com/alexeedm>`_,
`@jurihock (Jürgen Hock) <https://github.com/jurihock>`_,
`@Ozomahtli <https://github.com/Ozomahtli>`_,
`@razaqq <https://github.com/razaqq>`_.

10.0.0 - 2023-05-09
-------------------
Expand Down
2 changes: 1 addition & 1 deletion include/fmt/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <type_traits>

// The fmt library version in the form major * 10000 + minor * 100 + patch.
#define FMT_VERSION 100001
#define FMT_VERSION 100100

#if defined(__clang__) && !defined(__ibmxl__)
# define FMT_CLANG_VERSION (__clang_major__ * 100 + __clang_minor__)
Expand Down
5 changes: 3 additions & 2 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ class basic_memory_buffer final : public detail::buffer<T> {
private:
T store_[SIZE];

// Don't inherit from Allocator avoid generating type_info for it.
// Don't inherit from Allocator to avoid generating type_info for it.
FMT_NO_UNIQUE_ADDRESS Allocator alloc_;

// Deallocate memory allocated by the buffer.
Expand Down Expand Up @@ -3178,7 +3178,8 @@ FMT_CONSTEXPR20 inline void format_dragon(basic_fp<uint128_t> value,
}
if (buf[0] == overflow) {
buf[0] = '1';
++exp10;
if ((flags & dragon::fixed) != 0) buf.push_back('0');
else ++exp10;
}
return;
}
Expand Down
7 changes: 7 additions & 0 deletions support/rst2md.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ def visit_table(self, node):
def depart_table(self, node):
pass

def visit_system_message(self, node):
pass

def depart_system_message(self, node):
pass


class MDWriter(writers.Writer):
"""GitHub-flavored markdown writer"""

Expand Down
1 change: 1 addition & 0 deletions test/format-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1472,6 +1472,7 @@ TEST(format_test, format_long_double) {
EXPECT_EQ("0", fmt::format("{0:}", 0.0l));
EXPECT_EQ("0.000000", fmt::format("{0:f}", 0.0l));
EXPECT_EQ("0.0", fmt::format("{:.1f}", 0.000000001l));
EXPECT_EQ("0.10", fmt::format("{:.2f}", 0.099l));
EXPECT_EQ("392.65", fmt::format("{0:}", 392.65l));
EXPECT_EQ("392.65", fmt::format("{0:g}", 392.65l));
EXPECT_EQ("392.65", fmt::format("{0:G}", 392.65l));
Expand Down

0 comments on commit a098c64

Please sign in to comment.