Control: forwarded -1
https://git.codesynthesis.com/cgit/odb/libodb/commit/?id=13dd928ae18ef9610bc820b7b3e65629addea1d2
Control: tags -1 patch
On Wed, Mar 03, 2021 at 04:14:40PM +0000, Matthias Klose wrote:
> Package: src:libodb
> Version: 2.4.0-1
> Severity: normal
> Tags: sid bookworm
> User: [email protected]
> Usertags: ftbfs-gcc-11
>...
The attached patch derived extracted from the upstream fix linked above
fixes the build with gcc 11.
cu
Adrian
diff --git a/odb/details/shared-ptr/base.cxx b/odb/details/shared-ptr/base.cxx
index b95797b..5bfc0af 100644
--- a/odb/details/shared-ptr/base.cxx
+++ b/odb/details/shared-ptr/base.cxx
@@ -15,7 +15,7 @@ namespace odb
share exclusive = share (2);
const char* not_shared::
- what () const throw ()
+ what () const noexcept
{
return "object is not shared";
}
@@ -54,7 +54,11 @@ namespace odb
}
void*
+#ifdef ODB_CXX11
+operator new (size_t n, odb::details::share s)
+#else
operator new (size_t n, odb::details::share s) throw (std::bad_alloc)
+#endif
{
if (s == odb::details::shared)
{
@@ -74,7 +78,7 @@ operator new (size_t n, odb::details::share s) throw (std::bad_alloc)
}
void
-operator delete (void* p, odb::details::share s) throw ()
+operator delete (void* p, odb::details::share s) noexcept
{
// This version of operator delete is only called when the c-tor
// fails. In this case there is no object and we can just free the
diff --git a/odb/details/shared-ptr/base.hxx b/odb/details/shared-ptr/base.hxx
index 4a38945..90053e8 100644
--- a/odb/details/shared-ptr/base.hxx
+++ b/odb/details/shared-ptr/base.hxx
@@ -10,6 +10,7 @@
#include <new>
#include <cstddef> // std::size_t
+#include <odb/details/config.hxx> // ODB_CXX11, noexcept
#include <odb/details/export.hxx>
#include <odb/details/shared-ptr/counter-type.hxx>
@@ -34,11 +35,16 @@ namespace odb
}
}
+#ifdef ODB_CXX11
+LIBODB_EXPORT void*
+operator new (std::size_t, odb::details::share);
+#else
LIBODB_EXPORT void*
operator new (std::size_t, odb::details::share) throw (std::bad_alloc);
+#endif
LIBODB_EXPORT void
-operator delete (void*, odb::details::share) throw ();
+operator delete (void*, odb::details::share) noexcept;
namespace odb
{
@@ -61,17 +67,25 @@ namespace odb
std::size_t
_ref_count () const;
+#ifdef ODB_CXX11
+ void*
+ operator new (std::size_t);
+
+ void*
+ operator new (std::size_t, share);
+#else
void*
operator new (std::size_t) throw (std::bad_alloc);
void*
operator new (std::size_t, share) throw (std::bad_alloc);
+#endif
void
- operator delete (void*, share) throw ();
+ operator delete (void*, share) noexcept;
void
- operator delete (void*) throw ();
+ operator delete (void*) noexcept;
struct refcount_callback
{
diff --git a/odb/details/shared-ptr/base.ixx b/odb/details/shared-ptr/base.ixx
index 9bf7c94..3ed1339 100644
--- a/odb/details/shared-ptr/base.ixx
+++ b/odb/details/shared-ptr/base.ixx
@@ -63,6 +63,19 @@ namespace odb
return counter_;
}
+#ifdef ODB_CXX11
+ inline void* shared_base::
+ operator new (std::size_t n)
+ {
+ return ::operator new (n);
+ }
+
+ inline void* shared_base::
+ operator new (std::size_t n, share)
+ {
+ return ::operator new (n);
+ }
+#else
inline void* shared_base::
operator new (std::size_t n) throw (std::bad_alloc)
{
@@ -74,15 +87,16 @@ namespace odb
{
return ::operator new (n);
}
+#endif
inline void shared_base::
- operator delete (void* p, share) throw ()
+ operator delete (void* p, share) noexcept
{
::operator delete (p);
}
inline void shared_base::
- operator delete (void* p) throw ()
+ operator delete (void* p) noexcept
{
::operator delete (p);
}