mirror of
https://https.git.savannah.gnu.org/git/gnulib.git
synced 2026-05-13 15:13:36 +00:00
Revisit some -Wuseless-cast changes.
* lib/fstrcmp.c (fstrcmp_free_resources, fstrcmp_bounded): Use a compound literal to convert to uintptr_t. * lib/wait-process.c (wait_subprocess): Use a compound literal to convert to int. * lib/sigsegv.c: Revert last change. Instead, disable -Wuseless-cast in this compilation unit. * tests/jit/test-cache.c: Likewise. * tests/test-limits-h.c: Disable -Wuseless-cast warnings also for gcc 14, 15.
This commit is contained in:
13
ChangeLog
13
ChangeLog
@@ -1,3 +1,16 @@
|
||||
2026-05-10 Bruno Haible <bruno@clisp.org>
|
||||
|
||||
Revisit some -Wuseless-cast changes.
|
||||
* lib/fstrcmp.c (fstrcmp_free_resources, fstrcmp_bounded): Use a
|
||||
compound literal to convert to uintptr_t.
|
||||
* lib/wait-process.c (wait_subprocess): Use a compound literal to
|
||||
convert to int.
|
||||
* lib/sigsegv.c: Revert last change. Instead, disable -Wuseless-cast
|
||||
in this compilation unit.
|
||||
* tests/jit/test-cache.c: Likewise.
|
||||
* tests/test-limits-h.c: Disable -Wuseless-cast warnings also for
|
||||
gcc 14, 15.
|
||||
|
||||
2026-05-10 Bruno Haible <bruno@clisp.org>
|
||||
|
||||
Fix many test failures on Windows and 32-bit AIX (regr. 2026-05-08).
|
||||
|
||||
@@ -82,7 +82,7 @@ fstrcmp_free_resources (void)
|
||||
if (buffer != NULL)
|
||||
{
|
||||
gl_tls_set (buffer_key, NULL);
|
||||
gl_tls_set (bufmax_key, (void *) (uintptr_t) 0);
|
||||
gl_tls_set (bufmax_key, (void *) (uintptr_t) {0});
|
||||
free (buffer);
|
||||
}
|
||||
}
|
||||
@@ -214,7 +214,7 @@ fstrcmp_bounded (const char *string1, const char *string2, double lower_bound)
|
||||
free (buffer);
|
||||
buffer = xnmalloc (bufmax, 2 * sizeof *buffer);
|
||||
gl_tls_set (buffer_key, buffer);
|
||||
gl_tls_set (bufmax_key, (void *) bufmax);
|
||||
gl_tls_set (bufmax_key, (void *) (uintptr_t) {bufmax});
|
||||
}
|
||||
ctxt.fdiag = buffer + yvec_length + 1;
|
||||
ctxt.bdiag = ctxt.fdiag + fdiag_len;
|
||||
|
||||
@@ -35,6 +35,13 @@
|
||||
# include <sys/param.h> /* defines macro OpenBSD */
|
||||
#endif
|
||||
|
||||
/* The value of SIGSEGV_FAULT_ADDRESS may be any representation of an address
|
||||
(void *, char *, uintptr_t, intptr_t), depending on platform. The cast is
|
||||
therefore mandatory, to avoid a compilation error or warning. */
|
||||
#if _GL_GNUC_PREREQ (14, 0)
|
||||
# pragma GCC diagnostic ignored "-Wuseless-cast"
|
||||
#endif
|
||||
|
||||
|
||||
/* Version number. */
|
||||
int libsigsegv_version = LIBSIGSEGV_VERSION;
|
||||
@@ -362,7 +369,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 (void *) (unsigned long) code
|
||||
# define SIGSEGV_FAULT_ADDRESS (unsigned long) code
|
||||
# define SIGSEGV_FAULT_CONTEXT scp
|
||||
|
||||
# if defined __x86_64__
|
||||
@@ -1017,7 +1024,7 @@ static sigsegv_handler_t user_handler = (sigsegv_handler_t)NULL;
|
||||
static void
|
||||
sigsegv_handler (SIGSEGV_FAULT_HANDLER_ARGLIST)
|
||||
{
|
||||
void *address = SIGSEGV_FAULT_ADDRESS;
|
||||
void *address = (void *) (SIGSEGV_FAULT_ADDRESS);
|
||||
|
||||
# if HAVE_STACK_OVERFLOW_RECOVERY
|
||||
# if !(HAVE_STACKVMA || defined SIGSEGV_FAULT_STACKPOINTER)
|
||||
@@ -1260,7 +1267,7 @@ install_for (int sig)
|
||||
struct sigaction action;
|
||||
|
||||
# ifdef SIGSEGV_FAULT_ADDRESS_FROM_SIGINFO
|
||||
action.sa_sigaction = sigsegv_handler;
|
||||
action.sa_sigaction = (void (*) (int, siginfo_t *, void *)) &sigsegv_handler;
|
||||
# else
|
||||
action.sa_handler = (void (*) (int)) &sigsegv_handler;
|
||||
# endif
|
||||
|
||||
@@ -383,7 +383,7 @@ wait_subprocess (pid_t child, const char *progname,
|
||||
if (exit_on_error || (!null_stderr && termsigp == NULL))
|
||||
error (exit_on_error ? EXIT_FAILURE : 0, 0,
|
||||
_("%s subprocess got fatal signal %d"),
|
||||
progname, WTERMSIG (status));
|
||||
progname, (int) {WTERMSIG (status)});
|
||||
return 127;
|
||||
}
|
||||
if (!WIFEXITED (status))
|
||||
|
||||
@@ -50,6 +50,12 @@
|
||||
#endif
|
||||
static int clang_ubsan_workaround = 0;
|
||||
|
||||
/* This file freely casts between the different representations of addresses
|
||||
(void *, char *, function pointers, uintptr_t). Not worth warning about. */
|
||||
#if _GL_GNUC_PREREQ (14, 0)
|
||||
# pragma GCC diagnostic ignored "-Wuseless-cast"
|
||||
#endif
|
||||
|
||||
/* On most platforms, function pointers are just a pointer to the
|
||||
code, i.e. to the first instruction to be executed. This,
|
||||
however, is not universally true, see:
|
||||
@@ -116,7 +122,7 @@ struct func
|
||||
# else
|
||||
# define CODE(funcptr) ((char *) (funcptr) - clang_ubsan_workaround)
|
||||
# define SET_CODE(funcptr,code_addr) \
|
||||
((void) ((funcptr) = (void *) ((code_addr) + clang_ubsan_workaround)))
|
||||
((void) ((funcptr) = (void *) ((char *) (code_addr) + clang_ubsan_workaround)))
|
||||
# define IS(funcptr) ((void) (funcptr), 0)
|
||||
# define SET_IS(funcptr,is) ((void) (funcptr), (void) (is))
|
||||
# endif
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
#define verify_width(width, min, max) \
|
||||
static_assert ((max) >> ((width) - 1 - ((min) < 0)) == 1)
|
||||
|
||||
/* Macros borrowed from intprops.h. */
|
||||
#if 16 <= __GNUC__
|
||||
/* Macros borrowed from intprops.h and intprops-internal.h. */
|
||||
#if 14 <= __GNUC__
|
||||
# pragma GCC diagnostic ignored "-Wuseless-cast"
|
||||
#endif
|
||||
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
|
||||
|
||||
Reference in New Issue
Block a user