From cbdc6415cc8a2eb3de850771a45afaeddd283233 Mon Sep 17 00:00:00 2001 From: ivmai Date: Sat, 26 Sep 2009 15:43:34 +0000 Subject: [PATCH] 2009-09-26 Ivan Maidanski * allchblk.c (GC_enough_large_bytes_left): Replace "inline static" with GC_INLINE. * include/private/gc_priv.h (fixed_getenv): Ditto. * alloc.c (GC_max, GC_min): Replace "static INLINE" with GC_INLINE. * mark_rts.c (rt_hash): Ditto. * win32_threads.c (GC_get_max_thread_index): Ditto. * include/private/gc_priv.h (INLINE): Prefix with "GC_"; include "static"; define for Sun CC; define for VC++ (and other compilers). * pthread_support.c: Don't define __inline__ for non-GNU compilers (not needed anymore). --- ChangeLog | 15 +++++++++++++++ allchblk.c | 5 +---- alloc.c | 4 ++-- include/private/gc_priv.h | 13 ++++++++----- mark_rts.c | 2 +- pthread_support.c | 4 ---- win32_threads.c | 5 +---- 7 files changed, 28 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index eaa9d584..655e8333 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2009-09-26 Ivan Maidanski + + * allchblk.c (GC_enough_large_bytes_left): Replace "inline static" + with GC_INLINE. + * include/private/gc_priv.h (fixed_getenv): Ditto. + * alloc.c (GC_max, GC_min): Replace "static INLINE" with + GC_INLINE. + * mark_rts.c (rt_hash): Ditto. + * win32_threads.c (GC_get_max_thread_index): Ditto. + * include/private/gc_priv.h (INLINE): Prefix with "GC_"; include + "static"; define for Sun CC; define for VC++ (and other + compilers). + * pthread_support.c: Don't define __inline__ for non-GNU compilers + (not needed anymore). + 2009-09-26 Ivan Maidanski * NT_THREADS_MAKEFILE: Remove file (since it duplicates gc.mak). diff --git a/allchblk.c b/allchblk.c index b2a5ea73..0e37306d 100644 --- a/allchblk.c +++ b/allchblk.c @@ -55,10 +55,7 @@ struct hblk * GC_hblkfreelist[N_HBLK_FLS+1] = { 0 }; /* Is GC_large_allocd_bytes + the number of free bytes on lists */ /* n .. N_HBLK_FLS > GC_max_large_allocd_bytes. */ /* If there is no such n, return 0. */ -# ifdef __GNUC__ - __inline__ -# endif - static int GC_enough_large_bytes_left(void) + GC_INLINE int GC_enough_large_bytes_left(void) { int n; word bytes = GC_large_allocd_bytes; diff --git a/alloc.c b/alloc.c index d40d8f01..d2a79b5e 100644 --- a/alloc.c +++ b/alloc.c @@ -1044,12 +1044,12 @@ void GC_print_heap_sects(void) void * GC_least_plausible_heap_addr = (void *)ONES; void * GC_greatest_plausible_heap_addr = 0; -static INLINE word GC_max(word x, word y) +GC_INLINE word GC_max(word x, word y) { return(x > y? x : y); } -static INLINE word GC_min(word x, word y) +GC_INLINE word GC_min(word x, word y) { return(x < y? x : y); } diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index c85e19b5..7dde6503 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -90,11 +90,14 @@ typedef char * ptr_t; /* A generic pointer to which we can add */ # define EXPECT(expr, outcome) (expr) #endif /* __GNUC__ */ -#if __GNUC__ >= 3 -# define INLINE inline +#if defined(_MSC_VER) || defined(__INTEL_COMPILER) || defined(__DMC__) \ + || defined(__WATCOMC__) +# define GC_INLINE static __inline +#elif (__GNUC__ >= 3) || defined(__sun) +# define GC_INLINE static inline #else -# define INLINE -#endif /* __GNUC__ */ +# define GC_INLINE static +#endif #ifndef GC_API_PRIV # define GC_API_PRIV GC_API @@ -399,7 +402,7 @@ extern GC_warn_proc GC_current_warn_proc; #if !defined(NO_GETENV) # if defined(EMPTY_GETENV_RESULTS) /* Workaround for a reputed Wine bug. */ - static inline char * fixed_getenv(const char *name) + GC_INLINE char * fixed_getenv(const char *name) { char * tmp = getenv(name); if (tmp == 0 || strlen(tmp) == 0) diff --git a/mark_rts.c b/mark_rts.c index 99ee2788..d696bb43 100644 --- a/mark_rts.c +++ b/mark_rts.c @@ -92,7 +92,7 @@ GC_bool GC_is_static_root(ptr_t p) -- really defined in gc_priv.h */ -static INLINE int rt_hash(ptr_t addr) +GC_INLINE int rt_hash(ptr_t addr) { word result = (word) addr; # if CPP_WORDSZ > 8*LOG_RT_SIZE diff --git a/pthread_support.c b/pthread_support.c index f5cdbf1d..54439926 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -100,10 +100,6 @@ unsigned long GC_lock_holder = NO_THREAD; typedef unsigned int sem_t; #endif /* GC_DGUX386_THREADS */ -#ifndef __GNUC__ -# define __inline__ -#endif - /* Undefine macros used to redirect pthread primitives. */ # undef pthread_create # if !defined(GC_DARWIN_THREADS) diff --git a/win32_threads.c b/win32_threads.c index 701d6b12..939b846a 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -494,10 +494,7 @@ static GC_thread GC_register_my_thread_inner(const struct GC_stack_base *sb, * GC_max_thread_index may temporarily be larger than MAX_THREADS. * To avoid subscript errors, we check on access. */ -#ifdef __GNUC__ - __inline__ -#endif -STATIC LONG GC_get_max_thread_index(void) +GC_INLINE LONG GC_get_max_thread_index(void) { LONG my_max = GC_max_thread_index; -- 2.40.0