From patchwork Thu Jun 20 15:25:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1950244 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZZ+PEBm0; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W4krS4mwHz20X8 for ; Fri, 21 Jun 2024 01:27:33 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EAD203892474 for ; Thu, 20 Jun 2024 15:27:31 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id BBC0A3890431 for ; Thu, 20 Jun 2024 15:27:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BBC0A3890431 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BBC0A3890431 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718897233; cv=none; b=NpSNux+okcxyg0PgmvMbcx/2hokxBqE2goQolLUJ+FnQCTDKWQEie1jObeuub4xQex9OaJpBNU7tP9iKi+VR52tZUSdcFtk+nOXUOA+uaFtdIvof14gehJh2kaOGoEX9uea3ciDItrES1Pd+piE3IYCQ3Pp5swXX+x5mkTplVHc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718897233; c=relaxed/simple; bh=+gfhy28tQiH6BJ4AIXYp98hBgmPNJq0tNIPLroN7MV0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=PGbsxhDLU4T+EPI+aF6uz0Z8HVFYN6hbX5mLE+sRfLbbVfpMxev55vGZref5oxoiK6+etcDGk62iIn0vMc4CpbvkqgnLf+pcXqHHGUq04FmzTyrB3IAwCrYxRm/7GHNmUUzGXzLWnq5K7FKSIbyjOuZIKvJkrqztt43gWb0WuiM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718897231; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SAR9jcVv9YcsNd3fWBIXCMwRUfmBT7Z6qfck44KXQZA=; b=ZZ+PEBm0IbA6hjWN644+/ujmsiSelkhaJMFPXATzZKWY99hbeoKLIjbHGBhgZfR4Fd+amf PUtQZUKVfusecwEOKIK51RWntfsUscVG3hAUbzx6xmhEIEULWoKoQehIohv3W4V87bStWE zlErGXYQeF5s/PcGixqejYx0GMHY5Jo= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-177-jKAfwBvDPDmGYFVzsFxFRQ-1; Thu, 20 Jun 2024 11:27:08 -0400 X-MC-Unique: jKAfwBvDPDmGYFVzsFxFRQ-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1466A19560A6; Thu, 20 Jun 2024 15:27:07 +0000 (UTC) Received: from localhost (unknown [10.42.28.182]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6586019560AE; Thu, 20 Jun 2024 15:27:03 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] libstdc++: Fix __cpp_lib_chrono for old std::string ABI Date: Thu, 20 Jun 2024 16:25:18 +0100 Message-ID: <20240620152702.2019696-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-9.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, LIKELY_SPAM_BODY, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RCVD_IN_SBL_CSS, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org This unfortunately means we can never increase __cpp_lib_chrono again for the old string ABI, but I don't see any alternative (except supporting chrono::tzdb for the old string, which will be a lot of work that I don't want to do!) -- >8 -- The header is incomplete for the old std::string ABI, because std::chrono::tzdb is only defined for the new ABI. The feature test macro advertising full C++20 support should not be defined for the old ABI. libstdc++-v3/ChangeLog: * include/bits/version.def (chrono): Add cxx11abi = yes. * include/bits/version.h: Regenerate. * testsuite/std/time/syn_c++20.cc: Adjust expected value for the feature test macro. --- libstdc++-v3/include/bits/version.def | 1 + libstdc++-v3/include/bits/version.h | 2 +- libstdc++-v3/testsuite/std/time/syn_c++20.cc | 11 +++++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def index 683b967d54b..42cdef2f526 100644 --- a/libstdc++-v3/include/bits/version.def +++ b/libstdc++-v3/include/bits/version.def @@ -574,6 +574,7 @@ ftms = { v = 201907; cxxmin = 20; hosted = yes; + cxx11abi = yes; // std::chrono::tzdb requires cxx11 std::string }; values = { v = 201611; diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h index 4850041c0a3..1eaf3733bc2 100644 --- a/libstdc++-v3/include/bits/version.h +++ b/libstdc++-v3/include/bits/version.h @@ -639,7 +639,7 @@ #undef __glibcxx_want_boyer_moore_searcher #if !defined(__cpp_lib_chrono) -# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED +# if (__cplusplus >= 202002L) && _GLIBCXX_USE_CXX11_ABI && _GLIBCXX_HOSTED # define __glibcxx_chrono 201907L # if defined(__glibcxx_want_all) || defined(__glibcxx_want_chrono) # define __cpp_lib_chrono 201907L diff --git a/libstdc++-v3/testsuite/std/time/syn_c++20.cc b/libstdc++-v3/testsuite/std/time/syn_c++20.cc index f0b86199e9d..4a527262e9d 100644 --- a/libstdc++-v3/testsuite/std/time/syn_c++20.cc +++ b/libstdc++-v3/testsuite/std/time/syn_c++20.cc @@ -20,9 +20,16 @@ #include +// std::chrono::tzdb is not defined for the old std::string ABI. +#if _GLIBCXX_USE_CXX_ABI +# define EXPECTED_VALUE 201907L +#else +# define EXPECTED_VALUE 201611L +#endif + #ifndef __cpp_lib_chrono # error "Feature test macro for chrono is missing in " -#elif __cpp_lib_chrono < 201907L +#elif __cpp_lib_chrono < EXPECTED_VALUE # error "Feature test macro for chrono has wrong value in " #endif @@ -94,7 +101,7 @@ namespace __gnu_test using std::chrono::make12; using std::chrono::make24; -#if _GLIBCXX_USE_CXX11_ABI +#if __cpp_lib_chrono >= 201803L using std::chrono::tzdb; using std::chrono::tzdb_list; using std::chrono::get_tzdb;