aboutsummaryrefslogtreecommitdiff
path: root/odb/details
diff options
context:
space:
mode:
Diffstat (limited to 'odb/details')
-rw-r--r--odb/details/config-vc.h3
-rw-r--r--odb/details/config.hxx10
-rw-r--r--odb/details/meta/polymorphic-p.hxx3
-rw-r--r--odb/details/posix/exceptions.cxx2
-rw-r--r--odb/details/posix/exceptions.hxx3
-rw-r--r--odb/details/shared-ptr/base.cxx8
-rw-r--r--odb/details/shared-ptr/base.hxx20
-rw-r--r--odb/details/shared-ptr/base.ixx18
-rw-r--r--odb/details/shared-ptr/exception.hxx4
-rw-r--r--odb/details/transfer-ptr.hxx26
-rw-r--r--odb/details/win32/exceptions.cxx2
-rw-r--r--odb/details/win32/exceptions.hxx5
12 files changed, 77 insertions, 27 deletions
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 <odb/pre.hxx>
+#include <odb/details/config.hxx> // ODB_NOTHROW_NOEXCEPT
#include <odb/details/meta/class-p.hxx>
#include <odb/details/meta/remove-const-volatile.hxx>
@@ -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 <odb/pre.hxx>
+#include <odb/details/config.hxx> // ODB_NOTHROW_NOEXCEPT
#include <odb/details/export.hxx>
#include <odb/details/exception.hxx>
@@ -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 <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;
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 <typename T1>
transfer_ptr (std::auto_ptr<T1> 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<transfer_ptr&> (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<transfer_ptr&> (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 <odb/pre.hxx>
-#include <odb/details/win32/windows.hxx>
+#include <odb/details/config.hxx> // ODB_NOTHROW_NOEXCEPT
#include <odb/details/export.hxx>
#include <odb/details/exception.hxx>
+#include <odb/details/win32/windows.hxx>
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;