summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2018-03-01 23:02:41 +0300
committerIvan Maidanski <ivmai@mail.ru>2018-03-01 23:03:47 +0300
commitdc8191fd5516c9fc3e722b8204f7af589c5be12a (patch)
tree5fd687b2f88c2d65a4ed2b8265d4c8b54a1a09e6
parent832d5bcb5a2461bf9ab0309bf75f90dfdc2f6cd6 (diff)
downloadbdwgc-dc8191fd5516c9fc3e722b8204f7af589c5be12a.tar.gz
Eliminate 'unused const variable' C++ warnings for [a][u]objfreelist_ptr
Issue #206 (bdwgc). * Makefile.direct (SRCS): Add include/gc_alloc_ptrs.h. * include/include.am (dist_noinst_HEADERS): Likewise. * include/gc_alloc_ptrs.h: New file. * include/new_gc_alloc.h (GC_objfreelist_ptr, GC_aobjfreelist_ptr, GC_uobjfreelist_ptr, GC_auobjfreelist_ptr, GC_incr_bytes_allocd, GC_incr_bytes_freed): Move to the declarations to gc_alloc_ptrs.h. * include/new_gc_alloc.h: Include gc_alloc_ptrs.h; update comment. * mallocx.c: Likewise.
-rw-r--r--Makefile.direct2
-rw-r--r--include/gc_alloc_ptrs.h40
-rw-r--r--include/include.am1
-rw-r--r--include/new_gc_alloc.h13
-rw-r--r--mallocx.c1
5 files changed, 44 insertions, 13 deletions
diff --git a/Makefile.direct b/Makefile.direct
index 6fce4d50..80d4b9c7 100644
--- a/Makefile.direct
+++ b/Makefile.direct
@@ -106,7 +106,7 @@ SRCS= $(CSRCS) \
include/gc_inline.h include/gc_mark.h include/gc_disclaim.h \
tools/threadlibs.c tools/if_mach.c tools/if_not_there.c gc_cpp.cc \
include/gc_cpp.h include/weakpointer.h include/private/gc_locks.h \
- include/new_gc_alloc.h include/gc_allocator.h \
+ include/new_gc_alloc.h include/gc_alloc_ptrs.h include/gc_allocator.h \
include/javaxfc.h \
include/gc_backptr.h include/gc_gcj.h include/private/dbg_mlc.h \
include/private/specific.h include/leak_detector.h \
diff --git a/include/gc_alloc_ptrs.h b/include/gc_alloc_ptrs.h
new file mode 100644
index 00000000..4d559e5f
--- /dev/null
+++ b/include/gc_alloc_ptrs.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 1996-1998 by Silicon Graphics. All rights reserved.
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+/* This file should never be included by clients directly. */
+
+#ifndef GC_ALLOC_PTRS_H
+#define GC_ALLOC_PTRS_H
+
+#include "gc.h"
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+GC_API void ** const GC_objfreelist_ptr;
+GC_API void ** const GC_aobjfreelist_ptr;
+GC_API void ** const GC_uobjfreelist_ptr;
+
+#ifdef GC_ATOMIC_UNCOLLECTABLE
+ GC_API void ** const GC_auobjfreelist_ptr;
+#endif
+
+GC_API void GC_CALL GC_incr_bytes_allocd(size_t bytes);
+GC_API void GC_CALL GC_incr_bytes_freed(size_t bytes);
+
+#ifdef __cplusplus
+ } /* extern "C" */
+#endif
+
+#endif /* GC_ALLOC_PTRS_H */
diff --git a/include/include.am b/include/include.am
index 6dec292a..fe4e16b1 100644
--- a/include/include.am
+++ b/include/include.am
@@ -35,6 +35,7 @@ dist_noinst_HEADERS += \
include/cord.h \
include/cord_pos.h \
include/ec.h \
+ include/gc_alloc_ptrs.h \
include/new_gc_alloc.h \
include/private/darwin_semaphore.h \
include/private/darwin_stop_world.h \
diff --git a/include/new_gc_alloc.h b/include/new_gc_alloc.h
index 39dadfc6..866136b4 100644
--- a/include/new_gc_alloc.h
+++ b/include/new_gc_alloc.h
@@ -72,19 +72,8 @@
#include <stddef.h>
#include <string.h>
-// The following need to match collector data structures.
// We can't include gc_priv.h, since that pulls in way too much stuff.
-// This should eventually be factored out into another include file.
-
-extern "C" {
- GC_API void ** const GC_objfreelist_ptr;
- GC_API void ** const GC_aobjfreelist_ptr;
- GC_API void ** const GC_uobjfreelist_ptr;
- GC_API void ** const GC_auobjfreelist_ptr;
-
- GC_API void GC_CALL GC_incr_bytes_allocd(size_t bytes);
- GC_API void GC_CALL GC_incr_bytes_freed(size_t bytes);
-}
+#include "gc_alloc_ptrs.h"
#define GC_generic_malloc_words_small(lw, k) \
GC_generic_malloc((lw) * sizeof(GC_word), k)
diff --git a/mallocx.c b/mallocx.c
index 73e50bb9..390661ba 100644
--- a/mallocx.c
+++ b/mallocx.c
@@ -40,6 +40,7 @@
/* Some externally visible but unadvertised variables to allow access to */
/* free lists from inlined allocators without including gc_priv.h */
/* or introducing dependencies on internal data structure layouts. */
+#include "gc_alloc_ptrs.h"
void ** const GC_objfreelist_ptr = GC_objfreelist;
void ** const GC_aobjfreelist_ptr = GC_aobjfreelist;
void ** const GC_uobjfreelist_ptr = GC_uobjfreelist;