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/vector-impl.ixx | 78 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 28 deletions(-) (limited to 'odb/vector-impl.ixx') diff --git a/odb/vector-impl.ixx b/odb/vector-impl.ixx index 595c5ef..4865dd2 100644 --- a/odb/vector-impl.ixx +++ b/odb/vector-impl.ixx @@ -100,6 +100,16 @@ namespace odb } inline void vector_impl:: + set (std::size_t i, element_state_type s) + { + std::size_t r (i % 4); + i /= 4; + unsigned char v (static_cast (s)); + v <<= shift_[r]; + data_[i] = (data_[i] & ~mask_[r]) | v; + } + + inline void vector_impl:: modify (std::size_t i, std::size_t n) { for (; n != 0; --n, ++i) @@ -125,18 +135,37 @@ namespace odb push_back (n - tail_); } - inline void vector_impl:: - set (std::size_t i, element_state_type s) + // vector_base + // + inline vector_base:: + ~vector_base () { - std::size_t r (i % 4); - i /= 4; - unsigned char v (static_cast (s)); - v <<= shift_[r]; - data_[i] = (data_[i] & ~mask_[r]) | v; + if (tran_ != 0) + tran_->callback_unregister (this); + } + + inline vector_base:: + vector_base (): tran_ (0) {} + + inline vector_base:: + vector_base (const vector_base& x) + : impl_ (x.impl_), tran_ (0) + { + // If the original is armed, then arm ourselves as well. + // + if (x.tran_ != 0) + _arm (*x.tran_); + } + + inline void vector_base:: + swap (vector_base& x) + { + impl_.swap (x.impl_); + + if (tran_ != 0 || x.tran_ != 0) + swap_tran (x); } - // vector_base - // #ifdef ODB_CXX11 inline vector_base:: vector_base (vector_base&& x) @@ -151,32 +180,25 @@ namespace odb #endif inline void vector_base:: - _arm (transaction& t) const + _stop () const { - tran_ = &t; - t.callback_register (&rollback, - const_cast (this), - transaction::event_rollback, - 0, - &tran_); + impl_.stop (); } - inline vector_base:: - vector_base (const vector_base& x) - : impl_ (x.impl_), tran_ (0) + inline bool vector_base:: + _tracking () const { - // If the original is armed, then arm ourselves as well. - // - if (x.tran_ != 0) - _arm (*x.tran_); + return impl_.tracking (); } inline void vector_base:: - swap (vector_base& x) + _arm (transaction& t) const { - impl_.swap (x.impl_); - - if (tran_ != 0 || x.tran_ != 0) - swap_tran (x); + tran_ = &t; + t.callback_register (&rollback, + const_cast (this), + transaction::event_rollback, + 0, + &tran_); } } -- cgit v1.1