From 842f762f18106677addecb0e2ca00c9cbf745e53 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Sat, 22 Oct 2016 10:11:46 +0300 Subject: [PATCH] Workaround 'value of SIGBUS unknown' cppcheck info messages * include/private/gcconfig.h [SIGBUS && !CPPCHECK] (HAVE_SIGBUS): New macro. * os_dep.c [NEED_FIND_LIMIT || UNIX_LIKE] (old_bus_handler, GC_set_and_save_fault_handler, GC_reset_fault_handler): Replace "ifdef SIGBUS" with "ifdef HAVE_SIGBUS". * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL] (GC_remove_allowed_signals): Likewise. --- include/private/gcconfig.h | 4 ++++ os_dep.c | 6 +++--- pthread_stop_world.c | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index c8a25ec..714e5d1 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -2862,6 +2862,10 @@ # undef MPROTECT_VDB #endif +#if defined(SIGBUS) && !defined(HAVE_SIGBUS) && !defined(CPPCHECK) +# define HAVE_SIGBUS +#endif + #ifndef SA_SIGINFO # define NO_SA_SIGACTION #endif diff --git a/os_dep.c b/os_dep.c index f1606be..b3e7fb5 100644 --- a/os_dep.c +++ b/os_dep.c @@ -847,7 +847,7 @@ GC_INNER size_t GC_page_size = 0; # endif # else static GC_fault_handler_t old_segv_handler; -# ifdef SIGBUS +# ifdef HAVE_SIGBUS static GC_fault_handler_t old_bus_handler; # endif # endif @@ -886,7 +886,7 @@ GC_INNER size_t GC_page_size = 0; # endif /* !GC_IRIX_THREADS */ # else old_segv_handler = signal(SIGSEGV, h); -# ifdef SIGBUS +# ifdef HAVE_SIGBUS old_bus_handler = signal(SIGBUS, h); # endif # endif @@ -922,7 +922,7 @@ GC_INNER size_t GC_page_size = 0; # endif # else (void) signal(SIGSEGV, old_segv_handler); -# ifdef SIGBUS +# ifdef HAVE_SIGBUS (void) signal(SIGBUS, old_bus_handler); # endif # endif diff --git a/pthread_stop_world.c b/pthread_stop_world.c index fa13f5c..407db8f 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c @@ -96,7 +96,7 @@ STATIC void GC_remove_allowed_signals(sigset_t *set) /* Handlers write to the thread structure, which is in the heap, */ /* and hence can trigger a protection fault. */ if (sigdelset(set, SIGSEGV) != 0 -# ifdef SIGBUS +# ifdef HAVE_SIGBUS || sigdelset(set, SIGBUS) != 0 # endif ) { -- 2.7.4