From: Bruno Haible <bruno@clisp.org> Date: Sat, 24 Feb 2018 00:33:35 +0000 (+0100) Subject: xmalloca: pacify gcc -Wbad-function-cast X-Git-Tag: v1.0~5726 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=9ce5bc4970fb44573fc52d8f885f831cf09f8768;p=gnulib.git xmalloca: pacify gcc -Wbad-function-cast * lib/xmalloca.h (xmalloca): Insert intermediate cast here as well. --- diff --git a/ChangeLog b/ChangeLog index fcbda12718..6c51a009ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2018-02-23 Bruno Haible <bruno@clisp.org> + + xmalloca: pacify gcc -Wbad-function-cast + * lib/xmalloca.h (xmalloca): Insert intermediate cast here as well. + 2018-02-23 Paul Eggert <eggert@cs.ucla.edu> 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