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

--- Comment #10 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:8ad5968a8dcb472cbff8e4c48217fd65e125b2f2

commit r16-2063-g8ad5968a8dcb472cbff8e4c48217fd65e125b2f2
Author: XU Kailiang <xu2k...@outlook.com>
Date:   Wed Jul 2 15:10:29 2025 +0800

    libstdc++: Format chrono %a/%A/%b/%h/%B/%p using locale's time_put
[PR117214]

    C++ formatting locale could have a custom time_put that performs
    differently from the C locale, so do not use __timepunct directly,
    instead all of above specifiers use _M_locale_fmt.

    For %a/%A/%b/%h/%B, the code handling the exception is now moved
    to the _M_check_ok function, that is invoked before handling of the
    conversion specifier. For time_points the values of months/weekday
    are computed, and thus are always ok(), this information is indicated
    by new _M_time_point member of the _ChronoSpec.

    The different behavior of j specifier for durations and
time_points/calendar
    types, is now handled using only _ChronoParts, and _M_time_only in
_ChronoSpec
    is no longer needed, thus it was removed.

            PR libstdc++/117214

    libstdc++-v3/ChangeLog:

            * include/bits/chrono_io.h (_ChronoSpec::_M_time_only): Remove.
            (_ChronoSpec::_M_time_point): Define.
            (__formatter_chrono::_M_parse): Use __parts to determine
            interpretation of j.
            (__formatter_chrono::_M_check_ok): Define.
            (__formatter_chrono::_M_format_to): Invoke _M_check_ok.
            (__formatter_chrono::_M_a_A, __formatter_chrono::_M_b_B): Move
            exception throwing to _M_check_ok.
            (__formatter_chrono::_M_j): Use _M_needs to define interpretation.
            (__formatter_duration::_S_spec_for): Set _M_time_point.
            * testsuite/std/time/format/format.cc: Test for exception for !ok()
            months/weekday.
            * testsuite/std/time/format/pr117214_custom_timeput.cc: New
            test.

    Co-authored-by: Tomasz Kaminski <tkami...@redhat.com>
    Reviewed-by: Jonathan Wakely <jwak...@redhat.com>
    Signed-off-by: XU Kailiang <xu2k...@outlook.com>
    Signed-off-by: Tomasz Kaminski <tkami...@redhat.com>

Reply via email to