]> Savannah Git Hosting - gnulib.git/commitdiff
malloca: pacify gcc -Wbad-function-cast
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 23 Feb 2018 20:47:38 +0000 (12:47 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 23 Feb 2018 20:48:10 +0000 (12:48 -0800)
* lib/malloca.h (malloca): Pacify gcc -Wbad-function-cast
diagnostic that I got on Fedora 27 with gcc 7.3.1 20180130.
To pacify GCC, I had to cast alloca’s result to some type other
than void * before casting that to uintptr_t.

ChangeLog
lib/malloca.h

index 15fad2bb5ee8119883496d0dd31edaccc7c784be..50a3bb568a00898a742b6762d90e34429c559a41 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2018-02-23  Paul Eggert  <eggert@cs.ucla.edu>
+
+       malloca: pacify gcc -Wbad-function-cast
+       * lib/malloca.h (malloca): Pacify gcc -Wbad-function-cast
+       diagnostic that I got on Fedora 27 with gcc 7.3.1 20180130.
+       To pacify GCC, I had to cast alloca’s result to some type other
+       than void * before casting that to uintptr_t.
+
 2018-02-20  Paul Eggert  <eggert@cs.ucla.edu>
 
        utimecmp: new function utimecmpat
index cbc8fe7ab715df608160f8834b41f7bfb9b5ead7..640186586960f7386ba305fc0abbdb7e94b91379 100644 (file)
@@ -57,7 +57,7 @@ extern "C" {
 #if HAVE_ALLOCA
 # define malloca(N) \
   ((N) < 4032 - (2 * sa_alignment_max - 1)                          \
-   ? (void *) (((uintptr_t) alloca ((N) + 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))            \
    : mmalloca (N))