From a0a41921fc28a1ff76a5850936cb32e912887735 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 21 Apr 2017 16:58:55 -0700 Subject: Remove const from _Atomic vars to make Clang happy Clang does not allow using C11's atomic_load on const _Atomic variables. Previously it just disabled use of C11 atomics if atomic_load didn't work on a const _Atomic variable, but I think I'd prefer to have Clang use C11 atomics for the added features (more explicit memory ordering) even if it means a few instances of breaking const. --- OpenAL32/Include/alMain.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'OpenAL32/Include/alMain.h') diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index b604c547..174210fa 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -204,6 +204,20 @@ AL_API const ALchar* AL_APIENTRY alGetStringiSOFT(ALenum pname, ALsizei index); #endif +#ifdef __GNUC__ +/* This helps cast away the const-ness of a pointer without accidentally + * changing the pointer type. This is necessary due to Clang's inability to use + * atomic_load on a const _Atomic variable. + */ +#define CONST_CAST(T, V) __extension__({ \ + const T _tmp = (V); \ + (T)_tmp; \ +}) +#else +#define CONST_CAST(T, V) ((T)(V)) +#endif + + typedef ALint64SOFT ALint64; typedef ALuint64SOFT ALuint64; -- cgit v1.2.3