[PATCH] Fix version namespace build
Jonathan Wakely
jwakely@redhat.com
Thu Feb 11 15:23:13 GMT 2021
On 09/02/21 22:05 +0100, François Dumont via Libstdc++ wrote:
> libstdc++: Fix versioned namespace build
>
> libstdc++-v3/ChangeLog:
>
> * libsupc++/eh_ptr.cc (exception_ptr(__safe_bool)): Define if
> _GLIBCXX_EH_PTR_COMPAT is defined.
> (exception_ptr::_M_safe_bool_dummy()): Likewise.
> (exception_ptr::operator!()): Likewise.
> (exception_ptr::opeerator __safe_bool()): Likewise.
>
>Ok to commit ?
No, this is not correct. Those functions are declared in the
header if included from C++98 code:
#if (__cplusplus < 201103L) || defined (_GLIBCXX_EH_PTR_COMPAT)
typedef void (exception_ptr::*__safe_bool)();
// For construction from nullptr or 0.
exception_ptr(__safe_bool) _GLIBCXX_USE_NOEXCEPT;
#endif
With your change, C++98 code that calls those functions will be unable
to link to libstdc++.so.8 because the functions won't be defined in
the library.
The simplest fix would be to revert this change:
--- a/libstdc++-v3/libsupc++/eh_ptr.cc
+++ b/libstdc++-v3/libsupc++/eh_ptr.cc
@@ -25,7 +25,12 @@
#include <bits/c++config.h>
#include "eh_atomics.h"
+#if ! _GLIBCXX_INLINE_VERSION
+// This macro causes exception_ptr to declare an older API (with corresponding
+// definitions in this file) and to mark some inline functions as "used" so
+// that definitions will be emitted in this translation unit.
#define _GLIBCXX_EH_PTR_COMPAT
+#endif
#include <exception>
#include <bits/exception_ptr.h>
But that leaves the unwanted operator== definitions in libstdc++.so.8
so the attached patch (only tested with unversioned namespace) is
probably what we want to do. Does it fix the problem?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 1657 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20210211/95cb95a4/attachment.bin>
More information about the Libstdc++
mailing list