[libsigc++2] trackable, slot, signal: Remove noexcept specifications
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsigc++2] trackable, slot, signal: Remove noexcept specifications
- Date: Sun, 8 Nov 2015 09:21:24 +0000 (UTC)
commit b53b58b7816c20b3d09f1a6fa6ce98da1f003edf
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date: Sun Nov 8 10:03:28 2015 +0100
trackable, slot, signal: Remove noexcept specifications
* sigc++/functors/macros/slot.h.m4:
* sigc++/functors/slot_base.[h|cc]:
* sigc++/signal_base.[h|cc]:
* sigc++/trackable.[h|cc]: Remove noexcept from the move operators.
Bug #756484.
sigc++/functors/macros/slot.h.m4 | 4 ++--
sigc++/functors/slot_base.cc | 4 ++--
sigc++/functors/slot_base.h | 8 ++++++--
sigc++/signal_base.cc | 4 ++--
sigc++/signal_base.h | 4 ++--
sigc++/trackable.cc | 4 ++--
sigc++/trackable.h | 9 +++++++--
7 files changed, 23 insertions(+), 14 deletions(-)
---
diff --git a/sigc++/functors/macros/slot.h.m4 b/sigc++/functors/macros/slot.h.m4
index 0a141a2..4e9b00f 100644
--- a/sigc++/functors/macros/slot.h.m4
+++ b/sigc++/functors/macros/slot.h.m4
@@ -91,7 +91,7 @@ FOR(1, $1,[
* If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
* @param src The existing slot to move or copy.
*/
- slot$1(slot$1&& src) noexcept
+ slot$1(slot$1&& src)
: slot_base(std::move(src))
{}
@@ -110,7 +110,7 @@ FOR(1, $1,[
* @param src The slot from which to move or copy.
* @return @p this.
*/
- slot$1& operator=(slot$1&& src) noexcept
+ slot$1& operator=(slot$1&& src)
{
slot_base::operator=(std::move(src));
return *this;
diff --git a/sigc++/functors/slot_base.cc b/sigc++/functors/slot_base.cc
index 7500d84..9340b02 100644
--- a/sigc++/functors/slot_base.cc
+++ b/sigc++/functors/slot_base.cc
@@ -124,7 +124,7 @@ slot_base::slot_base(const slot_base& src)
}
}
-slot_base::slot_base(slot_base&& src) noexcept
+slot_base::slot_base(slot_base&& src)
: rep_(nullptr),
blocked_(src.blocked_)
{
@@ -219,7 +219,7 @@ slot_base& slot_base::operator=(const slot_base& src)
return *this;
}
-slot_base& slot_base::operator=(slot_base&& src) noexcept
+slot_base& slot_base::operator=(slot_base&& src)
{
if (src.rep_ == rep_)
{
diff --git a/sigc++/functors/slot_base.h b/sigc++/functors/slot_base.h
index ec7679a..6577574 100644
--- a/sigc++/functors/slot_base.h
+++ b/sigc++/functors/slot_base.h
@@ -244,6 +244,10 @@ class SIGC_API slot_base : public functor_base
{
typedef internal::slot_rep rep_type;
+ // Move operations are not declared noexcept because
+ // 1. they may copy instead of move
+ // 2. when they don't copy, they call src.rep_->notify_callbacks(), which
+ // may throw an exception.
public:
/// Constructs an empty slot.
slot_base();
@@ -262,7 +266,7 @@ public:
* If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
* @param src The existing slot to move or copy.
*/
- slot_base(slot_base&& src) noexcept;
+ slot_base(slot_base&& src);
~slot_base();
@@ -344,7 +348,7 @@ public:
* @param src The slot from which to move or copy.
* @return @p this.
*/
- slot_base& operator=(slot_base&& src) noexcept;
+ slot_base& operator=(slot_base&& src);
public: // public to avoid template friend declarations
/** Typed slot_rep object that contains a functor. */
diff --git a/sigc++/signal_base.cc b/sigc++/signal_base.cc
index 64226b8..7885a53 100644
--- a/sigc++/signal_base.cc
+++ b/sigc++/signal_base.cc
@@ -167,7 +167,7 @@ signal_base::signal_base(const signal_base& src)
impl_->reference();
}
-signal_base::signal_base(signal_base&& src) noexcept
+signal_base::signal_base(signal_base&& src)
: trackable(std::move(src)),
impl_(std::move(src.impl_))
{
@@ -248,7 +248,7 @@ signal_base& signal_base::operator=(const signal_base& src)
return *this;
}
-signal_base& signal_base::operator=(signal_base&& src) noexcept
+signal_base& signal_base::operator=(signal_base&& src)
{
if (src.impl_ == impl_) return *this;
diff --git a/sigc++/signal_base.h b/sigc++/signal_base.h
index 1842b02..03ae156 100644
--- a/sigc++/signal_base.h
+++ b/sigc++/signal_base.h
@@ -290,13 +290,13 @@ struct SIGC_API signal_base : public trackable
signal_base(const signal_base& src);
- signal_base(signal_base&& src) noexcept;
+ signal_base(signal_base&& src);
~signal_base();
signal_base& operator=(const signal_base& src);
- signal_base& operator=(signal_base&& src) noexcept;
+ signal_base& operator=(signal_base&& src);
/** Returns whether the list of slots is empty.
* @return @p true if the list of slots is empty.
diff --git a/sigc++/trackable.cc b/sigc++/trackable.cc
index 385f97c..9faabc1 100644
--- a/sigc++/trackable.cc
+++ b/sigc++/trackable.cc
@@ -43,7 +43,7 @@ trackable::trackable(const trackable& /*src*/)
//
// If trackable's move constructor is modified, check if Glib::Object's
// move constructor should be modified similarly.
-trackable::trackable(trackable&& src) noexcept
+trackable::trackable(trackable&& src)
: callback_list_(nullptr)
{
src.notify_callbacks();
@@ -57,7 +57,7 @@ trackable& trackable::operator=(const trackable& src)
return *this;
}
-trackable& trackable::operator=(trackable&& src) noexcept
+trackable& trackable::operator=(trackable&& src)
{
if(this != &src)
{
diff --git a/sigc++/trackable.h b/sigc++/trackable.h
index af8042a..b82bbbb 100644
--- a/sigc++/trackable.h
+++ b/sigc++/trackable.h
@@ -108,15 +108,20 @@ private:
*/
struct SIGC_API trackable
{
+ // Concerning noexcept specifications:
+ // libsigc++ does not have complete control of what happens when notify_callbacks()
+ // is called. It may throw an exception. A method that calls notify_callbacks()
+ // shall not be declared noexcept.
+
trackable();
trackable(const trackable& src);
- trackable(trackable&& src) noexcept;
+ trackable(trackable&& src);
trackable& operator=(const trackable& src);
- trackable& operator=(trackable&& src) noexcept;
+ trackable& operator=(trackable&& src);
~trackable();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]