diff options
author | Simon Marlow <marlowsd@gmail.com> | 2008-06-19 10:08:49 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2008-06-19 10:08:49 +0000 |
commit | 24ad9cf0325bb5fedc9f0ca8bd70f78096d8d326 (patch) | |
tree | 0842c597aaf44db82f49d43cd9f8f14ee09f16a7 /includes/Stg.h | |
parent | 067ec969bb0bdc4c88582e53b040fa2925cbcc56 (diff) | |
download | haskell-24ad9cf0325bb5fedc9f0ca8bd70f78096d8d326.tar.gz |
Fix up inlines for gcc 4.3
gcc 4.3 emits warnings for static inline functions that its heuristics
decided not to inline. The workaround is to either mark appropriate
functions as "hot" (a new attribute in gcc 4.3), or sometimes to use
"extern inline" instead.
With this fix I can validate with gcc 4.3 on Fedora 9.
Diffstat (limited to 'includes/Stg.h')
-rw-r--r-- | includes/Stg.h | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/includes/Stg.h b/includes/Stg.h index 35f4eda631..022b385e2d 100644 --- a/includes/Stg.h +++ b/includes/Stg.h @@ -75,21 +75,41 @@ /* * 'Portable' inlining: - * INLINE_HEADER is for inline functions in header files + * 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 */ #if defined(__GNUC__) || defined( __INTEL_COMPILER) + # define INLINE_HEADER static inline # define INLINE_ME inline # define STATIC_INLINE INLINE_HEADER + +# if defined(KEEP_INLINES) +# define EXTERN_INLINE inline +# else +# define EXTERN_INLINE extern inline +# endif + #elif defined(_MSC_VER) + # define INLINE_HEADER __inline static # define INLINE_ME __inline # define STATIC_INLINE INLINE_HEADER + +# if defined(KEEP_INLINES) +# define EXTERN_INLINE __inline +# else +# define EXTERN_INLINE __inline extern +# endif + #else + # error "Don't know how to inline functions with your C compiler." + #endif + /* * GCC attributes */ @@ -105,6 +125,12 @@ #define GNUC3_ATTRIBUTE(at) #endif +#if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 3 +#define GNUC_ATTR_HOT __attribute__((hot)) +#else +#define GNUC_ATTR_HOT /* nothing */ +#endif + #define STG_UNUSED GNUC3_ATTRIBUTE(__unused__) /* ----------------------------------------------------------------------------- |