From eca86489e422f00d96ce59a5c53fa45bdcea593e Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 22 May 2023 02:25:30 -0700 Subject: 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. --- al/error.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'al/error.cpp') diff --git a/al/error.cpp b/al/error.cpp index 8e6bb3b8..3a1a9ac3 100644 --- a/al/error.cpp +++ b/al/error.cpp @@ -93,7 +93,7 @@ void ALCcontext::setError(ALenum errorCode, const char *msg, ...) /* Special-case alGetError since it (potentially) raises a debug signal and * returns a non-default value for a null context. */ -AL_API ALenum AL_APIENTRY alGetError(void) START_API_FUNC +AL_API ALenum AL_APIENTRY alGetError(void) noexcept { auto context = GetContextRef(); if(!context) UNLIKELY @@ -112,7 +112,7 @@ AL_API ALenum AL_APIENTRY alGetError(void) START_API_FUNC return deferror; } return alGetErrorDirect(context.get()); -} END_API_FUNC +} FORCE_ALIGN ALenum AL_APIENTRY alGetErrorDirect(ALCcontext *context) noexcept { -- cgit v1.2.3