From 999fa526f0b88caa04f68aa80cb2bb7f052e5020 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Fri, 8 Apr 2022 11:55:10 +0300
Subject: [PATCH] tweak DRMP3_INLINE macro for gcc
(see: https://github.com/mackron/dr_libs/pull/230)
---
src/dr_mp3.h | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/src/dr_mp3.h b/src/dr_mp3.h
index d145f5c..1c8198d 100644
--- a/src/dr_mp3.h
+++ b/src/dr_mp3.h
@@ -232,19 +232,16 @@ typedef drmp3_int32 drmp3_result;
#ifdef _MSC_VER
#define DRMP3_INLINE __forceinline
-#elif defined(__GNUC__)
+#elif (defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2))) || defined(__clang__)
/*
I've had a bug report where GCC is emitting warnings about functions possibly not being inlineable. This warning happens when
the __attribute__((always_inline)) attribute is defined without an "inline" statement. I think therefore there must be some
case where "__inline__" is not always defined, thus the compiler emitting these warnings. When using -std=c89 or -ansi on the
- command line, we cannot use the "inline" keyword and instead need to use "__inline__". In an attempt to work around this issue
- I am using "__inline__" only when we're compiling in strict ANSI mode.
+ command line, we cannot use the "inline" keyword and instead need to use "__inline__".
*/
- #if defined(__STRICT_ANSI__)
- #define DRMP3_INLINE __inline__ __attribute__((always_inline))
- #else
- #define DRMP3_INLINE inline __attribute__((always_inline))
- #endif
+ #define DRMP3_INLINE __inline__ __attribute__((always_inline))
+#elif defined(__GNUC__)
+ #define DRMP3_INLINE __inline__
#elif defined(__WATCOMC__)
#define DRMP3_INLINE __inline
#else