From patchwork Tue May 17 10:45:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 54093 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 208DC3857C71 for ; Tue, 17 May 2022 10:46:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 208DC3857C71 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1652784388; bh=Rp9vYs1z+0IEeZ5xCBFwdYCb0KOjW3qs/OS3bSSeXus=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=KlrcCiedxguvAdDPgnP7aOJI1hJ2aYZzuR9uNyo+eJNaJhkiDd9ji1X4aXb0K6Pmc npiIhVmE8buiolItswbucNia0/6+hgZIpLDQNrPz20n6lbNoD7/jYHFC2rVg53+aZh g3HS0C3Mq/aWbb/7vFMxIzoTu0pXMb7habgpqehQ= 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 61B313858C51 for ; Tue, 17 May 2022 10:45:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 61B313858C51 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-433-iWXwDnyfO9S3QaUtvZRoSQ-1; Tue, 17 May 2022 06:45:54 -0400 X-MC-Unique: iWXwDnyfO9S3QaUtvZRoSQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 60FA9100BAA0; Tue, 17 May 2022 10:45:54 +0000 (UTC) Received: from localhost (unknown [10.33.36.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2558C40D1B99; Tue, 17 May 2022 10:45:54 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Stop defining C++0x compat symbols for versioned namespace Date: Tue, 17 May 2022 11:45:53 +0100 Message-Id: <20220517104553.106577-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Cc: =?utf-8?q?Fran=C3=A7ois_Dumont?= Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Tested x86_64-linux, --enable-symvers=gnu and --enable-symvers=gnu-versioned-namespace. Pushed to trunk. -- >8 -- The src/c++11/compatibility*-c++0x.cc files define symbols that need to be exported for ancient versions of libstdc++.so.6 due to changes between C++0x and the final C++11 standard. Those symbols are not needed in the libstdc++.so.8 library, and we can skip building them entirely. This also fixes the build failure I introduced last week when making the versioned namespace config not use the _V2 namespace for compat symbols. libstdc++-v3/ChangeLog: * src/Makefile.am [ENABLE_SYMVERS_GNU_NAMESPACE] (cxx11_sources): Do not build the compatibility*-c++0x.cc objects. * src/Makefile.in: Regenerate. * src/c++11/compatibility-c++0x.cc [_GLIBCXX_INLINE_VERSION]: Refuse to build for the versioned namespace. * src/c++11/compatibility-chrono.cc: Likewise. * src/c++11/compatibility-condvar.cc: Likewise. * src/c++11/compatibility-thread-c++0x.cc: Likewise. * src/c++11/chrono.cc (system_clock, steady_clock): Use macros to define in inline namespace _V2, matching the declarations in . * src/c++11/system_error.cc (system_category, generic_category): Likewise. --- libstdc++-v3/src/Makefile.am | 16 +++++++--- libstdc++-v3/src/Makefile.in | 31 ++++++++++++------- libstdc++-v3/src/c++11/chrono.cc | 5 ++- libstdc++-v3/src/c++11/compatibility-c++0x.cc | 4 +++ .../src/c++11/compatibility-chrono.cc | 4 +++ .../src/c++11/compatibility-condvar.cc | 4 +++ .../src/c++11/compatibility-thread-c++0x.cc | 4 +++ libstdc++-v3/src/c++11/system_error.cc | 10 ++++-- 8 files changed, 55 insertions(+), 23 deletions(-) diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am index 9c3f4aca655..b83c222d51d 100644 --- a/libstdc++-v3/src/Makefile.am +++ b/libstdc++-v3/src/Makefile.am @@ -96,6 +96,16 @@ else ldbl_alt128_compat_sources = endif +if ENABLE_SYMVERS_GNU_NAMESPACE +cxx0x_compat_sources = +else +cxx0x_compat_sources = \ + compatibility-atomic-c++0x.cc \ + compatibility-c++0x.cc \ + compatibility-chrono.cc \ + compatibility-condvar.cc \ + compatibility-thread-c++0x.cc +endif parallel_compat_sources = \ compatibility-parallel_list.cc compatibility-parallel_list-2.cc @@ -108,11 +118,7 @@ cxx98_sources = \ ${ldbl_compat_sources} cxx11_sources = \ - compatibility-c++0x.cc \ - compatibility-atomic-c++0x.cc \ - compatibility-thread-c++0x.cc \ - compatibility-chrono.cc \ - compatibility-condvar.cc \ + ${cxx0x_compat_sources} \ ${ldbl_alt128_compat_sources} libstdc___la_SOURCES = $(cxx98_sources) $(cxx11_sources) diff --git a/libstdc++-v3/src/c++11/chrono.cc b/libstdc++-v3/src/c++11/chrono.cc index 6825b5bc4bf..5539d8cbedd 100644 --- a/libstdc++-v3/src/c++11/chrono.cc +++ b/libstdc++-v3/src/c++11/chrono.cc @@ -43,8 +43,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace chrono { - // XXX GLIBCXX_ABI Deprecated - inline namespace _V2 { +_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2) constexpr bool system_clock::is_steady; @@ -94,7 +93,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif } - } // end inline namespace _V2 +_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) } // namespace chrono _GLIBCXX_END_NAMESPACE_VERSION diff --git a/libstdc++-v3/src/c++11/compatibility-c++0x.cc b/libstdc++-v3/src/c++11/compatibility-c++0x.cc index d48f5bd1e28..768dd666d00 100644 --- a/libstdc++-v3/src/c++11/compatibility-c++0x.cc +++ b/libstdc++-v3/src/c++11/compatibility-c++0x.cc @@ -40,6 +40,10 @@ # error "compatibility-c++0x.cc must be compiled with -std=gnu++0x" #endif +#if _GLIBCXX_INLINE_VERSION +# error "compatibility-thread-c++0x.cc is not needed for gnu-versioned-namespace" +#endif + #ifdef _GLIBCXX_SHARED namespace std _GLIBCXX_VISIBILITY(default) diff --git a/libstdc++-v3/src/c++11/compatibility-chrono.cc b/libstdc++-v3/src/c++11/compatibility-chrono.cc index 38b96e811fb..6beb8b39a25 100644 --- a/libstdc++-v3/src/c++11/compatibility-chrono.cc +++ b/libstdc++-v3/src/c++11/compatibility-chrono.cc @@ -24,6 +24,10 @@ #include +#if _GLIBCXX_INLINE_VERSION +# error "compatibility-thread-c++0x.cc is not needed for gnu-versioned-namespace" +#endif + #ifdef _GLIBCXX_USE_C99_STDINT_TR1 #ifdef _GLIBCXX_USE_GETTIMEOFDAY diff --git a/libstdc++-v3/src/c++11/compatibility-condvar.cc b/libstdc++-v3/src/c++11/compatibility-condvar.cc index ea3e11efeda..e3a8b8403ca 100644 --- a/libstdc++-v3/src/c++11/compatibility-condvar.cc +++ b/libstdc++-v3/src/c++11/compatibility-condvar.cc @@ -28,6 +28,10 @@ # error "compatibility-condvar-c++0x.cc must be compiled with -std=gnu++11" #endif +#if _GLIBCXX_INLINE_VERSION +# error "compatibility-thread-c++0x.cc is not needed for gnu-versioned-namespace" +#endif + #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) #define condition_variable_any condition_variable_anyXX diff --git a/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc b/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc index dbacda2bc44..d920f9f0345 100644 --- a/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc +++ b/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc @@ -35,6 +35,10 @@ # error "compatibility-thread-c++0x.cc must be compiled with -std=gnu++0x" #endif +#if _GLIBCXX_INLINE_VERSION +# error "compatibility-thread-c++0x.cc is not needed for gnu-versioned-namespace" +#endif + #define _GLIBCXX_ASM_SYMVER(cur, old, version) \ asm (".symver " #cur "," #old "@@@" #version); diff --git a/libstdc++-v3/src/c++11/system_error.cc b/libstdc++-v3/src/c++11/system_error.cc index 7b1a5a20637..8c13642408d 100644 --- a/libstdc++-v3/src/c++11/system_error.cc +++ b/libstdc++-v3/src/c++11/system_error.cc @@ -526,11 +526,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION error_category::~error_category() = default; - const error_category& - _V2::system_category() noexcept { return system_category_instance.obj; } +_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2) const error_category& - _V2::generic_category() noexcept { return generic_category_instance.obj; } + system_category() noexcept { return system_category_instance.obj; } + + const error_category& + generic_category() noexcept { return generic_category_instance.obj; } + +_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) system_error::~system_error() = default;