From cace43e1d8a96e2eed803b8f45392d3772f14156 Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 1 Feb 2005 14:14:41 +0000 Subject: [PATCH] [project @ 2005-02-01 14:14:41 by simonmar] Add __attribute__((used)) to static functions, as gcc 3.4 -O2 is in the habit of throwing them away. --- ghc/includes/Rts.h | 14 -------------- ghc/includes/Stg.h | 21 +++++++++++++++++++-- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/ghc/includes/Rts.h b/ghc/includes/Rts.h index 45bf815..4e59472 100644 --- a/ghc/includes/Rts.h +++ b/ghc/includes/Rts.h @@ -38,20 +38,6 @@ extern "C" { #define __MSVCRT__ 1 #endif -#if defined(__GNUC__) -#define GNU_ATTRIBUTE(at) __attribute__((at)) -#else -#define GNU_ATTRIBUTE(at) -#endif - -#if __GNUC__ >= 3 -#define GNUC3_ATTRIBUTE(at) __attribute__((at)) -#else -#define GNUC3_ATTRIBUTE(at) -#endif - -#define STG_UNUSED GNUC3_ATTRIBUTE(__unused__) - /* * We often want to know the size of something in units of an * StgWord... (rounded up, of course!) diff --git a/ghc/includes/Stg.h b/ghc/includes/Stg.h index 1189b0e..2c6bf40 100644 --- a/ghc/includes/Stg.h +++ b/ghc/includes/Stg.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Stg.h,v 1.66 2005/01/28 12:55:52 simonmar Exp $ + * $Id: Stg.h,v 1.67 2005/02/01 14:14:41 simonmar Exp $ * * (c) The GHC Team, 1998-2004 * @@ -81,6 +81,23 @@ # error "Don't know how to inline functions with your C compiler." #endif +/* + * GCC attributes + */ +#if defined(__GNUC__) +#define GNU_ATTRIBUTE(at) __attribute__((at)) +#else +#define GNU_ATTRIBUTE(at) +#endif + +#if __GNUC__ >= 3 +#define GNUC3_ATTRIBUTE(at) __attribute__((at)) +#else +#define GNUC3_ATTRIBUTE(at) +#endif + +#define STG_UNUSED GNUC3_ATTRIBUTE(__unused__) + /* ----------------------------------------------------------------------------- Global type definitions -------------------------------------------------------------------------- */ @@ -106,7 +123,7 @@ typedef StgClosurePtr L_; typedef StgInt64 LI_; typedef StgWord64 LW_; -#define IF_(f) static F_ f(void) +#define IF_(f) static F_ GNUC3_ATTRIBUTE(used) f(void) #define FN_(f) F_ f(void) #define EF_(f) extern F_ f(void) -- 1.7.10.4