aboutsummaryrefslogtreecommitdiffstats
path: root/common/alexcpt.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-04-09 20:48:01 -0700
committerChris Robinson <[email protected]>2019-04-09 20:48:01 -0700
commit460a01443c925013f3f9dadeab5d07373ac5c894 (patch)
tree10d4f7bbe3eeec95f462403574a335b9e9b05495 /common/alexcpt.h
parente6daab51e8cd06c66680eb88e4b83ca3fb5918b0 (diff)
Add macros to stop exceptions from leaving API functions
Effectively makes the functions act as noexcept, since there's no meaningful reason to propogate exceptions from "C" functions. Currently only applied to ALC functions, but can incrementally be applied to AL functions too. In the future, this could also handle ALC and AL errors with unique exception types (functions that utilize this behavior would need to ensure proper cleanup).
Diffstat (limited to 'common/alexcpt.h')
-rw-r--r--common/alexcpt.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/common/alexcpt.h b/common/alexcpt.h
new file mode 100644
index 00000000..3e31667e
--- /dev/null
+++ b/common/alexcpt.h
@@ -0,0 +1,11 @@
+#ifndef ALEXCPT_H
+#define ALEXCPT_H
+
+#include <exception>
+
+
+#define START_API_FUNC try
+
+#define END_API_FUNC catch(...) { std::terminate(); }
+
+#endif /* ALEXCPT_H */