From 9ce5bc4970fb44573fc52d8f885f831cf09f8768 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 24 Feb 2018 01:33:35 +0100 Subject: [PATCH] xmalloca: pacify gcc -Wbad-function-cast * lib/xmalloca.h (xmalloca): Insert intermediate cast here as well. --- ChangeLog | 5 +++++ lib/malloca.h | 6 +++--- lib/xmalloca.h | 8 ++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index fcbda12718..6c51a009ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2018-02-23 Bruno Haible + + xmalloca: pacify gcc -Wbad-function-cast + * lib/xmalloca.h (xmalloca): Insert intermediate cast here as well. + 2018-02-23 Paul Eggert nl_langinfo: pacify gcc -Wunused-function diff --git a/lib/malloca.h b/lib/malloca.h index 6401865869..8e8f9cfd4b 100644 --- a/lib/malloca.h +++ b/lib/malloca.h @@ -56,10 +56,10 @@ extern "C" { the function returns. Upon failure, it returns NULL. */ #if HAVE_ALLOCA # define malloca(N) \ - ((N) < 4032 - (2 * sa_alignment_max - 1) \ + ((N) < 4032 - (2 * sa_alignment_max - 1) \ ? (void *) (((uintptr_t) (char *) alloca ((N) + 2 * sa_alignment_max - 1) \ - + (2 * sa_alignment_max - 1)) \ - & ~(uintptr_t)(2 * sa_alignment_max - 1)) \ + + (2 * sa_alignment_max - 1)) \ + & ~(uintptr_t)(2 * sa_alignment_max - 1)) \ : mmalloca (N)) #else # define malloca(N) \ diff --git a/lib/xmalloca.h b/lib/xmalloca.h index 14fc1b9dcc..2900a07b4b 100644 --- a/lib/xmalloca.h +++ b/lib/xmalloca.h @@ -32,10 +32,10 @@ extern "C" { the function returns. Upon failure, it exits with an error message. */ #if HAVE_ALLOCA # define xmalloca(N) \ - ((N) < 4032 - (2 * sa_alignment_max - 1) \ - ? (void *) (((uintptr_t) alloca ((N) + 2 * sa_alignment_max - 1) \ - + (2 * sa_alignment_max - 1)) \ - & ~(uintptr_t)(2 * sa_alignment_max - 1)) \ + ((N) < 4032 - (2 * sa_alignment_max - 1) \ + ? (void *) (((uintptr_t) (char *) alloca ((N) + 2 * sa_alignment_max - 1) \ + + (2 * sa_alignment_max - 1)) \ + & ~(uintptr_t)(2 * sa_alignment_max - 1)) \ : xmmalloca (N)) extern void * xmmalloca (size_t n); #else -- 2.39.5