Better fix for bug 2129 - fix for bug 2121 breaks linking for mingw and throws multiple warnings
authorSam Lantinga <slouken@libsdl.org>
Mon, 21 Oct 2013 02:32:34 -0700
changeset 7872ca36ab2a8179
parent 7871 ff9f1a1ed2dd
child 7873 e88af17231bd
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.
include/begin_code.h
     1.1 --- a/include/begin_code.h	Mon Oct 21 02:20:39 2013 -0700
     1.2 +++ b/include/begin_code.h	Mon Oct 21 02:32:34 2013 -0700
     1.3 @@ -100,31 +100,23 @@
     1.4  #endif /* Compiler needs structure packing set */
     1.5  
     1.6  #ifndef SDL_INLINE
     1.7 -/* Set up compiler-specific options for inlining functions */
     1.8 -#if defined(_MSC_VER) || defined(__BORLANDC__) || \
     1.9 -    defined(__DMC__) || defined(__SC__) || \
    1.10 -    defined(__WATCOMC__) || defined(__LCC__) || \
    1.11 -    defined(__DECC)
    1.12 -#define SDL_INLINE  __inline
    1.13 +#if defined(__GNUC__)
    1.14 +#define SDL_INLINE __inline__
    1.15 +#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
    1.16 +      defined(__DMC__) || defined(__SC__) || \
    1.17 +      defined(__WATCOMC__) || defined(__LCC__) || \
    1.18 +      defined(__DECC)
    1.19 +#define SDL_INLINE __inline
    1.20  #else
    1.21  #define SDL_INLINE inline
    1.22 -#endif /* Visual C++ */
    1.23 +#endif
    1.24  #endif /* SDL_INLINE not defined */
    1.25  
    1.26 -/* If inlining isn't supported, remove SDL_INLINE, turning static
    1.27 -   inlined functions into static functions (potentially resulting in
    1.28 -   code bloat in all files which include the offending header files)
    1.29 -*/
    1.30 -#if __STRICT_ANSI__
    1.31 -#undef SDL_INLINE
    1.32 -#define SDL_INLINE
    1.33 -#endif
    1.34 -
    1.35  #ifndef SDL_FORCE_INLINE
    1.36  #if defined(_MSC_VER)
    1.37  #define SDL_FORCE_INLINE __forceinline
    1.38  #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
    1.39 -#define SDL_FORCE_INLINE __attribute__((always_inline)) static SDL_INLINE
    1.40 +#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
    1.41  #else
    1.42  #define SDL_FORCE_INLINE static SDL_INLINE
    1.43  #endif