Commit f3052008 authored by Simon Marlow's avatar Simon Marlow
Browse files

FIX #2469: sort out our static/extern inline story

gcc has changed the meaning of "extern inline" when certain flags are
on (e.g. --std=gnu99), and this broke our use of it in the header
files.
parent f2de7b4d
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
External C Interface External C Interface
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
extern StgPtr deRefStablePtr(StgStablePtr stable_ptr); EXTERN_INLINE StgPtr deRefStablePtr(StgStablePtr stable_ptr);
extern void freeStablePtr(StgStablePtr sp); extern void freeStablePtr(StgStablePtr sp);
extern StgStablePtr splitStablePtr(StgStablePtr sp); extern StgStablePtr splitStablePtr(StgStablePtr sp);
extern StgStablePtr getStablePtr(StgPtr p); extern StgStablePtr getStablePtr(StgPtr p);
...@@ -40,19 +40,12 @@ extern DLL_IMPORT_RTS snEntry *stable_ptr_table; ...@@ -40,19 +40,12 @@ extern DLL_IMPORT_RTS snEntry *stable_ptr_table;
extern void freeStablePtr(StgStablePtr sp); extern void freeStablePtr(StgStablePtr sp);
#if defined(__GNUC__) EXTERN_INLINE
# ifndef RTS_STABLE_C
extern inline
# endif
StgPtr deRefStablePtr(StgStablePtr sp) StgPtr deRefStablePtr(StgStablePtr sp)
{ {
ASSERT(stable_ptr_table[(StgWord)sp].ref > 0); ASSERT(stable_ptr_table[(StgWord)sp].ref > 0);
return stable_ptr_table[(StgWord)sp].addr; return stable_ptr_table[(StgWord)sp].addr;
} }
#else
/* No support for 'extern inline' */
extern StgPtr deRefStablePtr(StgStablePtr sp);
#endif
extern void initStablePtrTable ( void ); extern void initStablePtrTable ( void );
extern void exitStablePtrTable ( void ); extern void exitStablePtrTable ( void );
......
...@@ -81,7 +81,8 @@ ...@@ -81,7 +81,8 @@
* 'Portable' inlining: * 'Portable' inlining:
* INLINE_HEADER is for inline functions in header files (macros) * INLINE_HEADER is for inline functions in header files (macros)
* STATIC_INLINE is for inline functions in source files * STATIC_INLINE is for inline functions in source files
* EXTERN_INLINE is for functions that we want to inline sometimes * EXTERN_INLINE is for functions that we want to inline sometimes
* (we also compile a static version of the function; see Inlines.c)
*/ */
#if defined(__GNUC__) || defined( __INTEL_COMPILER) #if defined(__GNUC__) || defined( __INTEL_COMPILER)
...@@ -89,11 +90,24 @@ ...@@ -89,11 +90,24 @@
# define INLINE_ME inline # define INLINE_ME inline
# define STATIC_INLINE INLINE_HEADER # define STATIC_INLINE INLINE_HEADER
# if defined(KEEP_INLINES) // The special "extern inline" behaviour is now only supported by gcc
# define EXTERN_INLINE inline // when _GNUC_GNU_INLINE__ is defined, and you have to use
# else // __attribute__((gnu_inline)). So when we don't have this, we use
# define EXTERN_INLINE extern inline // ordinary static inline.
# endif //
#if defined(__GNUC_GNU_INLINE__)
# if defined(KEEP_INLINES)
# define EXTERN_INLINE inline
# else
# define EXTERN_INLINE extern inline __attribute__((gnu_inline))
# endif
#else
# if defined(KEEP_INLINES)
# define EXTERN_INLINE
# else
# define EXTERN_INLINE INLINE_HEADER
# endif
#endif
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment