Added macro to encode warning suppression

This commit is contained in:
Jay McCarthy 2010-05-18 08:44:56 -05:00
parent a8e51a8a36
commit 749096f87c
4 changed files with 16 additions and 10 deletions

View 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)) \

View File

@ -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>

View File

@ -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)

View 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");