From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id 9F7EF3858D28 for ; Sat, 14 May 2022 15:36:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9F7EF3858D28 Received: by mail-wr1-x42f.google.com with SMTP id j25so13936760wrc.9 for ; Sat, 14 May 2022 08:36:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to; bh=MJHJ494giSnd+ZKq55NgRUK0hu5wKNJJId4Z4A9/TEI=; b=IHhCMPzrgV4liNGI+5IIx3mh+jkS+3y2pal1ZNf1zijBVvb+zd3dW4WEy5zw4sNFYT gATk9/7nNnXy7twUxytNB8PkzHlJdcacBbZOpmnUdhsLIcvUfj6TNUwgyofjwh+JzqDI 5JyFzw/V/0tZu6/IHQEvgmsCM6ifzpLVsFeA62FpZoXzr4c7PbqygzWqQlIts1ntFvOE sCyAal6yHM/vm09Luqa4FOle6AAGNXdbC3edJbUy4SksIpYe+g1HVntZoEbUXxVne86L LRvhcnPHndrD2ZKF9P5DCf9XZVpA1wg8tDYwVuifC7dpGA1zfa1sT6OtTSMbd4UUQLFE aU2g== X-Gm-Message-State: AOAM532ygUvThHqlsc2vUO7qkDwpq7THDkG9vgPsCVLRjed0ArY1rsm3 EyoLAY6gi6LucBD/uaxK/y7yyN8g7YU= X-Google-Smtp-Source: ABdhPJxhyzHS8NrsW4nRqXpo+Q9f9RG0ow++nF/3LMdS+FzZxeBB5qCQyEfcLku8IED6q7Ed+Hmktg== X-Received: by 2002:a05:6000:144c:b0:20c:9156:539c with SMTP id v12-20020a056000144c00b0020c9156539cmr8261796wrx.249.1652542585937; Sat, 14 May 2022 08:36:25 -0700 (PDT) Received: from ?IPV6:2a01:e0a:1dc:b1c0:49f9:77a5:bf8e:e1cd? ([2a01:e0a:1dc:b1c0:49f9:77a5:bf8e:e1cd]) by smtp.googlemail.com with ESMTPSA id q4-20020adf9dc4000000b0020c6b78eb5asm4763893wre.68.2022.05.14.08.36.24 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 14 May 2022 08:36:25 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------XzlXC3ePlls76pB3p9TAovh4" Message-ID: <65a5eb4c-8c9e-4bc6-846a-a06b1f6d5c1e@gmail.com> Date: Sat, 14 May 2022 17:36:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [committed 03/12] libstdc++: Add macros for the inline namespace std::_V2 Content-Language: fr To: libstdc++@gcc.gnu.org References: <20220513124050.4028450-1-jwakely@redhat.com> <20220513124050.4028450-3-jwakely@redhat.com> From: =?UTF-8?Q?Fran=c3=a7ois_Dumont?= In-Reply-To: <20220513124050.4028450-3-jwakely@redhat.com> X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_NUMSUBJECT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2022 15:36:30 -0000 This is a multi-part message in MIME format. --------------XzlXC3ePlls76pB3p9TAovh4 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Versioned namespace does not compile after this patch. With this patch it compiles but does not link because of: /usr/bin/ld: /usr/bin/ld: DWARF error: can't find .debug_ranges section. ../src/c++11/.libs/libc++11convenience.a(chrono.o): in function `std::__8::chrono::system_clock::now()': chrono.cc:(.text._ZNSt3__86chrono12system_clock3nowEv+0x0): multiple definition of `std::__8::chrono::system_clock::now()'; /usr/bin/ld: DWARF error: can't find .debug_ranges section. .libs/compatibility-chrono.o:compatibility-chrono.cc:(.text._ZNSt3__86chrono12system_clock3nowEv+0x0): first defined here /usr/bin/ld: ../src/c++11/.libs/libc++11convenience.a(chrono.o):(.rodata._ZNSt3__86chrono12system_clock9is_steadyE+0x0): multiple definition of `std::__8::chrono::system_clock::is_steady'; .libs/compatibility-chrono.o:(.rodata._ZNSt3__86chrono12system_clock9is_steadyE+0x0): first defined here /usr/bin/ld: /usr/bin/ld: DWARF error: can't find .debug_ranges section. ../src/c++11/.libs/libc++11convenience.a(system_error.o): in function `std::__8::error_category::default_error_condition(int) const': system_error.cc:(.text._ZNKSt3__814error_category23default_error_conditionEi+0x0): multiple definition of `std::__8::error_category::default_error_condition(int) const'; /usr/bin/ld: DWARF error: can't find .debug_ranges section. .libs/compatibility-c++0x.o:compatibility-c++0x.cc:(.text._ZNKSt3__814error_category23default_error_conditionEi+0x0): first defined here /usr/bin/ld: ../src/c++11/.libs/libc++11convenience.a(system_error.o): in function `std::__8::error_category::equivalent(int, std::__8::error_condition const&) const': system_error.cc:(.text._ZNKSt3__814error_category10equivalentEiRKNS_15error_conditionE+0x0): multiple definition of `std::__8::error_category::equivalent(int, std::__8::error_condition const&) const'; .libs/compatibility-c++0x.o:compatibility-c++0x.cc:(.text._ZNKSt3__814error_category10equivalentEiRKNS_15error_conditionE+0x0): first defined here /usr/bin/ld: ../src/c++11/.libs/libc++11convenience.a(system_error.o): in function `std::__8::error_category::equivalent(std::__8::error_code const&, int) const': system_error.cc:(.text._ZNKSt3__814error_category10equivalentERKNS_10error_codeEi+0x0): multiple definition of `std::__8::error_category::equivalent(std::__8::error_code const&, int) const'; .libs/compatibility-c++0x.o:compatibility-c++0x.cc:(.text._ZNKSt3__814error_category10equivalentERKNS_10error_codeEi+0x0): first defined here /usr/bin/ld: ../src/c++11/.libs/libc++11convenience.a(system_error.o): in function `std::__8::error_category::~error_category()': system_error.cc:(.text._ZNSt3__814error_categoryD2Ev+0x0): multiple definition of `std::__8::error_category::~error_category()'; .libs/compatibility-c++0x.o:compatibility-c++0x.cc:(.text._ZNSt3__814error_categoryD2Ev+0x0): first defined here /usr/bin/ld: ../src/c++11/.libs/libc++11convenience.a(system_error.o): in function `std::__8::error_category::~error_category()': system_error.cc:(.text._ZNSt3__814error_categoryD2Ev+0x0): multiple definition of `std::__8::error_category::~error_category()'; .libs/compatibility-c++0x.o:compatibility-c++0x.cc:(.text._ZNSt3__814error_categoryD2Ev+0x0): first defined here /usr/bin/ld: ../src/c++11/.libs/libc++11convenience.a(system_error.o): in function `std::__8::error_category::~error_category()': system_error.cc:(.text._ZNSt3__814error_categoryD0Ev+0x0): multiple definition of `std::__8::error_category::~error_category()'; .libs/compatibility-c++0x.o:compatibility-c++0x.cc:(.text._ZNSt3__814error_categoryD0Ev+0x0): first defined here /usr/bin/ld: ../src/c++11/.libs/libc++11convenience.a(system_error.o): in function `std::__8::system_category()': system_error.cc:(.text._ZNSt3__815system_categoryEv+0x0): multiple definition of `std::__8::system_category()'; .libs/compatibility-c++0x.o:compatibility-c++0x.cc:(.text._ZNSt3__815system_categoryEv+0x0): first defined here /usr/bin/ld: ../src/c++11/.libs/libc++11convenience.a(system_error.o): in function `std::__8::generic_category()': system_error.cc:(.text._ZNSt3__816generic_categoryEv+0x0): multiple definition of `std::__8::generic_category()'; .libs/compatibility-c++0x.o:compatibility-c++0x.cc:(.text._ZNSt3__816generic_categoryEv+0x0): first defined here On 13/05/22 14:40, Jonathan Wakely via Libstdc++ wrote: > Tested powerpc64le-linux, pushed to trunk. > > Unlike the rest of the series, this isn't suitable for backporting > because it changes the ABI for the gnu-versioned-namespace build. That's > fine for GCC 13, but not OK to change within a release branch, e.g. > between 12.1 and 12.2. If we want to backport it, the macro should do > the same thing whether or not _GLIBCXX_INLINE_VERSION is set. > > -- >8 -- > > Use macros to open and close the inline namespace _V2 that is used for > ABI versioning of individual components such as chrono::system_clock. > > This allows the namespace to be hidden in the docs generated by Doxygen, > so that we document std::foo instead of std::_V2::foo. > > This also makes it easy to remove that namespace entirely for the > gnu-versioned-namespace build, where everything is already versioned as > std::__8 and there are no backwards compatibility guarantees. > > libstdc++-v3/ChangeLog: > > * doc/doxygen/user.cfg.in (PREDEFINED): Expand new macros to > nothing. > * include/bits/c++config (_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE) > (_GLIBCXX_END_INLINE_ABI_NAMESPACE): Define new macros. > * include/bits/algorithmfwd.h (_V2::__rotate): Use new macros > for the namespace. > * include/bits/chrono.h (chrono::_V2::system_clock): Likewise. > * include/bits/stl_algo.h (_V2::__rotate): Likewise. > * include/std/condition_variable (_V2::condition_variable_any): > Likewise. > * include/std/system_error (_V2::error_category): Likewise. > --- > libstdc++-v3/doc/doxygen/user.cfg.in | 2 ++ > libstdc++-v3/include/bits/algorithmfwd.h | 15 ++++++++------- > libstdc++-v3/include/bits/c++config | 11 +++++++++-- > libstdc++-v3/include/bits/chrono.h | 4 ++-- > libstdc++-v3/include/bits/stl_algo.h | 5 ++--- > libstdc++-v3/include/std/condition_variable | 4 ++-- > libstdc++-v3/include/std/system_error | 5 +++-- > 7 files changed, 28 insertions(+), 18 deletions(-) > > diff --git a/libstdc++-v3/doc/doxygen/user.cfg.in b/libstdc++-v3/doc/doxygen/user.cfg.in > index b9babc3993e..2dbed727013 100644 > --- a/libstdc++-v3/doc/doxygen/user.cfg.in > +++ b/libstdc++-v3/doc/doxygen/user.cfg.in > @@ -2347,6 +2347,8 @@ PREDEFINED = __cplusplus=202002L \ > "_GLIBCXX_END_NAMESPACE_CONTAINER= " \ > "_GLIBCXX_END_NAMESPACE_CXX11= " \ > "_GLIBCXX_END_NAMESPACE_LDBL= " \ > + "-D_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(X)= " \ > + "-D_GLIBCXX_END_INLINE_ABI_NAMESPACE(X)= " \ > "_GLIBCXX_TEMPLATE_ARGS=... " \ > "_GLIBCXX_DEPRECATED= " \ > "_GLIBCXX_DEPRECATED_SUGGEST(E)= " \ > diff --git a/libstdc++-v3/include/bits/algorithmfwd.h b/libstdc++-v3/include/bits/algorithmfwd.h > index 5271a90b501..aacc34e09e8 100644 > --- a/libstdc++-v3/include/bits/algorithmfwd.h > +++ b/libstdc++-v3/include/bits/algorithmfwd.h > @@ -601,13 +601,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > _OIter > reverse_copy(_BIter, _BIter, _OIter); > > - inline namespace _V2 > - { > - template > - _GLIBCXX20_CONSTEXPR > - _FIter > - rotate(_FIter, _FIter, _FIter); > - } > +_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2) > + > + template > + _GLIBCXX20_CONSTEXPR > + _FIter > + rotate(_FIter, _FIter, _FIter); > + > +_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) > > template > _GLIBCXX20_CONSTEXPR > diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config > index 2798b9786dc..150b0bc5834 100644 > --- a/libstdc++-v3/include/bits/c++config > +++ b/libstdc++-v3/include/bits/c++config > @@ -345,13 +345,16 @@ namespace __gnu_cxx > # define _GLIBCXX_DEFAULT_ABI_TAG > #endif > > -// Defined if inline namespaces are used for versioning. > +// Non-zero if inline namespaces are used for versioning the entire library. > #define _GLIBCXX_INLINE_VERSION > > -// Inline namespace for symbol versioning. > #if _GLIBCXX_INLINE_VERSION > +// Inline namespace for symbol versioning of (nearly) everything in std. > # define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __8 { > # define _GLIBCXX_END_NAMESPACE_VERSION } > +// Unused when everything in std is versioned anyway. > +# define _GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(X) > +# define _GLIBCXX_END_INLINE_ABI_NAMESPACE(X) > > namespace std > { > @@ -376,8 +379,12 @@ _GLIBCXX_END_NAMESPACE_VERSION > } > > #else > +// Unused. > # define _GLIBCXX_BEGIN_NAMESPACE_VERSION > # define _GLIBCXX_END_NAMESPACE_VERSION > +// Used to version individual components, e.g. std::_V2::error_category. > +# define _GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(X) inline namespace X { > +# define _GLIBCXX_END_INLINE_ABI_NAMESPACE(X) } // inline namespace X > #endif > > // Inline namespaces for special modes: debug, parallel. > diff --git a/libstdc++-v3/include/bits/chrono.h b/libstdc++-v3/include/bits/chrono.h > index 421898516ae..745f9a81357 100644 > --- a/libstdc++-v3/include/bits/chrono.h > +++ b/libstdc++-v3/include/bits/chrono.h > @@ -1099,7 +1099,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > // compatibility definitions for previous versions. At some > // point, when these clocks settle down, the inlined namespaces > // can be removed. XXX GLIBCXX_ABI Deprecated > - inline namespace _V2 { > +_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2) > > /** > * @brief System clock. > @@ -1171,7 +1171,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > */ > using high_resolution_clock = system_clock; > > - } // end inline namespace _V2 > +_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) > > #if __cplusplus >= 202002L > /// @addtogroup chrono > diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h > index 1f07b9e6589..6619ff7bf1d 100644 > --- a/libstdc++-v3/include/bits/stl_algo.h > +++ b/libstdc++-v3/include/bits/stl_algo.h > @@ -1190,8 +1190,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > return __m; > } > > - inline namespace _V2 > - { > +_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2) > > /// This is a helper function for the rotate algorithm. > template > @@ -1398,7 +1397,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > std::__iterator_category(__first)); > } > > - } // namespace _V2 > +_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) > > /** > * @brief Copy a sequence, rotating its elements. > diff --git a/libstdc++-v3/include/std/condition_variable b/libstdc++-v3/include/std/condition_variable > index 2a23e65bbd3..06c4ff9ebdd 100644 > --- a/libstdc++-v3/include/std/condition_variable > +++ b/libstdc++-v3/include/std/condition_variable > @@ -234,7 +234,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > void (*_M_cb)(void*); > }; > > - inline namespace _V2 { > +_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2) > > /// condition_variable_any > // Like above, but mutex is not required to have try_lock. > @@ -439,7 +439,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > #endif > }; > > - } // end inline namespace > +_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) > > /// @} group condition_variables > _GLIBCXX_END_NAMESPACE_VERSION > diff --git a/libstdc++-v3/include/std/system_error b/libstdc++-v3/include/std/system_error > index 45a1d283556..dcef94e16e2 100644 > --- a/libstdc++-v3/include/std/system_error > +++ b/libstdc++-v3/include/std/system_error > @@ -77,7 +77,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > #endif // C++17 > /// @} > > - inline namespace _V2 { > +_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2) > > /** @addtogroup diagnostics > * @{ > @@ -168,7 +168,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > _GLIBCXX_CONST const error_category& system_category() noexcept; > > /// @} > - } // end inline namespace > + > +_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) > > /** @addtogroup diagnostics > * @{ --------------XzlXC3ePlls76pB3p9TAovh4 Content-Type: text/x-patch; charset=UTF-8; name="fix_version_namespace_build.patch" Content-Disposition: attachment; filename="fix_version_namespace_build.patch" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2xpYnN0ZGMrKy12My9zcmM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