diff options
author | Jay McCarthy <jay@racket-lang.org> | 2010-05-18 08:44:56 -0500 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2013-11-03 14:05:37 +0400 |
commit | 9293360cca39d09bfa063fc7854f273ac987f739 (patch) | |
tree | 0d8d0de8fb9958c9a15b645ac74b6797f3882edc | |
parent | 8f2a6dad5bdf5a642b5e8deb411c7a0b11f59d50 (diff) | |
download | bdwgc-9293360cca39d09bfa063fc7854f273ac987f739.tar.gz |
Added macro to encode warning suppression
-rw-r--r-- | dyn_load.c | 2 | ||||
-rw-r--r-- | include/private/gc_priv.h | 6 | ||||
-rw-r--r-- | os_dep.c | 13 | ||||
-rw-r--r-- | pthread_stop_world.c | 5 |
4 files changed, 16 insertions, 10 deletions
@@ -52,7 +52,7 @@ /* A user-supplied routine that is called to determine if a DSO must be scanned by the gc. */ -static int (*GC_has_static_roots)(const char *, void *, size_t); +MAYBE_UNUSED static int (*GC_has_static_roots)(const char *, void *, size_t); /* PLTSCHEME: added OPENBSD: */ #if (defined(DYNAMIC_LOADING) || defined(MSWIN32) || defined(MSWINCE)) \ diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index c50106a9..47275f81 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -19,6 +19,12 @@ # ifndef GC_PRIVATE_H # define GC_PRIVATE_H +# ifdef __GNUC__ +# define MAYBE_UNUSED __attribute__((unused)) +# else +# define MAYBE_UNUSED +# endif + # include <stdlib.h> # if !(defined( sony_news ) ) # include <stddef.h> @@ -1215,9 +1215,9 @@ ptr_t GC_get_main_stack_base(void) ptr_t GC_get_main_stack_base(void) { # if defined(HEURISTIC1) || defined(HEURISTIC2) - word dummy; + MAYBE_UNUSED word dummy; # endif - ptr_t result; + MAYBE_UNUSED ptr_t result; # define STACKBOTTOM_ALIGNMENT_M1 ((word)STACK_GRAN - 1) @@ -1360,7 +1360,7 @@ ptr_t GC_get_main_stack_base(void) /* FIXME - Implement better strategies here. */ int GC_get_stack_base(struct GC_stack_base *b) { - int dummy; + MAYBE_UNUSED int dummy; # ifdef NEED_FIND_LIMIT # ifdef STACK_GROWS_DOWN @@ -2920,9 +2920,8 @@ GC_bool GC_old_segv_handler_used_si; # endif /* MSWIN32 || MSWINCE */ { # if !defined(MSWIN32) && !defined(MSWINCE) - int code = si -> si_code; /* Ignore gcc unused var. warning. */ - ucontext_t * scp = (ucontext_t *)raw_sc; - /* Ignore gcc unused var. warning. */ + MAYBE_UNUSED int code = si -> si_code; + MAYBE_UNUSED ucontext_t * scp = (ucontext_t *)raw_sc; char *addr = si -> si_addr; # endif # if defined(MSWIN32) || defined(MSWINCE) @@ -3249,7 +3248,7 @@ GC_bool GC_page_was_dirty(struct hblk *h) * On other systems, SET_LOCK_HOLDER and friends must be suitably defined. */ -static GC_bool syscall_acquired_lock = FALSE; /* Protected by GC lock. */ +MAYBE_UNUSED static GC_bool syscall_acquired_lock = FALSE; /* Protected by GC lock. */ #if 0 void GC_begin_syscall(void) diff --git a/pthread_stop_world.c b/pthread_stop_world.c index 3e7bda65..2b8d6443 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c @@ -1,4 +1,5 @@ #include "private/pthread_support.h" +#include "private/gc_priv.h" #if defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS) && \ !defined(GC_DARWIN_THREADS) && !defined(GC_OPENBSD_THREADS) @@ -221,8 +222,8 @@ void GC_suspend_handler_inner(ptr_t sig_arg, void *context) void GC_restart_handler(int sig) { - pthread_t my_thread = pthread_self(); - GC_thread me; + MAYBE_UNUSED pthread_t my_thread = pthread_self(); + MAYBE_UNUSED GC_thread me; if (sig != SIG_THR_RESTART) ABORT("Bad signal in suspend_handler"); |