summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-12-19 12:20:43 +0100
committerDavid Robillard <d@drobilla.net>2020-12-19 12:20:43 +0100
commit40f3c3f66f532941ca9576852827d636000f2477 (patch)
tree18eb788aa336d14d6b90b91aae56e62af83069e2
parentcce18a14f18b1aa63949de77f4f370ba82708cf3 (diff)
downloadraul-40f3c3f66f532941ca9576852827d636000f2477.tar.gz
raul-40f3c3f66f532941ca9576852827d636000f2477.tar.bz2
raul-40f3c3f66f532941ca9576852827d636000f2477.zip
Clean up special member functions
-rw-r--r--include/.clang-tidy1
-rw-r--r--include/raul/Deletable.hpp7
-rw-r--r--include/raul/DoubleBuffer.hpp5
-rw-r--r--include/raul/Maid.hpp12
-rw-r--r--include/raul/Noncopyable.hpp3
-rw-r--r--include/raul/Path.hpp11
-rw-r--r--include/raul/RingBuffer.hpp11
-rw-r--r--include/raul/Semaphore.hpp3
-rw-r--r--include/raul/Socket.hpp3
-rw-r--r--include/raul/Symbol.hpp11
-rw-r--r--include/raul/TimeStamp.hpp7
-rw-r--r--test/.clang-tidy1
-rw-r--r--test/maid_test.cpp7
13 files changed, 64 insertions, 18 deletions
diff --git a/include/.clang-tidy b/include/.clang-tidy
index c385440..792d991 100644
--- a/include/.clang-tidy
+++ b/include/.clang-tidy
@@ -3,7 +3,6 @@ Checks: >
-*-avoid-c-arrays,
-*-magic-numbers,
-*-no-malloc,
- -*-special-member-functions,
-*-uppercase-literal-suffix,
-android-cloexec-accept,
-bugprone-branch-clone,
diff --git a/include/raul/Deletable.hpp b/include/raul/Deletable.hpp
index 9b80d54..191daaf 100644
--- a/include/raul/Deletable.hpp
+++ b/include/raul/Deletable.hpp
@@ -1,4 +1,3 @@
-
/*
This file is part of Raul.
Copyright 2007-2013 David Robillard <http://drobilla.net>
@@ -29,6 +28,12 @@ class Deletable
public:
Deletable() = default;
+ Deletable(const Deletable&) = default;
+ Deletable& operator=(const Deletable&) = default;
+
+ Deletable(Deletable&&) = default;
+ Deletable& operator=(Deletable&&) = default;
+
virtual ~Deletable() = default;
};
diff --git a/include/raul/DoubleBuffer.hpp b/include/raul/DoubleBuffer.hpp
index f6ab826..9163e0c 100644
--- a/include/raul/DoubleBuffer.hpp
+++ b/include/raul/DoubleBuffer.hpp
@@ -44,6 +44,11 @@ public:
DoubleBuffer(const DoubleBuffer&) = delete;
DoubleBuffer& operator=(const DoubleBuffer&) = delete;
+ DoubleBuffer(DoubleBuffer&&) = delete;
+ DoubleBuffer& operator=(DoubleBuffer&&) = delete;
+
+ ~DoubleBuffer() = default;
+
inline const T& get() const {
switch (_state.load(std::memory_order_acquire)) {
case State::READ_WRITE:
diff --git a/include/raul/Maid.hpp b/include/raul/Maid.hpp
index 9841f82..34061ad 100644
--- a/include/raul/Maid.hpp
+++ b/include/raul/Maid.hpp
@@ -43,9 +43,15 @@ public:
class Disposable : public Deletable {
public:
Disposable() = default;
+
Disposable(const Disposable&) = delete;
Disposable& operator=(const Disposable&) = delete;
+ Disposable(Disposable&&) = delete;
+ Disposable& operator=(Disposable&&) = delete;
+
+ ~Disposable() override = default;
+
private:
friend class Maid;
Disposable* _maid_next{};
@@ -87,6 +93,12 @@ public:
Maid() : _disposed(nullptr) {}
+ Maid(const Maid&) = delete;
+ Maid& operator=(const Maid&) = delete;
+
+ Maid(Maid&&) = delete;
+ Maid& operator=(Maid&&) = delete;
+
inline ~Maid() { cleanup(); }
/** Return false iff there is currently no garbage. */
diff --git a/include/raul/Noncopyable.hpp b/include/raul/Noncopyable.hpp
index 876cee8..7559f84 100644
--- a/include/raul/Noncopyable.hpp
+++ b/include/raul/Noncopyable.hpp
@@ -24,6 +24,9 @@ public:
Noncopyable(const Noncopyable&) = delete;
const Noncopyable& operator=(const Noncopyable&) = delete;
+ Noncopyable(Noncopyable&&) = delete;
+ Noncopyable& operator=(Noncopyable&&) = delete;
+
protected:
Noncopyable() = default;
~Noncopyable() = default;
diff --git a/include/raul/Path.hpp b/include/raul/Path.hpp
index 4fb3da1..984d95b 100644
--- a/include/raul/Path.hpp
+++ b/include/raul/Path.hpp
@@ -70,12 +70,13 @@ public:
}
}
- /** Copy a Path.
- *
- * Note this is faster than constructing a Path from another Path's string
- * since validation is unnecessary.
- */
Path(const Path& path) = default;
+ Path& operator=(const Path& path) = default;
+
+ Path(Path&& path) = default;
+ Path& operator=(Path&& path) = default;
+
+ ~Path() = default;
/** Return true iff `c` is a valid Path character. */
static inline bool is_valid_char(char c) {
diff --git a/include/raul/RingBuffer.hpp b/include/raul/RingBuffer.hpp
index b83f442..b6bde0d 100644
--- a/include/raul/RingBuffer.hpp
+++ b/include/raul/RingBuffer.hpp
@@ -52,10 +52,13 @@ public:
assert(write_space() == _size - 1);
}
- /**
- Destroy a RingBuffer.
- */
- inline ~RingBuffer() = default;
+ RingBuffer(const RingBuffer&) = delete;
+ RingBuffer& operator=(const RingBuffer&) = delete;
+
+ RingBuffer(RingBuffer&&) = delete;
+ RingBuffer& operator=(RingBuffer&&) = delete;
+
+ ~RingBuffer() = default;
/**
Reset (empty) the RingBuffer.
diff --git a/include/raul/Semaphore.hpp b/include/raul/Semaphore.hpp
index ee2325f..a6203dc 100644
--- a/include/raul/Semaphore.hpp
+++ b/include/raul/Semaphore.hpp
@@ -64,6 +64,9 @@ public:
inline Semaphore(const Semaphore&) = delete;
inline Semaphore& operator=(const Semaphore&) = delete;
+ inline Semaphore(Semaphore&&) = delete;
+ inline Semaphore& operator=(Semaphore&&) = delete;
+
inline ~Semaphore() {
destroy();
}
diff --git a/include/raul/Socket.hpp b/include/raul/Socket.hpp
index 74a1595..f3a4b07 100644
--- a/include/raul/Socket.hpp
+++ b/include/raul/Socket.hpp
@@ -53,6 +53,9 @@ public:
Socket(const Socket&) = delete;
Socket& operator=(const Socket&) = delete;
+ Socket(Socket&&) = delete;
+ Socket& operator=(Socket&&) = delete;
+
~Socket();
/** Bind a server socket to an address.
diff --git a/include/raul/Symbol.hpp b/include/raul/Symbol.hpp
index 4f762f8..35cd39d 100644
--- a/include/raul/Symbol.hpp
+++ b/include/raul/Symbol.hpp
@@ -69,12 +69,13 @@ public:
}
}
- /** Copy a Symbol.
- *
- * Note this is faster than constructing a Symbol from another Symbol's
- * string since validation is unnecessary.
- */
Symbol(const Symbol& symbol) = default;
+ Symbol& operator=(const Symbol& symbol) = default;
+
+ Symbol(Symbol&& symbol) = default;
+ Symbol& operator=(Symbol&& symbol) = default;
+
+ ~Symbol() = default;
/** Return true iff `c` is a valid Symbol start character. */
static inline bool is_valid_start_char(char c) {
diff --git a/include/raul/TimeStamp.hpp b/include/raul/TimeStamp.hpp
index ed9b479..5fd2353 100644
--- a/include/raul/TimeStamp.hpp
+++ b/include/raul/TimeStamp.hpp
@@ -99,9 +99,14 @@ public:
_subticks = static_cast<uint32_t>(fractional * unit.ppt());
}
- inline TimeStamp(const TimeStamp&) = default;
+ TimeStamp(const TimeStamp&) = default;
TimeStamp& operator=(const TimeStamp&) = default;
+ TimeStamp(TimeStamp&&) = default;
+ TimeStamp& operator=(TimeStamp&&) = default;
+
+ ~TimeStamp() = default;
+
inline TimeUnit unit() const { return _unit; }
inline uint32_t ticks() const { return _ticks; }
inline uint32_t subticks() const { return _subticks; }
diff --git a/test/.clang-tidy b/test/.clang-tidy
index eecf9fd..d22cba7 100644
--- a/test/.clang-tidy
+++ b/test/.clang-tidy
@@ -2,7 +2,6 @@ Checks: >
*,
-*-avoid-c-arrays,
-*-magic-numbers,
- -*-special-member-functions,
-*-uppercase-literal-suffix,
-*-vararg,
-abseil-string-find-str-contains,
diff --git a/test/maid_test.cpp b/test/maid_test.cpp
index 47781a0..c4b2dad 100644
--- a/test/maid_test.cpp
+++ b/test/maid_test.cpp
@@ -37,6 +37,13 @@ static std::atomic<size_t> n_finished_threads(0);
class Junk : public Maid::Disposable {
public:
explicit Junk(size_t v) : _val(v) { ++n_junk; }
+
+ Junk(const Junk&) = delete;
+ Junk& operator=(const Junk&) = delete;
+
+ Junk(Junk&&) = delete;
+ Junk& operator=(Junk&&) = delete;
+
~Junk() override { --n_junk; }
size_t value() const { return _val; }