Skip to content

Commit 9d79589

Browse files
committed
[sanitizer_common] Suppress warning of cast from SignalHandlerType to sa_sigaction_t
Some buildbots have recently started complaining about "cast from 'SignalHandlerType' (aka 'void (*)(int, void *, void *)') to 'sa_sigaction_t' (aka 'void (*)(int, siginfo_t *, void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]" 219 | sigact.sa_sigaction = (sa_sigaction_t)handler; This patch does an intermediate cast to '(void (*) (void))' to suppress the warning. N.B. SignalHandlerType has 'void*' instead of 'siginfo_t*' because it is typedef'ed in sanitizer_common/sanitizer_common.h, which does not have access to the header (signal.h) that defines siginfo_t; we therefore cannot fix SignalHandlerType.
1 parent a7d5f73 commit 9d79589

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ static void MaybeInstallSigaction(int signum,
216216

217217
struct sigaction sigact;
218218
internal_memset(&sigact, 0, sizeof(sigact));
219-
sigact.sa_sigaction = (sa_sigaction_t)handler;
219+
sigact.sa_sigaction = (sa_sigaction_t)(void (*)(void))handler;
220220
// Do not block the signal from being received in that signal's handler.
221221
// Clients are responsible for handling this correctly.
222222
sigact.sa_flags = SA_SIGINFO | SA_NODEFER;

0 commit comments

Comments
 (0)