Better fix for bug 2129 - fix for bug 2121 breaks linking for mingw and throws multiple warnings

J?nis R?cis

Reopening as compilation with ANSI C throws lots of unnecessary warnings, both using MinGW and using Linux GCC. (BTW, what happened? MinGW is broken to all hell. sdl2-config does not even link SDLMain anymore?)

I think this may have been lost somewhere, so again: GCC supports inlining via __inline__ in all known versions of GCC, regardless of the C standard in use. Please don't assume that __STRICT_ANSI__ implies no inlining support.
This commit is contained in:
Sam Lantinga 2013-10-21 02:32:34 -07:00
parent c10389cf5b
commit d08634e2c6

View File

@ -100,31 +100,23 @@
#endif /* Compiler needs structure packing set */ #endif /* Compiler needs structure packing set */
#ifndef SDL_INLINE #ifndef SDL_INLINE
/* Set up compiler-specific options for inlining functions */ #if defined(__GNUC__)
#if defined(_MSC_VER) || defined(__BORLANDC__) || \ #define SDL_INLINE __inline__
defined(__DMC__) || defined(__SC__) || \ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \
defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DMC__) || defined(__SC__) || \
defined(__DECC) defined(__WATCOMC__) || defined(__LCC__) || \
#define SDL_INLINE __inline defined(__DECC)
#define SDL_INLINE __inline
#else #else
#define SDL_INLINE inline #define SDL_INLINE inline
#endif /* Visual C++ */
#endif /* SDL_INLINE not defined */
/* If inlining isn't supported, remove SDL_INLINE, turning static
inlined functions into static functions (potentially resulting in
code bloat in all files which include the offending header files)
*/
#if __STRICT_ANSI__
#undef SDL_INLINE
#define SDL_INLINE
#endif #endif
#endif /* SDL_INLINE not defined */
#ifndef SDL_FORCE_INLINE #ifndef SDL_FORCE_INLINE
#if defined(_MSC_VER) #if defined(_MSC_VER)
#define SDL_FORCE_INLINE __forceinline #define SDL_FORCE_INLINE __forceinline
#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
#define SDL_FORCE_INLINE __attribute__((always_inline)) static SDL_INLINE #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
#else #else
#define SDL_FORCE_INLINE static SDL_INLINE #define SDL_FORCE_INLINE static SDL_INLINE
#endif #endif