From: "François Dumont" <frs.dumont@gmail.com>
To: libstdc++@gcc.gnu.org
Subject: Re: [committed 03/12] libstdc++: Add macros for the inline namespace std::_V2
Date: Mon, 16 May 2022 06:27:38 +0200 [thread overview]
Message-ID: <005d0911-4fb6-f14a-a23a-2ff26774bfd6@gmail.com> (raw)
In-Reply-To: <65a5eb4c-8c9e-4bc6-846a-a06b1f6d5c1e@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 13482 bytes --]
Based on what you told me recently maybe this patch is better. It does
not change the link errors.
On 14/05/22 17:36, François Dumont wrote:
> 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<typename _FIter>
>> - _GLIBCXX20_CONSTEXPR
>> - _FIter
>> - rotate(_FIter, _FIter, _FIter);
>> - }
>> +_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2)
>> +
>> + template<typename _FIter>
>> + _GLIBCXX20_CONSTEXPR
>> + _FIter
>> + rotate(_FIter, _FIter, _FIter);
>> +
>> +_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
>> template<typename _FIter, typename _OIter>
>> _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<typename _ForwardIterator>
>> @@ -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
>> * @{
>
[-- Attachment #2: fix_version_namespace_build2.patch --]
[-- Type: text/x-patch, Size: 1780 bytes --]
diff --git a/libstdc++-v3/src/c++11/chrono.cc b/libstdc++-v3/src/c++11/chrono.cc
index 6825b5bc4bf..e52211d9aab 100644
--- a/libstdc++-v3/src/c++11/chrono.cc
+++ b/libstdc++-v3/src/c++11/chrono.cc
@@ -39,13 +39,8 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
namespace chrono
{
- // XXX GLIBCXX_ABI Deprecated
- inline namespace _V2 {
-
constexpr bool system_clock::is_steady;
system_clock::time_point
@@ -93,9 +88,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return time_point(system_clock::now().time_since_epoch());
#endif
}
-
- } // end inline namespace _V2
} // namespace chrono
-
-_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
diff --git a/libstdc++-v3/src/c++11/system_error.cc b/libstdc++-v3/src/c++11/system_error.cc
index 7b1a5a20637..cc2c491cdbb 100644
--- a/libstdc++-v3/src/c++11/system_error.cc
+++ b/libstdc++-v3/src/c++11/system_error.cc
@@ -516,8 +516,6 @@ namespace
namespace std _GLIBCXX_VISIBILITY(default)
{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
void
__throw_system_error(int __i __attribute__((unused)))
{
@@ -527,10 +525,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
error_category::~error_category() = default;
const error_category&
- _V2::system_category() noexcept { return system_category_instance.obj; }
+ system_category() noexcept { return system_category_instance.obj; }
const error_category&
- _V2::generic_category() noexcept { return generic_category_instance.obj; }
+ generic_category() noexcept { return generic_category_instance.obj; }
system_error::~system_error() = default;
@@ -560,6 +558,4 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return {msg.c_str(), msg.length()};
}
#endif
-
-_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
next prev parent reply other threads:[~2022-05-16 4:27 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-13 12:40 [committed 01/12] libstdc++: Disable Doxygen GROUP_NESTED_COMPOUNDS config option Jonathan Wakely
2022-05-13 12:40 ` [committed 02/12] libstdc++: Fix typo in doxygen @headerfile command Jonathan Wakely
2022-05-13 12:40 ` [committed 03/12] libstdc++: Add macros for the inline namespace std::_V2 Jonathan Wakely
2022-05-14 15:36 ` François Dumont
2022-05-16 4:27 ` François Dumont [this message]
2022-05-16 16:19 ` Jonathan Wakely
2022-05-16 17:04 ` François Dumont
2022-05-16 16:13 ` Jonathan Wakely
2022-05-16 16:59 ` François Dumont
2022-05-13 12:40 ` [committed 04/12] libstdc++: Improve doxygen docs for std::pointer_traits Jonathan Wakely
2022-05-13 12:40 ` [committed 05/12] libstdc++: Improve doxygen docs for <system_error> Jonathan Wakely
2022-05-13 12:40 ` [committed 06/12] libstdc++: Improve doxygen docs for <atomic> Jonathan Wakely
2022-05-13 12:40 ` [committed 07/12] libstdc++: Improve doxygen docs for <regex> Jonathan Wakely
2022-05-13 12:40 ` [committed 08/12] libstdc++: Improve doxygen docs for std::allocator Jonathan Wakely
2022-05-13 12:40 ` [committed 09/12] libstdc++: Improve doxygen docs for algorithms and more Jonathan Wakely
2022-05-13 12:40 ` [committed 10/12] libstdc++: Improve doxygen docs for <thread> and <future> Jonathan Wakely
2022-05-13 12:40 ` [committed 11/12] libstdc++: Improve doxygen docs for some of <memory> Jonathan Wakely
2022-05-13 12:40 ` [committed 12/12] libstdc++: Improve doxygen docs for <mutex> Jonathan Wakely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=005d0911-4fb6-f14a-a23a-2ff26774bfd6@gmail.com \
--to=frs.dumont@gmail.com \
--cc=libstdc++@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).