mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-14 04:19:59 +02:00
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:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
#include "vst2.h"
|
||||
|
||||
DefaultDataConverter::~DefaultDataConverter() noexcept {}
|
||||
|
||||
EventPayload DefaultDataConverter::read(const int /*opcode*/,
|
||||
const int /*index*/,
|
||||
const intptr_t /*value*/,
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user