changeset 39254:9c2a1e8dd1a2

xmalloca: pacify gcc -Wbad-function-cast * lib/xmalloca.h (xmalloca): Insert intermediate cast here as well.
author Bruno Haible <bruno@clisp.org>
date Sat, 24 Feb 2018 01:33:35 +0100
parents fd97627dfc51
children 58ce5939327d
files ChangeLog lib/malloca.h lib/xmalloca.h
diffstat 3 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Feb 23 13:15:24 2018 -0800
+++ b/ChangeLog	Sat Feb 24 01:33:35 2018 +0100
@@ -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
--- a/lib/malloca.h	Fri Feb 23 13:15:24 2018 -0800
+++ b/lib/malloca.h	Sat Feb 24 01:33:35 2018 +0100
@@ -56,10 +56,10 @@
    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) \
--- a/lib/xmalloca.h	Fri Feb 23 13:15:24 2018 -0800
+++ b/lib/xmalloca.h	Sat Feb 24 01:33:35 2018 +0100
@@ -32,10 +32,10 @@
    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