Handle c99 inline vs gnu89 inline.

The meaning of "extern inline" and "inline" swaps between the two, and
gcc-5 uses c99 inline.
This commit is contained in:
Bill Currie 2015-08-18 00:11:03 +09:00
parent c71eccfb10
commit f0dc995c67
4 changed files with 28 additions and 7 deletions

View file

@ -14,6 +14,27 @@ if test "x$CFLAGS" != "x"; then
fi fi
AC_MSG_RESULT([$leave_cflags_alone]) AC_MSG_RESULT([$leave_cflags_alone])
AC_MSG_CHECKING(for C99 inline)
c99_inline=no
AC_TRY_LINK(
[inline int foo (int x) { return x * x; }
int (*bar) (int) = foo;],
[],
c99_inline=no
AC_MSG_RESULT(no),
c99_inline=yes
AC_DEFINE(HAVE_C99INLINE, extern, [define this if using c99 inline])
AC_MSG_RESULT(yes)
)
AH_VERBATIM([HAVE_C99INLINE],
[/* Define this if the GCC __attribute__ keyword is available */
#undef HAVE_C99INLINE
#ifdef HAVE_C99INLINE
# define GNU89INLINE
#else
# define GNU89INLINE extern
#endif])
if test "x$GCC" = xyes; then if test "x$GCC" = xyes; then
set $CC set $CC
shift shift

View file

@ -183,10 +183,10 @@ void _VectorSubtract (const vec3_t veca, const vec3_t vecb, vec3_t out);
void CrossProduct (const vec3_t v1, const vec3_t v2, vec3_t cross); void CrossProduct (const vec3_t v1, const vec3_t v2, vec3_t cross);
vec_t _VectorNormalize (vec3_t v); // returns vector length vec_t _VectorNormalize (vec3_t v); // returns vector length
extern inline float VectorNormalize (vec3_t v); // returns vector length GNU89INLINE inline float VectorNormalize (vec3_t v); // returns vector length
#ifndef IMPLEMENT_VectorNormalize #ifndef IMPLEMENT_VectorNormalize
extern inline GNU89INLINE inline
#else #else
VISIBLE VISIBLE
#endif #endif

View file

@ -174,11 +174,11 @@ void RotatePointAroundVector (vec3_t dst, const vec3_t axis,
} while (0) } while (0)
extern plane_t * const frustum; extern plane_t * const frustum;
extern inline qboolean R_CullBox (const vec3_t mins, const vec3_t maxs); GNU89INLINE inline qboolean R_CullBox (const vec3_t mins, const vec3_t maxs);
extern inline qboolean R_CullSphere (const vec3_t origin, const float radius); GNU89INLINE inline qboolean R_CullSphere (const vec3_t origin, const float radius);
#ifndef IMPLEMENT_R_Cull #ifndef IMPLEMENT_R_Cull
extern inline GNU89INLINE inline
#else #else
VISIBLE VISIBLE
#endif #endif
@ -194,7 +194,7 @@ R_CullBox (const vec3_t mins, const vec3_t maxs)
} }
#ifndef IMPLEMENT_R_Cull #ifndef IMPLEMENT_R_Cull
extern inline GNU89INLINE inline
#else #else
VISIBLE VISIBLE
#endif #endif

View file

@ -30,7 +30,7 @@
#include "gib_tree.h" #include "gib_tree.h"
inline qboolean GIB_Escaped (const char *str, int i); qboolean GIB_Escaped (const char *str, int i);
char GIB_Parse_Match_Brace (const char *str, unsigned int *i); char GIB_Parse_Match_Brace (const char *str, unsigned int *i);
char GIB_Parse_Match_Backtick (const char *str, unsigned int *i); char GIB_Parse_Match_Backtick (const char *str, unsigned int *i);