From 9430f6ac760e732646fe5e2a7481c27a619a95ca 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) (Apply commit d6c3457 from 'master' branch.) * 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 | 14 ++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index f5f63155..93e0bd1d 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -1823,12 +1823,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 af0b3a22..3831822b 100644 --- a/malloc.c +++ b/malloc.c @@ -146,11 +146,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. Caller holds */ -/* allocation lock. */ -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; @@ -160,7 +161,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