From: Ivan Maidanski Date: Mon, 14 Nov 2016 07:58:26 +0000 (+0300) Subject: Eliminate 'GC_record_fault is never used' cppcheck style warning X-Git-Tag: v7.6.2~320 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ed6d40e48c85739dcaa168228d9f77728bb6ca8b;p=gc Eliminate 'GC_record_fault is never used' cppcheck style warning * 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. --- diff --git a/checksums.c b/checksums.c index c0ecebea..49120c39 100644 --- a/checksums.c +++ b/checksums.c @@ -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) { diff --git a/os_dep.c b/os_dep.c index 00323266..e8601b26 100644 --- a/os_dep.c +++ b/os_dep.c @@ -3106,12 +3106,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 # if defined(FREEBSD) || defined(HURD) || defined(HPUX)