From d6c34577eeaba37ff08998d18676531082c040b6 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Fri, 18 Mar 2016 21:06:53 +0300 Subject: [PATCH] Fix 'GC_generic_malloc_inner_ignore_off_page not used' compiler warning (for GC_NO_FINALIZATION case) * include/private/gc_priv.h (GC_generic_malloc_inner_ignore_off_page): Do not declare unless DBG_HDRS_ALL or GC_GCJ_SUPPORT, or !GC_NO_FINALIZATION. * malloc.c (GC_generic_malloc_inner_ignore_off_page): Do not define unless DBG_HDRS_ALL or GC_GCJ_SUPPORT, or !GC_NO_FINALIZATION. --- include/private/gc_priv.h | 5 ++++- malloc.c | 13 ++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index d2f69be3..8318ca41 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -1836,12 +1836,15 @@ GC_INNER void GC_collect_a_little_inner(int n); GC_INNER void * GC_generic_malloc_inner(size_t lb, int k); /* Allocate an object of the given */ /* kind but assuming lock already held. */ -GC_INNER void * GC_generic_malloc_inner_ignore_off_page(size_t lb, int k); +#if defined(DBG_HDRS_ALL) || defined(GC_GCJ_SUPPORT) \ + || !defined(GC_NO_FINALIZATION) + GC_INNER void * GC_generic_malloc_inner_ignore_off_page(size_t lb, int k); /* Allocate an object, where */ /* the client guarantees that there */ /* will always be a pointer to the */ /* beginning of the object while the */ /* object is live. */ +#endif GC_INNER ptr_t GC_allocobj(size_t sz, int kind); /* Make the indicated */ diff --git a/malloc.c b/malloc.c index 083704cf..51acb2fb 100644 --- a/malloc.c +++ b/malloc.c @@ -155,10 +155,12 @@ GC_INNER void * GC_generic_malloc_inner(size_t lb, int k) return op; } -/* Allocate a composite object of size n bytes. The caller guarantees */ -/* that pointers past the first page are not relevant. */ -GC_INNER void * GC_generic_malloc_inner_ignore_off_page(size_t lb, int k) -{ +#if defined(DBG_HDRS_ALL) || defined(GC_GCJ_SUPPORT) \ + || !defined(GC_NO_FINALIZATION) + /* Allocate a composite object of size n bytes. The caller */ + /* guarantees that pointers past the first page are not relevant. */ + GC_INNER void * GC_generic_malloc_inner_ignore_off_page(size_t lb, int k) + { word lb_adjusted; void * op; @@ -170,7 +172,8 @@ GC_INNER void * GC_generic_malloc_inner_ignore_off_page(size_t lb, int k) op = GC_alloc_large_and_clear(lb_adjusted, k, IGNORE_OFF_PAGE); GC_bytes_allocd += lb_adjusted; return op; -} + } +#endif #ifdef GC_COLLECT_AT_MALLOC /* Parameter to force GC at every malloc of size greater or equal to */ -- 2.40.0