From 13dd928ae18ef9610bc820b7b3e65629addea1d2 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 15 Jun 2016 18:50:51 +0200 Subject: Get rid of C++11 deprecation warnings for auto_ptr, exception specs In particular, std::auto_ptr is no longer mapped in C++11. --- odb/connection.hxx | 8 +-- odb/connection.ixx | 12 ++-- odb/database.hxx | 8 +-- odb/database.ixx | 12 ++-- odb/details/config-vc.h | 3 + odb/details/config.hxx | 10 +++ odb/details/meta/polymorphic-p.hxx | 3 +- odb/details/posix/exceptions.cxx | 2 +- odb/details/posix/exceptions.hxx | 3 +- odb/details/shared-ptr/base.cxx | 8 ++- odb/details/shared-ptr/base.hxx | 20 +++++- odb/details/shared-ptr/base.ixx | 18 +++++- odb/details/shared-ptr/exception.hxx | 4 +- odb/details/transfer-ptr.hxx | 26 ++++---- odb/details/win32/exceptions.cxx | 2 +- odb/details/win32/exceptions.hxx | 5 +- odb/exception.hxx | 3 +- odb/exceptions.cxx | 56 ++++++++-------- odb/exceptions.hxx | 57 +++++++++-------- odb/lazy-pointer-traits.hxx | 2 + odb/lazy-ptr.hxx | 23 +++---- odb/lazy-ptr.ixx | 120 ++++++++++++++++++----------------- odb/pointer-traits.hxx | 2 + odb/wrapper-traits.hxx | 2 + 24 files changed, 235 insertions(+), 174 deletions(-) diff --git a/odb/connection.hxx b/odb/connection.hxx index f1f8c3b..cbf9f6e 100644 --- a/odb/connection.hxx +++ b/odb/connection.hxx @@ -78,14 +78,14 @@ namespace odb void cache_query (const prepared_query&); - template - void - cache_query (const prepared_query&, std::auto_ptr

params); - #ifdef ODB_CXX11 template void cache_query (const prepared_query&, std::unique_ptr

params); +#else + template + void + cache_query (const prepared_query&, std::auto_ptr

params); #endif template diff --git a/odb/connection.ixx b/odb/connection.ixx index e86f8d8..1ed64bb 100644 --- a/odb/connection.ixx +++ b/odb/connection.ixx @@ -64,24 +64,24 @@ namespace odb cache_query_ (pq.impl_, typeid (T), 0, 0, 0); } +#ifdef ODB_CXX11 template inline void connection:: - cache_query (const prepared_query& pq, std::auto_ptr

params) + cache_query (const prepared_query& pq, std::unique_ptr

params) { assert (pq); - assert (params.get () != 0); + assert (params); cache_query_ ( pq.impl_, typeid (T), params.get (), &typeid (P), ¶ms_deleter

); params.release (); } - -#ifdef ODB_CXX11 +#else template inline void connection:: - cache_query (const prepared_query& pq, std::unique_ptr

params) + cache_query (const prepared_query& pq, std::auto_ptr

params) { assert (pq); - assert (params); + assert (params.get () != 0); cache_query_ ( pq.impl_, typeid (T), params.get (), &typeid (P), ¶ms_deleter

); params.release (); diff --git a/odb/database.hxx b/odb/database.hxx index adeb83a..2a25f7f 100644 --- a/odb/database.hxx +++ b/odb/database.hxx @@ -366,14 +366,14 @@ namespace odb void cache_query (const prepared_query&); - template - void - cache_query (const prepared_query&, std::auto_ptr

params); - #ifdef ODB_CXX11 template void cache_query (const prepared_query&, std::unique_ptr

params); +#else + template + void + cache_query (const prepared_query&, std::auto_ptr

params); #endif template diff --git a/odb/database.ixx b/odb/database.ixx index 1ea7949..47d4d70 100644 --- a/odb/database.ixx +++ b/odb/database.ixx @@ -687,21 +687,21 @@ namespace odb c.cache_query (pq); } +#ifdef ODB_CXX11 template inline void database:: - cache_query (const prepared_query& pq, std::auto_ptr

params) + cache_query (const prepared_query& pq, std::unique_ptr

params) { connection_type& c (transaction::current ().connection ()); - c.cache_query (pq, params); + c.cache_query (pq, std::move (params)); } - -#ifdef ODB_CXX11 +#else template inline void database:: - cache_query (const prepared_query& pq, std::unique_ptr

params) + cache_query (const prepared_query& pq, std::auto_ptr

params) { connection_type& c (transaction::current ().connection ()); - c.cache_query (pq, std::move (params)); + c.cache_query (pq, params); } #endif diff --git a/odb/details/config-vc.h b/odb/details/config-vc.h index a7f8c95..c187fe5 100644 --- a/odb/details/config-vc.h +++ b/odb/details/config-vc.h @@ -24,6 +24,9 @@ # define ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT # define ODB_CXX11_VARIADIC_TEMPLATE # define ODB_CXX11_INITIALIZER_LIST +# if _MSC_VER >= 1900 +# define ODB_CXX11_NOEXCEPT +# endif # endif # endif #endif diff --git a/odb/details/config.hxx b/odb/details/config.hxx index c36b163..5aa35aa 100644 --- a/odb/details/config.hxx +++ b/odb/details/config.hxx @@ -16,6 +16,7 @@ # define ODB_CXX11 # if (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4 # define ODB_CXX11_NULLPTR +# define ODB_CXX11_NOEXCEPT # endif # define ODB_CXX11_DELETED_FUNCTION # define ODB_CXX11_EXPLICIT_CONVERSION_OPERATOR @@ -29,12 +30,15 @@ # define ODB_CXX11 # ifdef __clang__ // Pretends to be a really old __GNUC__ on some platforms. # define ODB_CXX11_NULLPTR +# define ODB_CXX11_NOEXCEPT # elif defined(__GNUC__) # if (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4 # define ODB_CXX11_NULLPTR +# define ODB_CXX11_NOEXCEPT # endif # else # define ODB_CXX11_NULLPTR +# define ODB_CXX11_NOEXCEPT # endif # define ODB_CXX11_DELETED_FUNCTION # define ODB_CXX11_EXPLICIT_CONVERSION_OPERATOR @@ -48,6 +52,12 @@ # endif #endif +#ifdef ODB_CXX11_NOEXCEPT +# define ODB_NOTHROW_NOEXCEPT noexcept +#else +# define ODB_NOTHROW_NOEXCEPT throw() +#endif + // no post #endif // ODB_DETAILS_CONFIG_HXX diff --git a/odb/details/meta/polymorphic-p.hxx b/odb/details/meta/polymorphic-p.hxx index bd90fc2..5315afc 100644 --- a/odb/details/meta/polymorphic-p.hxx +++ b/odb/details/meta/polymorphic-p.hxx @@ -7,6 +7,7 @@ #include +#include // ODB_NOTHROW_NOEXCEPT #include #include @@ -40,7 +41,7 @@ namespace odb t2 (); virtual - ~t2 () throw (); + ~t2 () ODB_NOTHROW_NOEXCEPT; }; static const bool result = sizeof (t1) == sizeof (t2); diff --git a/odb/details/posix/exceptions.cxx b/odb/details/posix/exceptions.cxx index 0ed0aa3..ecffa4f 100644 --- a/odb/details/posix/exceptions.cxx +++ b/odb/details/posix/exceptions.cxx @@ -9,7 +9,7 @@ namespace odb namespace details { const char* posix_exception:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "POSIX API error"; } diff --git a/odb/details/posix/exceptions.hxx b/odb/details/posix/exceptions.hxx index dd78313..7a40ac6 100644 --- a/odb/details/posix/exceptions.hxx +++ b/odb/details/posix/exceptions.hxx @@ -7,6 +7,7 @@ #include +#include // ODB_NOTHROW_NOEXCEPT #include #include @@ -22,7 +23,7 @@ namespace odb code () const {return code_;} virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual posix_exception* clone () const; 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 #include // std::size_t +#include // ODB_CXX11, ODB_NOTHROW_NOEXCEPT #include #include @@ -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 #include + +#include // ODB_NOTHROW_NOEXCEPT #include 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; diff --git a/odb/details/transfer-ptr.hxx b/odb/details/transfer-ptr.hxx index 13f113e..0e2d726 100644 --- a/odb/details/transfer-ptr.hxx +++ b/odb/details/transfer-ptr.hxx @@ -23,10 +23,22 @@ namespace odb transfer_ptr (): p_ (0) {} +#ifndef ODB_CXX11 template transfer_ptr (std::auto_ptr p): p_ (p.release ()) {} -#ifdef ODB_CXX11 + private: + transfer_ptr& operator= (const transfer_ptr&); + + public: + // In our usage transfer_ptr is always created implicitly and + // never const. So while this is not very clean, it is legal. + // Plus it will all go away once we drop C++98 (I can hardly + // wait). + // + transfer_ptr (const transfer_ptr& p) + : p_ (const_cast (p).transfer ()) {} +#else #ifdef ODB_CXX11_NULLPTR transfer_ptr (std::nullptr_t): p_ (0) {} #endif @@ -39,18 +51,6 @@ namespace odb public: transfer_ptr (transfer_ptr&& p): p_ (p.transfer ()) {} -#else - private: - transfer_ptr& operator= (const transfer_ptr&); - - public: - // In our usage transfer_ptr is always created implicitly and - // never const. So while this is not very clean, it is legal. - // Plus it will all go away once we drop C++98 (I can hardly - // wait). - // - transfer_ptr (const transfer_ptr& p) - : p_ (const_cast (p).transfer ()) {} #endif ~transfer_ptr () {delete p_;} diff --git a/odb/details/win32/exceptions.cxx b/odb/details/win32/exceptions.cxx index 0e52348..1067a28 100644 --- a/odb/details/win32/exceptions.cxx +++ b/odb/details/win32/exceptions.cxx @@ -9,7 +9,7 @@ namespace odb namespace details { const char* win32_exception:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "Win32 API error"; } diff --git a/odb/details/win32/exceptions.hxx b/odb/details/win32/exceptions.hxx index 7303bb7..1f8a4b2 100644 --- a/odb/details/win32/exceptions.hxx +++ b/odb/details/win32/exceptions.hxx @@ -7,9 +7,10 @@ #include -#include +#include // ODB_NOTHROW_NOEXCEPT #include #include +#include namespace odb { @@ -24,7 +25,7 @@ namespace odb code () const {return code_;} virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual win32_exception* clone () const; diff --git a/odb/exception.hxx b/odb/exception.hxx index 3a0b809..3ce587b 100644 --- a/odb/exception.hxx +++ b/odb/exception.hxx @@ -11,6 +11,7 @@ #include // odb::core +#include // ODB_NOTHROW_NOEXCEPT #include #include @@ -19,7 +20,7 @@ namespace odb struct LIBODB_EXPORT exception: std::exception, details::shared_base { virtual const char* - what () const throw () = 0; + what () const ODB_NOTHROW_NOEXCEPT = 0; virtual exception* clone () const = 0; diff --git a/odb/exceptions.cxx b/odb/exceptions.cxx index ebbc543..3ce1449 100644 --- a/odb/exceptions.cxx +++ b/odb/exceptions.cxx @@ -13,7 +13,7 @@ using namespace std; namespace odb { const char* null_pointer:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "NULL pointer"; } @@ -25,7 +25,7 @@ namespace odb } const char* already_in_transaction:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "transaction already in progress in this thread"; } @@ -37,7 +37,7 @@ namespace odb } const char* not_in_transaction:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "operation can only be performed in transaction"; } @@ -49,7 +49,7 @@ namespace odb } const char* transaction_already_finalized:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "transaction already committed or rolled back"; } @@ -61,7 +61,7 @@ namespace odb } const char* already_in_session:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "session already in effect in this thread"; } @@ -73,7 +73,7 @@ namespace odb } const char* not_in_session:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "session not in effect in this thread"; } @@ -85,7 +85,7 @@ namespace odb } const char* session_required:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "session required to load this object relationship"; } @@ -97,7 +97,7 @@ namespace odb } const char* deadlock:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "transaction aborted due to deadlock"; } @@ -109,7 +109,7 @@ namespace odb } const char* connection_lost:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "connection to database lost"; } @@ -121,7 +121,7 @@ namespace odb } const char* timeout:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "database operation timeout"; } @@ -133,7 +133,7 @@ namespace odb } const char* object_not_persistent:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "object not persistent"; } @@ -145,7 +145,7 @@ namespace odb } const char* object_already_persistent:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "object already persistent"; } @@ -157,7 +157,7 @@ namespace odb } const char* object_changed:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "object changed concurrently"; } @@ -169,7 +169,7 @@ namespace odb } const char* result_not_cached:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "query result is not cached"; } @@ -181,7 +181,7 @@ namespace odb } const char* abstract_class:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "database operation on instance of abstract class"; } @@ -193,7 +193,7 @@ namespace odb } const char* no_type_info:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "no type information"; } @@ -214,12 +214,12 @@ namespace odb } prepared_already_cached:: - ~prepared_already_cached () throw () + ~prepared_already_cached () ODB_NOTHROW_NOEXCEPT { } const char* prepared_already_cached:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return what_.c_str (); } @@ -240,12 +240,12 @@ namespace odb } prepared_type_mismatch:: - ~prepared_type_mismatch () throw () + ~prepared_type_mismatch () ODB_NOTHROW_NOEXCEPT { } const char* prepared_type_mismatch:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return what_.c_str (); } @@ -266,12 +266,12 @@ namespace odb } unknown_schema:: - ~unknown_schema () throw () + ~unknown_schema () ODB_NOTHROW_NOEXCEPT { } const char* unknown_schema:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return what_.c_str (); } @@ -293,12 +293,12 @@ namespace odb } unknown_schema_version:: - ~unknown_schema_version () throw () + ~unknown_schema_version () ODB_NOTHROW_NOEXCEPT { } const char* unknown_schema_version:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return what_.c_str (); } @@ -310,7 +310,7 @@ namespace odb } const char* section_not_loaded:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "section is not loaded"; } @@ -322,7 +322,7 @@ namespace odb } const char* section_not_in_object:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return "section instance is not part of an object (section was copied?)"; } @@ -336,7 +336,7 @@ namespace odb // multiple_exceptions // multiple_exceptions:: - ~multiple_exceptions () throw () {} + ~multiple_exceptions () ODB_NOTHROW_NOEXCEPT {} void multiple_exceptions:: insert (size_t p, bool maybe, const odb::exception& e, bool fatal) @@ -418,7 +418,7 @@ namespace odb } const char* multiple_exceptions:: - what () const throw () + what () const ODB_NOTHROW_NOEXCEPT { return what_.c_str (); } diff --git a/odb/exceptions.hxx b/odb/exceptions.hxx index b836291..afd034f 100644 --- a/odb/exceptions.hxx +++ b/odb/exceptions.hxx @@ -15,6 +15,7 @@ #include // schema_version, odb::core #include +#include // ODB_NOTHROW_NOEXCEPT #include #include @@ -23,7 +24,7 @@ namespace odb struct LIBODB_EXPORT null_pointer: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual null_pointer* clone () const; @@ -34,7 +35,7 @@ namespace odb struct LIBODB_EXPORT already_in_transaction: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual already_in_transaction* clone () const; @@ -43,7 +44,7 @@ namespace odb struct LIBODB_EXPORT not_in_transaction: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual not_in_transaction* clone () const; @@ -52,7 +53,7 @@ namespace odb struct LIBODB_EXPORT transaction_already_finalized: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual transaction_already_finalized* clone () const; @@ -63,7 +64,7 @@ namespace odb struct LIBODB_EXPORT already_in_session: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual already_in_session* clone () const; @@ -72,7 +73,7 @@ namespace odb struct LIBODB_EXPORT not_in_session: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual not_in_session* clone () const; @@ -81,7 +82,7 @@ namespace odb struct LIBODB_EXPORT session_required: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual session_required* clone () const; @@ -97,7 +98,7 @@ namespace odb struct LIBODB_EXPORT connection_lost: recoverable { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual connection_lost* clone () const; @@ -106,7 +107,7 @@ namespace odb struct LIBODB_EXPORT timeout: recoverable { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual timeout* clone () const; @@ -115,7 +116,7 @@ namespace odb struct LIBODB_EXPORT deadlock: recoverable { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual deadlock* clone () const; @@ -124,7 +125,7 @@ namespace odb struct LIBODB_EXPORT object_not_persistent: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual object_not_persistent* clone () const; @@ -133,7 +134,7 @@ namespace odb struct LIBODB_EXPORT object_already_persistent: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual object_already_persistent* clone () const; @@ -142,7 +143,7 @@ namespace odb struct LIBODB_EXPORT object_changed: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual object_changed* clone () const; @@ -151,7 +152,7 @@ namespace odb struct LIBODB_EXPORT result_not_cached: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual result_not_cached* clone () const; @@ -167,7 +168,7 @@ namespace odb struct LIBODB_EXPORT abstract_class: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual abstract_class* clone () const; @@ -176,7 +177,7 @@ namespace odb struct LIBODB_EXPORT no_type_info: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual no_type_info* clone () const; @@ -187,7 +188,7 @@ namespace odb struct LIBODB_EXPORT prepared_already_cached: odb::exception { prepared_already_cached (const char* name); - ~prepared_already_cached () throw (); + ~prepared_already_cached () ODB_NOTHROW_NOEXCEPT; const char* name () const @@ -196,7 +197,7 @@ namespace odb } virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual prepared_already_cached* clone () const; @@ -209,13 +210,13 @@ namespace odb struct LIBODB_EXPORT prepared_type_mismatch: odb::exception { prepared_type_mismatch (const char* name); - ~prepared_type_mismatch () throw (); + ~prepared_type_mismatch () ODB_NOTHROW_NOEXCEPT; const char* name () const {return name_;} virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual prepared_type_mismatch* clone () const; @@ -230,13 +231,13 @@ namespace odb struct LIBODB_EXPORT unknown_schema: odb::exception { unknown_schema (const std::string& name); - ~unknown_schema () throw (); + ~unknown_schema () ODB_NOTHROW_NOEXCEPT; const std::string& name () const {return name_;} virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual unknown_schema* clone () const; @@ -249,13 +250,13 @@ namespace odb struct LIBODB_EXPORT unknown_schema_version: odb::exception { unknown_schema_version (schema_version); - ~unknown_schema_version () throw (); + ~unknown_schema_version () ODB_NOTHROW_NOEXCEPT; schema_version version () const {return version_;} virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual unknown_schema_version* clone () const; @@ -270,7 +271,7 @@ namespace odb struct LIBODB_EXPORT section_not_loaded: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual section_not_loaded* clone () const; @@ -279,7 +280,7 @@ namespace odb struct LIBODB_EXPORT section_not_in_object: odb::exception { virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual section_not_in_object* clone () const; @@ -399,7 +400,7 @@ namespace odb // public: virtual const char* - what () const throw (); + what () const ODB_NOTHROW_NOEXCEPT; virtual multiple_exceptions* clone () const; @@ -413,7 +414,7 @@ namespace odb // Implementation details. // public: - ~multiple_exceptions () throw (); + ~multiple_exceptions () ODB_NOTHROW_NOEXCEPT; // All instances of the common exception must be equal since we are // going to create and share just one. diff --git a/odb/lazy-pointer-traits.hxx b/odb/lazy-pointer-traits.hxx index 12e0a08..bc9e64e 100644 --- a/odb/lazy-pointer-traits.hxx +++ b/odb/lazy-pointer-traits.hxx @@ -38,6 +38,7 @@ namespace odb } }; +#ifndef ODB_CXX11 template class pointer_traits< lazy_auto_ptr > { @@ -62,6 +63,7 @@ namespace odb return p.template object_id (); } }; +#endif #ifdef ODB_CXX11 template diff --git a/odb/lazy-ptr.hxx b/odb/lazy-ptr.hxx index ccc6c3c..2fca33a 100644 --- a/odb/lazy-ptr.hxx +++ b/odb/lazy-ptr.hxx @@ -116,6 +116,7 @@ namespace odb // std::auto_ptr lazy version. // +#ifndef ODB_CXX11 template struct lazy_auto_ptr_ref { @@ -203,11 +204,7 @@ namespace odb template void reset (DB&, T*); template void reset (DB&, std::auto_ptr&); -#ifdef ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT - template -#else template -#endif typename object_traits::id_type object_id () const; database_type& database () const; @@ -223,6 +220,7 @@ namespace odb mutable std::auto_ptr p_; mutable lazy_ptr_impl i_; }; +#endif #ifdef ODB_CXX11 @@ -251,7 +249,7 @@ namespace odb lazy_unique_ptr (lazy_unique_ptr&&) /*noexcept*/; template lazy_unique_ptr (lazy_unique_ptr&&) /*noexcept*/; - template lazy_unique_ptr (std::auto_ptr&&) /*noexcept*/; + //template lazy_unique_ptr (std::auto_ptr&&) /*noexcept*/; #ifdef ODB_CXX11_NULLPTR lazy_unique_ptr& operator= (std::nullptr_t) /*noexcept*/; @@ -325,12 +323,12 @@ namespace odb template lazy_unique_ptr (DB&, pointer, const deleter_type&); template lazy_unique_ptr (DB&, pointer, deleter_type&&); template lazy_unique_ptr (DB&, std::unique_ptr&&); - template lazy_unique_ptr (DB&, std::auto_ptr&&); + //template lazy_unique_ptr (DB&, std::auto_ptr&&); template void reset (DB&, const ID&); template void reset (DB&, pointer); template void reset (DB&, std::unique_ptr&&); - template void reset (DB&, std::auto_ptr&&); + //template void reset (DB&, std::auto_ptr&&); #ifdef ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT template @@ -413,7 +411,7 @@ namespace odb lazy_shared_ptr (lazy_shared_ptr&&) /*noexcept*/; template lazy_shared_ptr (lazy_shared_ptr&&) /*noexcept*/; template explicit lazy_shared_ptr (const lazy_weak_ptr&); - template explicit lazy_shared_ptr (std::auto_ptr&&); + //template explicit lazy_shared_ptr (std::auto_ptr&&); template lazy_shared_ptr (std::unique_ptr&&); ~lazy_shared_ptr (); @@ -422,7 +420,7 @@ namespace odb template lazy_shared_ptr& operator= (const lazy_shared_ptr&) /*noexcept*/; lazy_shared_ptr& operator= (lazy_shared_ptr&&) /*noexcept*/; template lazy_shared_ptr& operator= (lazy_shared_ptr&&) /*noexcept*/; - template lazy_shared_ptr& operator= (std::auto_ptr&&); + //template lazy_shared_ptr& operator= (std::auto_ptr&&); template lazy_shared_ptr& operator= (std::unique_ptr&&); void swap (lazy_shared_ptr&) /*noexcept*/; @@ -488,7 +486,7 @@ namespace odb template lazy_shared_ptr (DB&, Y*); template lazy_shared_ptr (DB&, Y*, D); template lazy_shared_ptr (DB&, Y*, D, A); - template lazy_shared_ptr (DB&, std::auto_ptr&&); + //template lazy_shared_ptr (DB&, std::auto_ptr&&); template lazy_shared_ptr (DB&, const std::shared_ptr&); template lazy_shared_ptr (DB&, std::shared_ptr&&); template lazy_shared_ptr (DB&, const std::weak_ptr&); @@ -497,7 +495,7 @@ namespace odb template void reset (DB&, Y*); template void reset (DB&, Y*, D); template void reset (DB&, Y*, D, A); - template void reset (DB&, std::auto_ptr&&); + //template void reset (DB&, std::auto_ptr&&); template void reset (DB&, const std::shared_ptr&); template void reset (DB&, std::shared_ptr&&); @@ -661,7 +659,10 @@ namespace odb namespace common { using odb::lazy_ptr; + +#ifndef ODB_CXX11 using odb::lazy_auto_ptr; +#endif #ifdef ODB_CXX11 using odb::lazy_unique_ptr; diff --git a/odb/lazy-ptr.ixx b/odb/lazy-ptr.ixx index ccd95cc..52e6d7b 100644 --- a/odb/lazy-ptr.ixx +++ b/odb/lazy-ptr.ixx @@ -223,6 +223,7 @@ namespace odb // // lazy_auto_ptr_ref // +#ifndef ODB_CXX11 template inline lazy_auto_ptr_ref:: @@ -487,6 +488,7 @@ namespace odb { return *i_.database (); } +#endif #ifdef ODB_CXX11 @@ -527,10 +529,10 @@ namespace odb lazy_unique_ptr (lazy_unique_ptr&& r) : p_ (std::move (r.p_)), i_ (std::move (r.i_)) {} - template - template - lazy_unique_ptr:: - lazy_unique_ptr (std::auto_ptr&& r): p_ (std::move (r)) {} + // template + // template + // lazy_unique_ptr:: + // lazy_unique_ptr (std::auto_ptr&& r): p_ (std::move (r)) {} #ifdef ODB_CXX11_NULLPTR template @@ -732,15 +734,15 @@ namespace odb i_.reset_db (db); } - template - template - inline lazy_unique_ptr:: - lazy_unique_ptr (DB& db, std::auto_ptr&& p) - : p_ (std::move (p)) - { - if (p_) - i_.reset_db (db); - } + // template + // template + // inline lazy_unique_ptr:: + // lazy_unique_ptr (DB& db, std::auto_ptr&& p) + // : p_ (std::move (p)) + // { + // if (p_) + // i_.reset_db (db); + // } template template @@ -777,18 +779,18 @@ namespace odb i_.reset (); } - template - template - inline void lazy_unique_ptr:: - reset (DB& db, std::auto_ptr&& p) - { - p_ = std::unique_ptr (std::move (p)); - - if (p_) - i_.reset_db (db); - else - i_.reset (); - } + // template + // template + // inline void lazy_unique_ptr:: + // reset (DB& db, std::auto_ptr&& p) + // { + // p_ = std::unique_ptr (std::move (p)); + // + // if (p_) + // i_.reset_db (db); + // else + // i_.reset (); + // } template template @@ -943,10 +945,10 @@ namespace odb throw std::bad_weak_ptr (); } - template - template - inline lazy_shared_ptr:: - lazy_shared_ptr (std::auto_ptr&& r): p_ (std::move (r)) {} + // template + // template + // inline lazy_shared_ptr:: + // lazy_shared_ptr (std::auto_ptr&& r): p_ (std::move (r)) {} template template @@ -995,15 +997,15 @@ namespace odb return *this; } - template - template - inline lazy_shared_ptr& lazy_shared_ptr:: - operator= (std::auto_ptr&& r) - { - p_ = std::move (r); - i_.reset (); - return *this; - } + // template + // template + // inline lazy_shared_ptr& lazy_shared_ptr:: + // operator= (std::auto_ptr&& r) + // { + // p_ = std::move (r); + // i_.reset (); + // return *this; + // } template template @@ -1212,15 +1214,15 @@ namespace odb i_.reset_db (db); } - template - template - inline lazy_shared_ptr:: - lazy_shared_ptr (DB& db, std::auto_ptr&& r) - : p_ (std::move (r)) - { - if (p_) - i_.reset_db (db); - } + // template + // template + // inline lazy_shared_ptr:: + // lazy_shared_ptr (DB& db, std::auto_ptr&& r) + // : p_ (std::move (r)) + // { + // if (p_) + // i_.reset_db (db); + // } template template @@ -1300,18 +1302,18 @@ namespace odb i_.reset (); } - template - template - inline void lazy_shared_ptr:: - reset (DB& db, std::auto_ptr&& r) - { - p_ = std::move (r); - - if (p_) - i_.reset_db (db); - else - i_.reset (); - } + // template + // template + // inline void lazy_shared_ptr:: + // reset (DB& db, std::auto_ptr&& r) + // { + // p_ = std::move (r); + // + // if (p_) + // i_.reset_db (db); + // else + // i_.reset (); + // } template template diff --git a/odb/pointer-traits.hxx b/odb/pointer-traits.hxx index a20aa93..3bfaa6b 100644 --- a/odb/pointer-traits.hxx +++ b/odb/pointer-traits.hxx @@ -161,6 +161,7 @@ namespace odb // Specialization for std::auto_ptr. // +#ifndef ODB_CXX11 template class pointer_traits< std::auto_ptr > { @@ -230,6 +231,7 @@ namespace odb operator delete (p); } }; +#endif #ifdef ODB_CXX11 diff --git a/odb/wrapper-traits.hxx b/odb/wrapper-traits.hxx index 47b6701..6ed1b60 100644 --- a/odb/wrapper-traits.hxx +++ b/odb/wrapper-traits.hxx @@ -77,6 +77,7 @@ namespace odb // Specialization for std::auto_ptr. // +#ifndef ODB_CXX11 template class wrapper_traits< std::auto_ptr > { @@ -122,6 +123,7 @@ namespace odb return const_cast (*p); } }; +#endif #ifdef ODB_CXX11 -- cgit v1.1