Fix 'GC_generic_malloc_inner_ignore_off_page not used' compiler warning
authorIvan Maidanski <ivmai@mail.ru>
Fri, 18 Mar 2016 18:06:53 +0000 (21:06 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 18 Mar 2016 18:06:53 +0000 (21:06 +0300)
(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
malloc.c

index d2f69be..8318ca4 100644 (file)
@@ -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                   */
index 083704c..51acb2f 100644 (file)
--- 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  */