aboutsummaryrefslogtreecommitdiffstats
path: root/al/direct_defs.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-05-22 02:25:30 -0700
committerChris Robinson <[email protected]>2023-05-22 02:25:30 -0700
commiteca86489e422f00d96ce59a5c53fa45bdcea593e (patch)
tree023fafac55d3dc6888021fccf444f0e0990f3b83 /al/direct_defs.h
parent586b725cc37345601f01473dcc622241ee80d174 (diff)
Make the API functions noexcept
Only relevant for C++, but these functions can't throw as it's a C-based API. Letting the compiler know that helps improve code generation. Extension callbacks must also not let exceptions leave the callback, or else Bad Things can happen. The macro AL_DISABLE_NOEXCEPT may be defined before including the headers to not mark functions as noexcept, but this should only be done if the caller can't otherwise be fixed.
Diffstat (limited to 'al/direct_defs.h')
-rw-r--r--al/direct_defs.h52
1 files changed, 26 insertions, 26 deletions
diff --git a/al/direct_defs.h b/al/direct_defs.h
index e483fc71..d8946eb4 100644
--- a/al/direct_defs.h
+++ b/al/direct_defs.h
@@ -12,108 +12,108 @@ constexpr void DefaultVal() noexcept { }
} // namespace detail_
#define DECL_FUNC(R, Name) \
-R AL_APIENTRY Name(void) START_API_FUNC \
+R AL_APIENTRY Name(void) noexcept \
{ \
auto context = GetContextRef(); \
if(!context) UNLIKELY return detail_::DefaultVal<R>(); \
return Name##Direct(context.get()); \
-} END_API_FUNC
+}
#define DECL_FUNC1(R, Name, T1) \
-R AL_APIENTRY Name(T1 a) START_API_FUNC \
+R AL_APIENTRY Name(T1 a) noexcept \
{ \
auto context = GetContextRef(); \
if(!context) UNLIKELY return detail_::DefaultVal<R>(); \
return Name##Direct(context.get(), a); \
-} END_API_FUNC
+}
#define DECL_FUNC2(R, Name, T1, T2) \
-R AL_APIENTRY Name(T1 a, T2 b) START_API_FUNC \
+R AL_APIENTRY Name(T1 a, T2 b) noexcept \
{ \
auto context = GetContextRef(); \
if(!context) UNLIKELY return detail_::DefaultVal<R>(); \
return Name##Direct(context.get(), a, b); \
-} END_API_FUNC
+}
#define DECL_FUNC3(R, Name, T1, T2, T3) \
-R AL_APIENTRY Name(T1 a, T2 b, T3 c) START_API_FUNC \
+R AL_APIENTRY Name(T1 a, T2 b, T3 c) noexcept \
{ \
auto context = GetContextRef(); \
if(!context) UNLIKELY return detail_::DefaultVal<R>(); \
return Name##Direct(context.get(), a, b, c); \
-} END_API_FUNC
+}
#define DECL_FUNC4(R, Name, T1, T2, T3, T4) \
-R AL_APIENTRY Name(T1 a, T2 b, T3 c, T4 d) START_API_FUNC \
+R AL_APIENTRY Name(T1 a, T2 b, T3 c, T4 d) noexcept \
{ \
auto context = GetContextRef(); \
if(!context) UNLIKELY return detail_::DefaultVal<R>(); \
return Name##Direct(context.get(), a, b, c, d); \
-} END_API_FUNC
+}
#define DECL_FUNC5(R, Name, T1, T2, T3, T4, T5) \
-R AL_APIENTRY Name(T1 a, T2 b, T3 c, T4 d, T5 e) START_API_FUNC \
+R AL_APIENTRY Name(T1 a, T2 b, T3 c, T4 d, T5 e) noexcept \
{ \
auto context = GetContextRef(); \
if(!context) UNLIKELY return detail_::DefaultVal<R>(); \
return Name##Direct(context.get(), a, b, c, d, e); \
-} END_API_FUNC
+}
#define DECL_FUNCEXT(R, Name,Ext) \
-R AL_APIENTRY Name##Ext(void) START_API_FUNC \
+R AL_APIENTRY Name##Ext(void) noexcept \
{ \
auto context = GetContextRef(); \
if(!context) UNLIKELY return detail_::DefaultVal<R>(); \
return Name##Direct##Ext(context.get()); \
-} END_API_FUNC
+}
#define DECL_FUNCEXT1(R, Name,Ext, T1) \
-R AL_APIENTRY Name##Ext(T1 a) START_API_FUNC \
+R AL_APIENTRY Name##Ext(T1 a) noexcept \
{ \
auto context = GetContextRef(); \
if(!context) UNLIKELY return detail_::DefaultVal<R>(); \
return Name##Direct##Ext(context.get(), a); \
-} END_API_FUNC
+}
#define DECL_FUNCEXT2(R, Name,Ext, T1, T2) \
-R AL_APIENTRY Name##Ext(T1 a, T2 b) START_API_FUNC \
+R AL_APIENTRY Name##Ext(T1 a, T2 b) noexcept \
{ \
auto context = GetContextRef(); \
if(!context) UNLIKELY return detail_::DefaultVal<R>(); \
return Name##Direct##Ext(context.get(), a, b); \
-} END_API_FUNC
+}
#define DECL_FUNCEXT3(R, Name,Ext, T1, T2, T3) \
-R AL_APIENTRY Name##Ext(T1 a, T2 b, T3 c) START_API_FUNC \
+R AL_APIENTRY Name##Ext(T1 a, T2 b, T3 c) noexcept \
{ \
auto context = GetContextRef(); \
if(!context) UNLIKELY return detail_::DefaultVal<R>(); \
return Name##Direct##Ext(context.get(), a, b, c); \
-} END_API_FUNC
+}
#define DECL_FUNCEXT4(R, Name,Ext, T1, T2, T3, T4) \
-R AL_APIENTRY Name##Ext(T1 a, T2 b, T3 c, T4 d) START_API_FUNC \
+R AL_APIENTRY Name##Ext(T1 a, T2 b, T3 c, T4 d) noexcept \
{ \
auto context = GetContextRef(); \
if(!context) UNLIKELY return detail_::DefaultVal<R>(); \
return Name##Direct##Ext(context.get(), a, b, c, d); \
-} END_API_FUNC
+}
#define DECL_FUNCEXT5(R, Name,Ext, T1, T2, T3, T4, T5) \
-R AL_APIENTRY Name##Ext(T1 a, T2 b, T3 c, T4 d, T5 e) START_API_FUNC \
+R AL_APIENTRY Name##Ext(T1 a, T2 b, T3 c, T4 d, T5 e) noexcept \
{ \
auto context = GetContextRef(); \
if(!context) UNLIKELY return detail_::DefaultVal<R>(); \
return Name##Direct##Ext(context.get(), a, b, c, d, e); \
-} END_API_FUNC
+}
#define DECL_FUNCEXT6(R, Name,Ext, T1, T2, T3, T4, T5, T6) \
-R AL_APIENTRY Name##Ext(T1 a, T2 b, T3 c, T4 d, T5 e, T6 f) START_API_FUNC \
+R AL_APIENTRY Name##Ext(T1 a, T2 b, T3 c, T4 d, T5 e, T6 f) noexcept \
{ \
auto context = GetContextRef(); \
if(!context) UNLIKELY return detail_::DefaultVal<R>(); \
return Name##Direct##Ext(context.get(), a, b, c, d, e, f); \
-} END_API_FUNC
+}
#endif /* AL_DIRECT_DEFS_H */