https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110739

--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tomasz Kaminski <tkami...@gcc.gnu.org>:

https://gcc.gnu.org/g:b2b7276a7e114d2e9f76e02b8567b6ce387a2234

commit r16-2251-gb2b7276a7e114d2e9f76e02b8567b6ce387a2234
Author: Tomasz KamiÅski <tkami...@redhat.com>
Date:   Fri Jun 27 15:04:19 2025 +0200

    libstdc++: Format %a/%A/%b/%h/%B/%p without using locale::classic
[PR110739]

    With changes r16-2063-g8ad5968a8dcb47 the _M_a_A, _M_b_B and _M_p functions
    are called only if the locale is equal to the locale::classic(), for which
    the behavior is know. This patch changes they implementation, so instead of
    reffering to __timepunct facet members, they use hardcoded list of English
    weekday, months names. Only one list is needed, as in case of
locale::classic()
    abbreviated name corresponds to first tree letters of the full name.

    For _M_p, _M_r we use a new _M_fill_ampm helper, that fills provided buffer
    with "AM"/"PM" depending on the hours value.

    In _M_S we no longer guard querying of numpuct facet, with check that
requires
    potentially equally expensive construction of locale::classic. We also mark
    localized path as unlikely.

    The _M_locale method is no longer used in __formatter_chrono, and thus was
    moved to __formatter_duration.

            PR libstdc++/110739

    libstdc++-v3/ChangeLog:

            * include/bits/chrono_io.h (__formatter_chrono::_S_weekdays)
            (__formatter_chrono::_S_months, __formatter_chrono::_S_fill_ampm):
            Define.
            (__formatter_chrono::_M_format_to): Do not pass context parameter
            to functions listed below.
            (__formatter_chrono::_M_a_A, __formatter_chrono::_M_b_B): Implement
            using harcoded list of names, and remove format context parameter.
            (__formatter_chrono::_M_p, __formatter_chrono::_M_r): Implement
            using _S_fill_ampm.
            (__formatter_chrono::_M_c): Removed format context parameter.
            (__formatter_chrono::_M_subsecs): Call __ctx.locale() directly,
            instead of _M_locale and do not compare with locale::classic().
            Add [[unlikely]] attributes.
            (__formatter_chrono::_M_locale): Move to __formatter_duration.
            (__formatter_duration::_M_locale): Moved from __formatter_chrono.
  • [Bug libstdc++/110739] std::for... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to