X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=includes%2FStg.h;h=6cbfeb45e511ee412d3147dcf21cc673157a84bf;hb=447c0b257a0e8df3b79422b17ec2cf1d952027f3;hp=022b385e2def91a8d5b961ae0c02c4850cae4be6;hpb=24ad9cf0325bb5fedc9f0ca8bd70f78096d8d326;p=ghc-hetmet.git diff --git a/includes/Stg.h b/includes/Stg.h index 022b385..6cbfeb4 100644 --- a/includes/Stg.h +++ b/includes/Stg.h @@ -31,9 +31,13 @@ */ #ifndef IN_STG_CODE # define IN_STG_CODE 1 -# define _ISOC99_SOURCE + // Turn on C99 for .hc code. This gives us the INFINITY and NAN // constants from math.h, which we occasionally need to use in .hc (#1861) +# define _ISOC99_SOURCE + +// Turning on _ISOC99_SOURCE means S_ISSOCK gets defined on Linux +# define _BSD_SOURCE #endif #if IN_STG_CODE == 0 @@ -77,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) @@ -85,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)