1
0
mirror of https://https.git.savannah.gnu.org/git/gnulib.git synced 2026-05-13 15:13:36 +00:00

sigsegv: pacify -Wuseless-cast

This also makes the code a bit less confusing.
* lib/sigsegv.c (SIGSEGV_FAULT_ADDRESS): Now of type void *.
Change the Hurd implementation to guarantee this.
(sigsegv_handler): Omit no-longer needed cast to void *.
Omit function pointer cast when SIGSEGV_FAULT_ADDRESS_FROM_SIGINFO,
as it’s not needed in that case.
This commit is contained in:
Paul Eggert
2026-05-08 14:19:03 -07:00
parent c64ca1d7da
commit 0d170a7915
2 changed files with 11 additions and 3 deletions

View File

@@ -1,5 +1,13 @@
2026-05-08 Paul Eggert <eggert@cs.ucla.edu>
sigsegv: pacify -Wuseless-cast
This also makes the code a bit less confusing.
* lib/sigsegv.c (SIGSEGV_FAULT_ADDRESS): Now of type void *.
Change the Hurd implementation to guarantee this.
(sigsegv_handler): Omit no-longer needed cast to void *.
Omit function pointer cast when SIGSEGV_FAULT_ADDRESS_FROM_SIGINFO,
as its not needed in that case.
jit/cache-tests: omit confusing cast.
* tests/jit/test-cache.c (SET_CODE): Omit cast of char * to char *.

View File

@@ -362,7 +362,7 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
#if defined __gnu_hurd__ /* Hurd */
# define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, long code, struct sigcontext *scp
# define SIGSEGV_FAULT_ADDRESS (unsigned long) code
# define SIGSEGV_FAULT_ADDRESS (void *) (unsigned long) code
# define SIGSEGV_FAULT_CONTEXT scp
# if defined __x86_64__
@@ -1017,7 +1017,7 @@ static sigsegv_handler_t user_handler = (sigsegv_handler_t)NULL;
static void
sigsegv_handler (SIGSEGV_FAULT_HANDLER_ARGLIST)
{
void *address = (void *) (SIGSEGV_FAULT_ADDRESS);
void *address = SIGSEGV_FAULT_ADDRESS;
# if HAVE_STACK_OVERFLOW_RECOVERY
# if !(HAVE_STACKVMA || defined SIGSEGV_FAULT_STACKPOINTER)
@@ -1260,7 +1260,7 @@ install_for (int sig)
struct sigaction action;
# ifdef SIGSEGV_FAULT_ADDRESS_FROM_SIGINFO
action.sa_sigaction = (void (*) (int, siginfo_t *, void *)) &sigsegv_handler;
action.sa_sigaction = sigsegv_handler;
# else
action.sa_handler = (void (*) (int)) &sigsegv_handler;
# endif