summaryrefslogtreecommitdiff
path: root/includes/Stg.h
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2008-09-16 13:22:22 +0000
committerSimon Marlow <marlowsd@gmail.com>2008-09-16 13:22:22 +0000
commitf3052008e4fcd72681b12dfef551d0499eddf6a7 (patch)
tree5b6ee3d7caab74b66bedd4e92f3e3470931fd801 /includes/Stg.h
parentf2de7b4d310e0b8cc49b725d49ab03e94a106d1c (diff)
downloadhaskell-f3052008e4fcd72681b12dfef551d0499eddf6a7.tar.gz
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.
Diffstat (limited to 'includes/Stg.h')
-rw-r--r--includes/Stg.h26
1 files changed, 20 insertions, 6 deletions
diff --git a/includes/Stg.h b/includes/Stg.h
index 392fd2a0ab..6cbfeb45e5 100644
--- a/includes/Stg.h
+++ b/includes/Stg.h
@@ -81,7 +81,8 @@
* 'Portable' inlining:
* INLINE_HEADER is for inline functions in header files (macros)
* 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)
@@ -89,11 +90,24 @@
# define INLINE_ME inline
# define STATIC_INLINE INLINE_HEADER
-# if defined(KEEP_INLINES)
-# define EXTERN_INLINE inline
-# else
-# define EXTERN_INLINE extern inline
-# endif
+// The special "extern inline" behaviour is now only supported by gcc
+// when _GNUC_GNU_INLINE__ is defined, and you have to use
+// __attribute__((gnu_inline)). So when we don't have this, we use
+// ordinary static inline.
+//
+#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)