Fixed bug 2121 - GCC throws error on SDL_FORCE_INLINE when compiling with -ansi

This commit is contained in:
Sam Lantinga 2013-09-30 22:35:32 -07:00
parent 22a972a440
commit 69a4351eb0
5 changed files with 23 additions and 19 deletions

View file

@ -99,11 +99,9 @@
#endif
#endif /* Compiler needs structure packing set */
#ifndef __inline__
/* Set up compiler-specific options for inlining functions */
#ifndef SDL_INLINE_OKAY
#ifdef __GNUC__
#define SDL_INLINE_OKAY
#else
/* Add any special compiler-specific cases here */
#if defined(_MSC_VER) || defined(__BORLANDC__) || \
defined(__DMC__) || defined(__SC__) || \
@ -112,31 +110,34 @@
#ifndef __inline__
#define __inline__ __inline
#endif
#define SDL_INLINE_OKAY
#define SDL_INLINE_OKAY 1
#else
#if !defined(__MRC__) && !defined(_SGI_SOURCE)
#ifndef __inline__
#define __inline__ inline
#endif
#define SDL_INLINE_OKAY
#define SDL_INLINE_OKAY 1
#endif /* Not a funky compiler */
#endif /* Visual C++ */
#endif /* GNU C */
#endif /* SDL_INLINE_OKAY */
/* If inlining isn't supported, remove "__inline__", turning static
inlined functions into static functions (resulting in code bloat
in all files which include the offending header files)
*/
#ifndef SDL_INLINE_OKAY
#if !SDL_INLINE_OKAY || __STRICT_ANSI__
#ifdef __inline__
#undef __inline__
#endif
#define __inline__
#endif
#endif /* __inline__ not defined */
#ifndef SDL_FORCE_INLINE
#if defined(_MSC_VER)
#define SDL_FORCE_INLINE __forceinline
#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
#define SDL_FORCE_INLINE __attribute__((always_inline)) static inline
#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
#else
#define SDL_FORCE_INLINE static __inline__
#endif