Fix potential warnings when compiling with GCC.

This commit is contained in:
David Reid
2019-09-18 17:35:43 +10:00
parent 662246ce0b
commit 4ad67a666f
+12 -3
View File
@@ -571,12 +571,21 @@ typedef ma_uint16 wchar_t;
#ifdef _MSC_VER
#define MA_INLINE __forceinline
#else
#ifdef __GNUC__
#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
#define MA_INLINE inline __attribute__((always_inline))
#endif
#else
#define MA_INLINE
#endif
#if defined(_MSC_VER)