aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-02-11 16:15:26 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-02-11 16:15:26 +0200
commitb2f552f3505c1d8247e1a0ca844fe372ef639f79 (patch)
tree2e46697657144f9b965ffddc04ceba0750294164
parentc6bc6ecf14ba7b43350a65df9701b0848c95d0e2 (diff)
Rearrange inline function order to help MinGW2.4.0
On MinGW, if a DLL-exported inline function is called before it is known to be inline, the compiler issues a warning.
-rw-r--r--odb/lazy-ptr-impl.ixx42
-rw-r--r--odb/vector-impl.hxx8
-rw-r--r--odb/vector-impl.ixx78
3 files changed, 76 insertions, 52 deletions
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)
diff --git a/odb/vector-impl.hxx b/odb/vector-impl.hxx
index 819062d..55b3103 100644
--- a/odb/vector-impl.hxx
+++ b/odb/vector-impl.hxx
@@ -174,10 +174,10 @@ namespace odb
{
public:
void
- _stop () const {impl_.stop ();}
+ _stop () const;
bool
- _tracking () const {return impl_.tracking ();}
+ _tracking () const;
void
_arm (transaction& t) const;
@@ -191,8 +191,8 @@ namespace odb
vector_base& operator= (const vector_base&);
protected:
- vector_base (): tran_ (0) {}
- ~vector_base () {if (tran_ != 0) tran_->callback_unregister (this);}
+ ~vector_base ();
+ vector_base ();
vector_base (const vector_base&);
#ifdef ODB_CXX11
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<unsigned char> (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<unsigned char> (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<vector_base*> (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<vector_base*> (this),
+ transaction::event_rollback,
+ 0,
+ &tran_);
}
}