]> granicus.if.org Git - gc/commitdiff
Added macro to encode warning suppression
authorJay McCarthy <jay@racket-lang.org>
Tue, 18 May 2010 13:44:56 +0000 (08:44 -0500)
committerIvan Maidanski <ivmai@mail.ru>
Sun, 3 Nov 2013 10:05:37 +0000 (14:05 +0400)
dyn_load.c
include/private/gc_priv.h
os_dep.c
pthread_stop_world.c

index 5fe133a0e8874945759a8b1af82099dcd2f62daf..57ddce89557c4c343d9d93b793dfc3c43caea3b5 100644 (file)
@@ -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)) \
index c50106a9e7cec5f50dffd3b80c97170182485b9b..47275f815d559511779d05ca4c1069232a49e50b 100644 (file)
 # 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>
index 0d94b73937267207df5bf27000a46345bf3e5edf..48f28569f49c4b3a3ff82a775b35480da6cd7dc9 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -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)
index 3e7bda65e468ad4c2df2ea62be134a6c81daaf36..2b8d6443340ae26045f1d7bb761c4f7bf1843dd9 100644 (file)
@@ -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");