summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-08-01 18:59:18 +0200
committerDavid Robillard <d@drobilla.net>2020-08-02 01:48:48 +0200
commit7b70b455e6199b508217b021d9a0dfc08f9a7794 (patch)
treecb005e7cd9414cc3eb4b7c1baa52de69664dcd02
parent848bb52824657c20b1d758aebcecefb5d8c37fb9 (diff)
downloadingen-7b70b455e6199b508217b021d9a0dfc08f9a7794.tar.gz
ingen-7b70b455e6199b508217b021d9a0dfc08f9a7794.tar.bz2
ingen-7b70b455e6199b508217b021d9a0dfc08f9a7794.zip
Use default member initialization
-rw-r--r--.clang-tidy1
-rw-r--r--ingen/Atom.hpp11
-rw-r--r--ingen/Interface.hpp4
-rw-r--r--src/gui/GraphBox.cpp5
-rw-r--r--src/gui/GraphBox.hpp8
-rw-r--r--src/gui/Window.hpp20
-rw-r--r--src/server/Broadcaster.cpp5
-rw-r--r--src/server/Broadcaster.hpp6
-rw-r--r--src/server/PortImpl.hpp8
-rw-r--r--src/server/ingen_lv2.cpp13
-rw-r--r--src/server/internals/Note.hpp16
11 files changed, 43 insertions, 54 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 49c7b51d..f2b07217 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -55,7 +55,6 @@ Checks: >
-llvm-namespace-comment,
-misc-unused-parameters,
-modernize-redundant-void-arg,
- -modernize-use-default-member-init,
-modernize-use-trailing-return-type,
-modernize-use-using,
-portability-simd-intrinsics,
diff --git a/ingen/Atom.hpp b/ingen/Atom.hpp
index e92ab194..3fb8f091 100644
--- a/ingen/Atom.hpp
+++ b/ingen/Atom.hpp
@@ -43,7 +43,7 @@ namespace ingen {
*/
class INGEN_API Atom {
public:
- Atom() noexcept : _atom{0, 0}, _body{} {}
+ Atom() noexcept = default;
~Atom() { dealloc(); }
@@ -53,7 +53,6 @@ public:
*/
Atom(uint32_t size, LV2_URID type, const void* body)
: _atom{size, type}
- , _body{}
{
if (is_reference()) {
_body.ptr = static_cast<LV2_Atom*>(malloc(sizeof(LV2_Atom) + size));
@@ -66,7 +65,6 @@ public:
Atom(const Atom& copy)
: _atom{copy._atom}
- , _body{}
{
if (is_reference()) {
_body.ptr =
@@ -172,11 +170,12 @@ private:
return _atom.size > sizeof(_body.val);
}
- LV2_Atom _atom;
- union {
+ LV2_Atom _atom = {0, 0};
+ union
+ {
intptr_t val;
LV2_Atom* ptr;
- } _body;
+ } _body = {};
};
} // namespace ingen
diff --git a/ingen/Interface.hpp b/ingen/Interface.hpp
index 10d7d4bf..33180364 100644
--- a/ingen/Interface.hpp
+++ b/ingen/Interface.hpp
@@ -49,7 +49,7 @@ class INGEN_API Interface
public:
using result_type = void;
- Interface() : _seq(0) {}
+ Interface() {}
virtual ~Interface() = default;
@@ -141,7 +141,7 @@ public:
/** @} */
private:
- int32_t _seq;
+ int32_t _seq = 0;
};
} // namespace ingen
diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp
index 0905a967..42a4bc23 100644
--- a/src/gui/GraphBox.cpp
+++ b/src/gui/GraphBox.cpp
@@ -64,11 +64,6 @@ static const int STATUS_CONTEXT_HOVER = 2;
GraphBox::GraphBox(BaseObjectType* cobject,
const Glib::RefPtr<Gtk::Builder>& xml)
: Gtk::VBox(cobject)
- , _app(nullptr)
- , _window(nullptr)
- , _breadcrumbs(nullptr)
- , _has_shown_documentation(false)
- , _enable_signal(true)
{
property_visible() = false;
diff --git a/src/gui/GraphBox.hpp b/src/gui/GraphBox.hpp
index 3a1049cd..175ad392 100644
--- a/src/gui/GraphBox.hpp
+++ b/src/gui/GraphBox.hpp
@@ -144,10 +144,10 @@ private:
void event_show_engine();
void event_clipboard_changed(GdkEventOwnerChange* ev);
- App* _app;
+ App* _app = nullptr;
SPtr<const client::GraphModel> _graph;
SPtr<GraphView> _view;
- GraphWindow* _window;
+ GraphWindow* _window = nullptr;
sigc::connection new_port_connection;
sigc::connection removed_port_connection;
@@ -204,8 +204,8 @@ private:
/** Invisible bin used to store breadcrumbs when not shown by a view */
Gtk::Alignment _breadcrumb_bin;
- bool _has_shown_documentation;
- bool _enable_signal;
+ bool _has_shown_documentation = false;
+ bool _enable_signal = true;
};
} // namespace gui
diff --git a/src/gui/Window.hpp b/src/gui/Window.hpp
index ab3586fc..f5b323f0 100644
--- a/src/gui/Window.hpp
+++ b/src/gui/Window.hpp
@@ -33,8 +33,12 @@ class App;
class Window : public Gtk::Window
{
public:
- Window() : _app(nullptr) {}
- explicit Window(BaseObjectType* cobject) : Gtk::Window(cobject), _app(nullptr) {}
+ Window() = default;
+
+ explicit Window(BaseObjectType* cobject)
+ : Gtk::Window(cobject)
+ {
+ }
virtual void init_window(App& app) { _app = &app; }
@@ -48,7 +52,7 @@ public:
static bool key_press_handler(Gtk::Window* win, GdkEventKey* event);
- App* _app;
+ App* _app = nullptr;
};
/** Ingen GUI Dialog
@@ -57,8 +61,12 @@ public:
class Dialog : public Gtk::Dialog
{
public:
- Dialog() : _app(nullptr) {}
- explicit Dialog(BaseObjectType* cobject) : Gtk::Dialog(cobject), _app(nullptr) {}
+ Dialog() = default;
+
+ explicit Dialog(BaseObjectType* cobject)
+ : Gtk::Dialog(cobject)
+ {
+ }
virtual void init_dialog(App& app) { _app = &app; }
@@ -70,7 +78,7 @@ public:
return Gtk::Window::on_key_press_event(event);
}
- App* _app;
+ App* _app = nullptr;
};
} // namespace gui
diff --git a/src/server/Broadcaster.cpp b/src/server/Broadcaster.cpp
index 914b891b..b7dc4526 100644
--- a/src/server/Broadcaster.cpp
+++ b/src/server/Broadcaster.cpp
@@ -27,11 +27,6 @@
namespace ingen {
namespace server {
-Broadcaster::Broadcaster()
- : _must_broadcast(false)
- , _bundle_depth(0)
-{}
-
Broadcaster::~Broadcaster()
{
std::lock_guard<std::mutex> lock(_clients_mutex);
diff --git a/src/server/Broadcaster.hpp b/src/server/Broadcaster.hpp
index d8857356..66487766 100644
--- a/src/server/Broadcaster.hpp
+++ b/src/server/Broadcaster.hpp
@@ -42,7 +42,7 @@ namespace server {
class Broadcaster : public Interface
{
public:
- Broadcaster();
+ Broadcaster() = default;
~Broadcaster();
void register_client(const SPtr<Interface>& client);
@@ -114,8 +114,8 @@ private:
std::mutex _clients_mutex;
Clients _clients;
std::set< SPtr<Interface> > _broadcastees;
- std::atomic<bool> _must_broadcast;
- unsigned _bundle_depth;
+ std::atomic<bool> _must_broadcast{false};
+ unsigned _bundle_depth{0};
SPtr<Interface> _ignore_client;
};
diff --git a/src/server/PortImpl.hpp b/src/server/PortImpl.hpp
index 05664ee5..fa204310 100644
--- a/src/server/PortImpl.hpp
+++ b/src/server/PortImpl.hpp
@@ -61,7 +61,7 @@ public:
SET
};
- SetState() : state(State::SET), value(0), time(0) {}
+ SetState() = default;
void set(const RunContext& ctx, FrameTime t, Sample v) {
time = t;
@@ -71,9 +71,9 @@ public:
: State::HALF_SET_CYCLE_1);
}
- State state; ///< State of buffer for setting control value
- Sample value; ///< Value currently being set
- FrameTime time; ///< Time value was set
+ State state = State::SET; ///< State for setting control value
+ Sample value = 0; ///< Value currently being set
+ FrameTime time = 0; ///< Time value was set
};
struct Voice {
diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp
index 998ca28a..a38be08b 100644
--- a/src/server/ingen_lv2.cpp
+++ b/src/server/ingen_lv2.cpp
@@ -451,19 +451,12 @@ ingen_lv2_main(const SPtr<Engine>& engine, const SPtr<LV2Driver>& driver)
}
struct IngenPlugin {
- IngenPlugin()
- : main(nullptr)
- , map(nullptr)
- , argc(0)
- , argv(nullptr)
- {}
-
UPtr<ingen::World> world;
SPtr<Engine> engine;
UPtr<std::thread> main;
- LV2_URID_Map* map;
- int argc;
- char** argv;
+ LV2_URID_Map* map = nullptr;
+ int argc = 0;
+ char** argv = nullptr;
};
static Lib::Graphs
diff --git a/src/server/internals/Note.hpp b/src/server/internals/Note.hpp
index c986a745..0a7d80c9 100644
--- a/src/server/internals/Note.hpp
+++ b/src/server/internals/Note.hpp
@@ -69,19 +69,19 @@ private:
/** Key, one for each key on the keyboard */
struct Key {
enum class State { OFF, ON_ASSIGNED, ON_UNASSIGNED };
- Key() : state(State::OFF), voice(0), time(0) {}
- State state;
- uint32_t voice;
- SampleCount time;
+
+ State state = State::OFF;
+ uint32_t voice = 0;
+ SampleCount time = 0;
};
/** Voice, one of these always exists for each voice */
struct Voice {
enum class State { FREE, ACTIVE, HOLDING };
- Voice() : state(State::FREE), note(0), time(0) {}
- State state;
- uint8_t note;
- SampleCount time;
+
+ State state = State::FREE;
+ uint8_t note = 0;
+ SampleCount time = 0;
};
using Voices = Raul::Array<Voice>;