Commit 30a2a543 authored by Dominik Charousset's avatar Dominik Charousset

Fix noexcept warning on GCC

parent 8598816e
...@@ -160,7 +160,7 @@ public: ...@@ -160,7 +160,7 @@ public:
/// Closes this inbox and moves all elements to the queue. /// Closes this inbox and moves all elements to the queue.
/// @warning Call only from the reader (owner). /// @warning Call only from the reader (owner).
void close() { void close() {
auto f = [&](pointer x) { auto f = [&](pointer x) noexcept {
queue_.lifo_append(x); queue_.lifo_append(x);
}; };
inbox_.close(f); inbox_.close(f);
......
...@@ -168,7 +168,7 @@ public: ...@@ -168,7 +168,7 @@ public:
/// `f` must take ownership of the passed pointer. /// `f` must take ownership of the passed pointer.
/// @warning Call only from the reader (owner). /// @warning Call only from the reader (owner).
template <class F> template <class F>
void close(F& f) noexcept(noexcept(f(std::declval<pointer>()))) { void close(F& f) noexcept {
node_pointer ptr = take_head(stack_closed_tag()); node_pointer ptr = take_head(stack_closed_tag());
while (ptr != nullptr) { while (ptr != nullptr) {
auto next = ptr->next; auto next = ptr->next;
......
...@@ -36,7 +36,11 @@ struct singly_linked { ...@@ -36,7 +36,11 @@ struct singly_linked {
// -- constructors, destructors, and assignment operators -------------------- // -- constructors, destructors, and assignment operators --------------------
singly_linked(node_pointer n = nullptr) : next(n) { singly_linked() noexcept : next(nullptr) {
// nop
}
explicit singly_linked(node_pointer n) noexcept : next(n) {
// nop // nop
} }
...@@ -48,13 +52,13 @@ struct singly_linked { ...@@ -48,13 +52,13 @@ struct singly_linked {
/// Casts a node type to its value type. /// Casts a node type to its value type.
template <class T> template <class T>
T* promote(singly_linked<T>* ptr) { T* promote(singly_linked<T>* ptr) noexcept {
return static_cast<T*>(ptr); return static_cast<T*>(ptr);
} }
/// Casts a node type to its value type. /// Casts a node type to its value type.
template <class T> template <class T>
const T* promote(const singly_linked<T>* ptr) { const T* promote(const singly_linked<T>* ptr) noexcept {
return static_cast<const T*>(ptr); return static_cast<const T*>(ptr);
} }
......
...@@ -69,7 +69,7 @@ public: ...@@ -69,7 +69,7 @@ public:
init(); init();
} }
task_queue(task_queue&& other) : task_queue(other.policy()) { task_queue(task_queue&& other) noexcept : task_queue(other.policy()) {
if (other.empty()) { if (other.empty()) {
init(); init();
} else { } else {
...@@ -81,7 +81,7 @@ public: ...@@ -81,7 +81,7 @@ public:
} }
} }
task_queue& operator=(task_queue&& other) { task_queue& operator=(task_queue&& other) noexcept {
deinit(); deinit();
if (other.empty()) { if (other.empty()) {
init(); init();
...@@ -261,7 +261,7 @@ public: ...@@ -261,7 +261,7 @@ public:
/// Transfers all element from `other` to the front of this queue. /// Transfers all element from `other` to the front of this queue.
template <class Container> template <class Container>
void prepend(Container& other) { void prepend(Container& other) noexcept {
if (other.empty()) if (other.empty())
return; return;
if (empty()) { if (empty()) {
...@@ -276,7 +276,7 @@ public: ...@@ -276,7 +276,7 @@ public:
/// Transfers all element from `other` to the back of this queue. /// Transfers all element from `other` to the back of this queue.
template <class Container> template <class Container>
void append(Container& other) { void append(Container& other) noexcept {
if (other.empty()) if (other.empty())
return; return;
if (empty()) { if (empty()) {
...@@ -296,7 +296,7 @@ public: ...@@ -296,7 +296,7 @@ public:
/// @warning leaves the queue in an invalid state until calling /// @warning leaves the queue in an invalid state until calling
/// `stop_lifo_append`. /// `stop_lifo_append`.
/// @private /// @private
void lifo_append(node_pointer ptr) { void lifo_append(node_pointer ptr) noexcept {
if (old_last_ == nullptr) { if (old_last_ == nullptr) {
old_last_ = back(); old_last_ = back();
push_back(promote(ptr)); push_back(promote(ptr));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment