aboutsummaryrefslogtreecommitdiffstats
path: root/al/state.cpp
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/state.cpp
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/state.cpp')
-rw-r--r--al/state.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/al/state.cpp b/al/state.cpp
index 60d18818..2b6c1bb2 100644
--- a/al/state.cpp
+++ b/al/state.cpp
@@ -294,14 +294,12 @@ inline void UpdateProps(ALCcontext *context)
/* WARNING: Non-standard export! Not part of any extension, or exposed in the
* alcFunctions list.
*/
-AL_API const ALchar* AL_APIENTRY alsoft_get_version(void)
-START_API_FUNC
+AL_API const ALchar* AL_APIENTRY alsoft_get_version(void) noexcept
{
static const auto spoof = al::getenv("ALSOFT_SPOOF_VERSION");
if(spoof) return spoof->c_str();
return ALSOFT_VERSION;
}
-END_API_FUNC
FORCE_ALIGN void AL_APIENTRY alEnableDirect(ALCcontext *context, ALenum capability) noexcept
@@ -380,14 +378,14 @@ FORCE_ALIGN ALboolean AL_APIENTRY alIsEnabledDirect(ALCcontext *context, ALenum
}
#define DECL_GETFUNC(R, Name, Ext) \
-AL_API R AL_APIENTRY Name##Ext(ALenum pname) START_API_FUNC \
+AL_API R AL_APIENTRY Name##Ext(ALenum pname) noexcept \
{ \
R value{}; \
auto context = GetContextRef(); \
if(!context) UNLIKELY return value; \
Name##vDirect##Ext(GetContextRef().get(), pname, &value); \
return value; \
-} END_API_FUNC \
+} \
FORCE_ALIGN R AL_APIENTRY Name##Direct##Ext(ALCcontext *context, ALenum pname) noexcept \
{ \
R value{}; \
@@ -614,7 +612,7 @@ AL_API DECL_FUNCEXT(void, alDeferUpdates,SOFT)
AL_API DECL_FUNCEXT(void, alProcessUpdates,SOFT)
AL_API DECL_FUNCEXT2(const ALchar*, alGetStringi,SOFT, ALenum,ALsizei)
-AL_API void AL_APIENTRY alDopplerVelocity(ALfloat value) START_API_FUNC
+AL_API void AL_APIENTRY alDopplerVelocity(ALfloat value) noexcept
{
ContextRef context{GetContextRef()};
if(!context) UNLIKELY return;
@@ -633,7 +631,7 @@ AL_API void AL_APIENTRY alDopplerVelocity(ALfloat value) START_API_FUNC
context->mDopplerVelocity = value;
UpdateProps(context.get());
}
-} END_API_FUNC
+}
void UpdateContextProps(ALCcontext *context)