From 6722ad196145ef7334d7478bdd375308801e7096 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 11 Sep 2023 19:34:55 -0700 Subject: Make some global and static member variables inline This also seems to work around the problematic MinGW code generation, so the indirection to access it can be removed. --- alc/context.h | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'alc/context.h') diff --git a/alc/context.h b/alc/context.h index f936bbe8..201c8873 100644 --- a/alc/context.h +++ b/alc/context.h @@ -211,7 +211,7 @@ struct ALCcontext : public al::intrusive_ref, ContextBase { private: /* Thread-local current context. */ - static thread_local ALCcontext *sLocalContext; + static inline thread_local ALCcontext *sLocalContext{}; /* Thread-local context handling. This handles attempting to release the * context which may have been left current when the thread is destroyed. @@ -224,17 +224,8 @@ private: static thread_local ThreadCtx sThreadContext; public: - /* HACK: MinGW generates bad code when accessing an extern thread_local - * object. Add a wrapper function for it that only accesses it where it's - * defined. - */ -#ifdef __MINGW32__ - static ALCcontext *getThreadContext() noexcept; - static void setThreadContext(ALCcontext *context) noexcept; -#else static ALCcontext *getThreadContext() noexcept { return sLocalContext; } static void setThreadContext(ALCcontext *context) noexcept { sThreadContext.set(context); } -#endif /* Default effect that applies to sources that don't have an effect on send 0. */ static ALeffect sDefaultEffect; -- cgit v1.2.3