[committed v5] libstdc++: fix __cpp_lib_chrono for old-ABI-only builds
Jonathan Wakely
jwakely@redhat.com
Wed Oct 14 13:39:45 GMT 2026
On Wed, 14 Oct 2026 at 14:33, Jonathan Wakely <jwakely@redhat.com> wrote:
>
> On Wed, 14 Oct 2026 at 11:14, Jonathan Wakely <jwakely@redhat.com> wrote:
> >
> > From: Hugo Beauzée-Luyssen <hugo.beauzee@datadoghq.com>
> >
> > The C++20 chrono time zone API is declared when
> > _GLIBCXX_USE_CXX11_ABI || !_GLIBCXX_USE_DUAL_ABI, but
> > __cpp_lib_chrono only gets its C++20 value when
> > _GLIBCXX_USE_CXX11_ABI is set. Old-ABI-only builds therefore get
> > the full API but report the C++17 value.
> >
> > Widen the condition for the 201907 value to match, and make the
> > headers check __cpp_lib_chrono instead of repeating the ABI
> > condition.
> >
> > Assisted-by: Claude (claude-sonnet-5)
> >
> > libstdc++-v3/ChangeLog:
> >
> > * include/bits/chrono_io.h: Check __glibcxx_chrono for C++20
> > tzdb features instead of the ABI macros.
> > * include/bits/version.def (chrono): Use extra_cond instead of
> > cxx11abi to also define 201907 for old-ABI-only builds.
> > * include/bits/version.h: Regenerate.
> > * include/std/chrono: Check __cpp_lib_chrono instead of the
> > ABI macros.
> > * testsuite/lib/libstdc++.exp (check_effective_target_tzdb):
> > Replace cxx11_abi check with hosted check and check
> > __cpp_lib_chrono in preprocessor condition.
> > * testsuite/libstdc++-prettyprinters/chrono.cc: Use
> > __cpp_lib_chrono for preprocessor condition and use tzdb for
> > effective target. Remove dg-additional-options.
> > * testsuite/std/time/format/data_not_present_neg.cc: Use
> > __cpp_lib_chrono for preprocessor conditions and use tzdb for
> > effective target.
> > * testsuite/std/time/format/empty_spec.cc: Use __cpp_lib_chrono
> > for preprocessor conditions.
> > * testsuite/std/time/format/nonlocking.cc: Likewise.
> > * testsuite/std/time/format/pr117214.cc: Likewise.
> > * testsuite/std/time/format/pr119517.cc: Likewise.
> > * testsuite/std/time/format/whitespace.cc: Likewise.
> > * testsuite/std/time/hash.cc: Likewise.
> > * testsuite/std/time/syn_c++20.cc: Fix typo in macro name and
> > expect new value for !_GLIBCXX_USE_DUAL_ABI.
> > * testsuite/std/time/tzdb/1.cc: Require tzdb effective target
> > instead of cxx11_abi.
> > * testsuite/std/time/tzdb_list/requirements.cc: Likewise.
> > * testsuite/std/time/zoned_time/deduction.cc: Likewise.
> > * testsuite/std/time/zoned_time/io.cc: Likewise.
> > * testsuite/std/time/zoned_time/req_neg.cc: Likewise.
> > * testsuite/std/time/zoned_time/requirements.cc: Likewise.
> > * testsuite/std/time/zoned_traits.cc: Likewise.
> >
> > Signed-off-by: Hugo Beauzée-Luyssen <hugo.beauzee@datadoghq.com>
> > Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
> > ---
> >
> > Tested x86_64-linux, with the default configuration and also with
> > --with-default-libstdcxx-abi=gcc4-compatible --disable-libstdcxx-dual-abi
> >
> > Pushed to trunk. This also needs to be backported. The build failure
> > with the only-old-abi config exists on at least gcc-16, and probably
> > older branches too (I didn't check yet).
>
> It looks like this was only a problem for gcc-16 and trunk, the
> only-old-abi config builds fine on gcc-14 and gcc-15.
Probably broken by r16-3416-g806de30f51c8b9 and then not properly
fixed by r16-3535-g381dbd4a956452
More information about the Libstdc++
mailing list