diff --git a/miniaudio.h b/miniaudio.h index 4c92ca6e..0e8f4b18 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -570,13 +570,22 @@ typedef ma_uint16 wchar_t; #ifdef _MSC_VER -#define MA_INLINE __forceinline + #define MA_INLINE __forceinline +#elif defined(__GNUC__) + /* + 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. + */ + #if defined(__STRICT_ANSI__) + #define MA_INLINE __inline__ __attribute__((always_inline)) + #else + #define MA_INLINE inline __attribute__((always_inline)) + #endif #else -#ifdef __GNUC__ -#define MA_INLINE __inline__ __attribute__((always_inline)) -#else -#define MA_INLINE -#endif + #define MA_INLINE #endif #if defined(_MSC_VER)