From 380a551f433edc335d80b77743c75e5d30301e54 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Thu, 5 Jan 2012 14:19:30 +0900 Subject: [PATCH] Refactoring __attribute__((unused)). --- gc.c | 7 +------ include/chibi/sexp.h | 6 ++++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gc.c b/gc.c index a304241d..88fcca86 100644 --- a/gc.c +++ b/gc.c @@ -435,12 +435,7 @@ void sexp_mark_global_symbols(sexp ctx) { #endif sexp sexp_gc (sexp ctx, size_t *sum_freed) { - sexp res; -#ifdef __GNUC__ - sexp finalized __attribute__((unused)); -#else - sexp finalized; -#endif + sexp res, finalized SEXP_NO_WARN_UNUSED; sexp_debug_printf("%p (heap: %p size: %lu)", ctx, sexp_context_heap(ctx), sexp_heap_total_size(sexp_context_heap(ctx))); sexp_mark_global_symbols(ctx); diff --git a/include/chibi/sexp.h b/include/chibi/sexp.h index 2b8a2593..7783a04b 100755 --- a/include/chibi/sexp.h +++ b/include/chibi/sexp.h @@ -45,6 +45,12 @@ extern "C" { #define sexp_out_of_file_descriptors() (0) #endif +#ifdef __GNUC__ +#define SEXP_NO_WARN_UNUSED __attribute__((unused)) +#else +#define SEXP_NO_WARN_UNUSED +#endif + #ifdef PLAN9 #include #include