From b2f552f3505c1d8247e1a0ca844fe372ef639f79 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 11 Feb 2015 16:15:26 +0200 Subject: Rearrange inline function order to help MinGW On MinGW, if a DLL-exported inline function is called before it is known to be inline, the compiler issues a warning. --- odb/lazy-ptr-impl.ixx | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'odb/lazy-ptr-impl.ixx') diff --git a/odb/lazy-ptr-impl.ixx b/odb/lazy-ptr-impl.ixx index 8131897..769281b 100644 --- a/odb/lazy-ptr-impl.ixx +++ b/odb/lazy-ptr-impl.ixx @@ -38,25 +38,16 @@ namespace odb { r.id_ = 0; } +#endif - inline lazy_ptr_base& lazy_ptr_base:: - operator= (lazy_ptr_base&& r) + inline void lazy_ptr_base:: + reset_id () { - if (id_ != r.id_) - { - reset_id (); - id_ = r.id_; - db_ = r.db_; - loader_ = r.loader_; - free_ = r.free_; - copy_ = r.copy_; - - r.id_ = 0; - } + if (id_) + free_ (id_); - return *this; + id_ = 0; } -#endif inline void lazy_ptr_base:: reset_ (database_type* db, @@ -86,14 +77,25 @@ namespace odb loader_ = 0; } - inline void lazy_ptr_base:: - reset_id () +#ifdef ODB_CXX11 + inline lazy_ptr_base& lazy_ptr_base:: + operator= (lazy_ptr_base&& r) { - if (id_) - free_ (id_); + if (id_ != r.id_) + { + reset_id (); + id_ = r.id_; + db_ = r.db_; + loader_ = r.loader_; + free_ = r.free_; + copy_ = r.copy_; - id_ = 0; + r.id_ = 0; + } + + return *this; } +#endif inline lazy_ptr_base& lazy_ptr_base:: operator= (const lazy_ptr_base& r) -- cgit v1.1