aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-12-16 09:48:54 -0800
committerChris Robinson <[email protected]>2022-12-16 10:03:39 -0800
commit84cfef8513b88068e8ef66223d09b6c48d35caad (patch)
tree1dd3c6dfd8389e22f67fe7c5e03a145d46e5e8a8
parent8b806c07d716db41e0a463d455cf1a913b933a0f (diff)
Avoid inlining certain exception functions
-rw-r--r--al/eax/exception.cpp13
-rw-r--r--al/eax/exception.h17
-rw-r--r--al/effect.cpp1
-rw-r--r--al/effects/effects.h1
-rw-r--r--al/filter.cpp19
-rw-r--r--alc/backends/base.cpp14
-rw-r--r--alc/backends/base.h10
-rw-r--r--core/except.cpp3
-rw-r--r--core/except.h2
9 files changed, 42 insertions, 38 deletions
diff --git a/al/eax/exception.cpp b/al/eax/exception.cpp
index 3b319648..435e7442 100644
--- a/al/eax/exception.cpp
+++ b/al/eax/exception.cpp
@@ -6,17 +6,14 @@
#include <string>
-EaxException::EaxException(
- const char* context,
- const char* message)
- :
- std::runtime_error{make_message(context, message)}
+EaxException::EaxException(const char *context, const char *message)
+ : std::runtime_error{make_message(context, message)}
{
}
+EaxException::~EaxException() = default;
-std::string EaxException::make_message(
- const char* context,
- const char* message)
+
+std::string EaxException::make_message(const char *context, const char *message)
{
const auto context_size = (context ? std::string::traits_type::length(context) : 0);
const auto has_contex = (context_size > 0);
diff --git a/al/eax/exception.h b/al/eax/exception.h
index 9a7acf71..3ae88cdc 100644
--- a/al/eax/exception.h
+++ b/al/eax/exception.h
@@ -6,19 +6,12 @@
#include <string>
-class EaxException :
- public std::runtime_error
-{
-public:
- EaxException(
- const char* context,
- const char* message);
-
+class EaxException : public std::runtime_error {
+ static std::string make_message(const char *context, const char *message);
-private:
- static std::string make_message(
- const char* context,
- const char* message);
+public:
+ EaxException(const char *context, const char *message);
+ ~EaxException() override;
}; // EaxException
diff --git a/al/effect.cpp b/al/effect.cpp
index 21387cae..a4004a40 100644
--- a/al/effect.cpp
+++ b/al/effect.cpp
@@ -86,6 +86,7 @@ effect_exception::effect_exception(ALenum code, const char *msg, ...) : mErrorCo
setMessage(msg, args);
va_end(args);
}
+effect_exception::~effect_exception() = default;
namespace {
diff --git a/al/effects/effects.h b/al/effects/effects.h
index acfeec6a..70960a7f 100644
--- a/al/effects/effects.h
+++ b/al/effects/effects.h
@@ -22,6 +22,7 @@ public:
[[gnu::format(printf, 3, 4)]]
#endif
effect_exception(ALenum code, const char *msg, ...);
+ ~effect_exception() override;
ALenum errorCode() const noexcept { return mErrorCode; }
};
diff --git a/al/filter.cpp b/al/filter.cpp
index 298bef5d..68daee76 100644
--- a/al/filter.cpp
+++ b/al/filter.cpp
@@ -57,16 +57,21 @@ public:
#else
[[gnu::format(printf, 3, 4)]]
#endif
- filter_exception(ALenum code, const char *msg, ...) : mErrorCode{code}
- {
- std::va_list args;
- va_start(args, msg);
- setMessage(msg, args);
- va_end(args);
- }
+ filter_exception(ALenum code, const char *msg, ...);
+ ~filter_exception() override;
+
ALenum errorCode() const noexcept { return mErrorCode; }
};
+filter_exception::filter_exception(ALenum code, const char* msg, ...) : mErrorCode{code}
+{
+ std::va_list args;
+ va_start(args, msg);
+ setMessage(msg, args);
+ va_end(args);
+}
+filter_exception::~filter_exception() = default;
+
#define DEFINE_ALFILTER_VTABLE(T) \
const ALfilter::Vtable T##_vtable = { \
diff --git a/alc/backends/base.cpp b/alc/backends/base.cpp
index 6838c7e3..9cf5e30f 100644
--- a/alc/backends/base.cpp
+++ b/alc/backends/base.cpp
@@ -21,6 +21,20 @@
#include "core/devformat.h"
+namespace al {
+
+backend_exception::backend_exception(backend_error code, const char *msg, ...) : mErrorCode{code}
+{
+ std::va_list args;
+ va_start(args, msg);
+ setMessage(msg, args);
+ va_end(args);
+}
+backend_exception::~backend_exception() = default;
+
+} // namespace al
+
+
bool BackendBase::reset()
{ throw al::backend_exception{al::backend_error::DeviceError, "Invalid BackendBase call"}; }
diff --git a/alc/backends/base.h b/alc/backends/base.h
index 65bc636b..b6b3d922 100644
--- a/alc/backends/base.h
+++ b/alc/backends/base.h
@@ -103,13 +103,9 @@ public:
#else
[[gnu::format(printf, 3, 4)]]
#endif
- backend_exception(backend_error code, const char *msg, ...) : mErrorCode{code}
- {
- std::va_list args;
- va_start(args, msg);
- setMessage(msg, args);
- va_end(args);
- }
+ backend_exception(backend_error code, const char *msg, ...);
+ ~backend_exception() override;
+
backend_error errorCode() const noexcept { return mErrorCode; }
};
diff --git a/core/except.cpp b/core/except.cpp
index a77c7730..5405a8fe 100644
--- a/core/except.cpp
+++ b/core/except.cpp
@@ -11,9 +11,6 @@
namespace al {
-/* Defined here to avoid inlining it. */
-base_exception::~base_exception() = default;
-
void base_exception::setMessage(const char* msg, std::va_list args)
{
std::va_list args2;
diff --git a/core/except.h b/core/except.h
index 0e28e9df..af7257bf 100644
--- a/core/except.h
+++ b/core/except.h
@@ -14,7 +14,7 @@ class base_exception : public std::exception {
protected:
base_exception() = default;
- virtual ~base_exception();
+ virtual ~base_exception() = default;
void setMessage(const char *msg, std::va_list args);