From f33bd157ad1c5965d8c553ad3b835e100cddd394 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Mon, 12 Feb 2024 23:35:11 +0300 Subject: [PATCH] Eliminate 'unused function GC_unprotect_all_heap' warning on Linux (fix of commit 804fd773e) Issue #579 (bdwgc). * os_dep.c [MPROTECT_VDB && CAN_HANDLE_FORK && !COUNT_PROTECTED_REGIONS] (GC_unprotect_all_heap): Do not define unless DARWIN. --- os_dep.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/os_dep.c b/os_dep.c index ccd25c5f9..10b048aa3 100644 --- a/os_dep.c +++ b/os_dep.c @@ -3567,7 +3567,8 @@ STATIC void GC_protect_heap(void) /* problems. It is preferred that the client instead avoids writing */ /* to the write-protected heap with a system call. */ -# if defined(CAN_HANDLE_FORK) || defined(COUNT_PROTECTED_REGIONS) +# if defined(CAN_HANDLE_FORK) && defined(DARWIN) \ + || defined(COUNT_PROTECTED_REGIONS) /* Remove protection for the entire heap not updating GC_dirty_pages. */ STATIC void GC_unprotect_all_heap(void) { @@ -3579,7 +3580,7 @@ STATIC void GC_protect_heap(void) UNPROTECT(GC_heap_sects[i].hs_start, GC_heap_sects[i].hs_bytes); } } -# endif /* CAN_HANDLE_FORK || COUNT_PROTECTED_REGIONS */ +# endif /* CAN_HANDLE_FORK && DARWIN || COUNT_PROTECTED_REGIONS */ # ifdef COUNT_PROTECTED_REGIONS GC_INNER void GC_handle_protected_regions_limit(void)