Add noexcept qualifications in src/common

Apparently this can actually make a difference in some cases, and the
C++ Core Guideliens recommend doing this on all default constructors,
destructors, and all functions that can not throw (and thus also don't
allocate).
This commit is contained in:
Robbert van der Helm
2021-05-14 17:12:24 +02:00
parent db6ecdbbd4
commit 59ba2aeb5f
126 changed files with 536 additions and 515 deletions
+4 -1
View File
@@ -217,7 +217,7 @@ class Sockets {
*
* @note Classes overriding this should call `close()` in their destructor.
*/
virtual ~Sockets() {
virtual ~Sockets() noexcept {
try {
// NOTE: Because someone has wiped their home directory in the past
// by manually modifying the socket base directory argument
@@ -239,6 +239,9 @@ class Sockets {
// There should not be any filesystem errors since only one side
// removes the files, but if we somehow can't delete the file
// then we can just silently ignore this
} catch (const std::bad_alloc&) {
// If we cannot clean up because we're out of memory, then that's
// fine
}
}
+2
View File
@@ -16,6 +16,8 @@
#include "vst2.h"
DefaultDataConverter::~DefaultDataConverter() noexcept {}
EventPayload DefaultDataConverter::read(const int /*opcode*/,
const int /*index*/,
const intptr_t /*value*/,
+2 -2
View File
@@ -30,7 +30,7 @@
*/
class DefaultDataConverter {
public:
virtual ~DefaultDataConverter(){};
virtual ~DefaultDataConverter() noexcept;
/**
* Read data from the `data` void pointer into a an `EventPayload` value
@@ -315,7 +315,7 @@ class Vst2Sockets : public Sockets {
(base_dir / "host_vst_control.sock").string(),
listen) {}
~Vst2Sockets() { close(); }
~Vst2Sockets() noexcept override { close(); }
void connect() override {
host_vst_dispatch.connect();
+1 -1
View File
@@ -326,7 +326,7 @@ class Vst3Sockets : public Sockets {
io_context(io_context) {}
// NOLINTNEXTLINE(clang-analyzer-optin.cplusplus.VirtualCall)
~Vst3Sockets() { close(); }
~Vst3Sockets() noexcept override { close(); }
void connect() override {
host_vst_control.connect();