]> granicus.if.org Git - gc/commitdiff
Eliminate 'unused const variable' C++ warnings for [a][u]objfreelist_ptr
authorIvan Maidanski <ivmai@mail.ru>
Thu, 1 Mar 2018 20:02:41 +0000 (23:02 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 1 Mar 2018 20:03:47 +0000 (23:03 +0300)
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.

Makefile.direct
include/gc_alloc_ptrs.h [new file with mode: 0644]
include/include.am
include/new_gc_alloc.h
mallocx.c

index 6fce4d5044cbf238456f34282be47c8f4b4641d4..80d4b9c720f2b79be80307efb945a36e414f515f 100644 (file)
@@ -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 (file)
index 0000000..4d559e5
--- /dev/null
@@ -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 */
index 6dec292ab10c4c273d3ca5fc2d7ffceb33fd3021..fe4e16b1e56ea1091c241be243a5ab7b6b9634c0 100644 (file)
@@ -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 \
index 39dadfc64578e47dbd0e26204e554cfc018081c2..866136b4486a386e0bae164ffeb11b4a81966990 100644 (file)
 #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)
index 73e50bb9279daf9755b92209bd5630944c966fa9..390661ba0712902da8d359225740f6ba45b3ceaf 100644 (file)
--- 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;