diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-06-15 18:50:51 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-06-15 18:50:51 +0200 |
commit | 13dd928ae18ef9610bc820b7b3e65629addea1d2 (patch) | |
tree | d9ee8ef03e3ee5a3be9925de08537b03cf29320b /odb/details/shared-ptr | |
parent | b33321c4d05c0ac759bf3fcf647a568af8bfca0c (diff) |
Get rid of C++11 deprecation warnings for auto_ptr, exception specs
In particular, std::auto_ptr is no longer mapped in C++11.
Diffstat (limited to 'odb/details/shared-ptr')
-rw-r--r-- | odb/details/shared-ptr/base.cxx | 8 | ||||
-rw-r--r-- | odb/details/shared-ptr/base.hxx | 20 | ||||
-rw-r--r-- | odb/details/shared-ptr/base.ixx | 18 | ||||
-rw-r--r-- | odb/details/shared-ptr/exception.hxx | 4 |
4 files changed, 42 insertions, 8 deletions
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 ODB_NOTHROW_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) ODB_NOTHROW_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, ODB_NOTHROW_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) ODB_NOTHROW_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) ODB_NOTHROW_NOEXCEPT; void - operator delete (void*) throw (); + operator delete (void*) ODB_NOTHROW_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) ODB_NOTHROW_NOEXCEPT { ::operator delete (p); } inline void shared_base:: - operator delete (void* p) throw () + operator delete (void* p) ODB_NOTHROW_NOEXCEPT { ::operator delete (p); } diff --git a/odb/details/shared-ptr/exception.hxx b/odb/details/shared-ptr/exception.hxx index 99ed069..a006a35 100644 --- a/odb/details/shared-ptr/exception.hxx +++ b/odb/details/shared-ptr/exception.hxx @@ -8,6 +8,8 @@ #include <odb/pre.hxx> #include <odb/exception.hxx> + +#include <odb/details/config.hxx> // ODB_NOTHROW_NOEXCEPT #include <odb/details/export.hxx> namespace odb @@ -17,7 +19,7 @@ namespace odb struct LIBODB_EXPORT not_shared: exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual not_shared* clone () const; |