]> granicus.if.org Git - gc/commitdiff
Eliminate 'GC_record_fault is never used' cppcheck style warning
authorIvan Maidanski <ivmai@mail.ru>
Mon, 14 Nov 2016 07:58:26 +0000 (10:58 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 14 Nov 2016 07:58:26 +0000 (10:58 +0300)
* checksums.c [CHECKSUMS] (GC_record_fault): Do not define unless
MPROTECT_VDB and not DARWIN.
* os_dep.c [MPROTECT_VDB && CHECKSUMS] (GC_record_fault): Do not
declare if DARWIN.

checksums.c
os_dep.c

index c0ecebea3e72b86b0d17d1d73de122f73ed68b2c..49120c39686c79a2035e046ca570804579dcf265 100644 (file)
@@ -39,14 +39,16 @@ STATIC word GC_faulted[NSUMS] = { 0 };
 
 STATIC size_t GC_n_faulted = 0;
 
-void GC_record_fault(struct hblk * h)
-{
+#if defined(MPROTECT_VDB) && !defined(DARWIN)
+  void GC_record_fault(struct hblk * h)
+  {
     word page = (word)h & ~(GC_page_size - 1);
 
     GC_ASSERT(GC_page_size != 0);
     if (GC_n_faulted >= NSUMS) ABORT("write fault log overflowed");
     GC_faulted[GC_n_faulted++] = page;
-}
+  }
+#endif
 
 STATIC GC_bool GC_was_faulted(struct hblk *h)
 {
index 1423f72d4031154e1d34d3191a1da9193c88ff54..98c8832b65129400c8bdd8df59cddc9ec20cc648 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -3098,12 +3098,12 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void)
                         set_pht_entry_from_index(db, index)
 #endif /* !THREADS */
 
-#ifdef CHECKSUMS
-  void GC_record_fault(struct hblk * h); /* from checksums.c */
-#endif
-
 #ifndef DARWIN
 
+# ifdef CHECKSUMS
+    void GC_record_fault(struct hblk * h); /* from checksums.c */
+# endif
+
 # if !defined(MSWIN32) && !defined(MSWINCE)
 #   include <errno.h>
 #   if defined(FREEBSD) || defined(HURD) || defined(HPUX)