From: mark.yang Date: Wed, 2 Apr 2025 06:25:42 +0000 (+0900) Subject: fix build with gcc-15 -Wbuiltin-declaration-mismatch error X-Git-Tag: release-1.23.0rc1~22^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1262%2Fhead;p=thirdparty%2Funbound.git fix build with gcc-15 -Wbuiltin-declaration-mismatch error See more details: http://errors.yoctoproject.org/Errors/Details/850313 ../git/compat/malloc.c:9:7: warning: conflicting types for built-in function 'malloc'; expected 'void *(long unsigned int)' [-Wbuiltin-declaration-mismatch] 9 | void *malloc (); | ^~~~~~ ../git/compat/malloc.c:5:1: note: 'malloc' is declared in header '' 4 | #include "config.h" +++ |+#include 5 | #undef malloc ../git/compat/malloc.c: In function 'rpl_malloc_unbound': ../git/compat/malloc.c:23:10: error: too many arguments to function 'malloc'; expected 0, have 1 23 | return malloc (n); | ^~~~~~ ~ ../git/compat/malloc.c:9:7: note: declared here 9 | void *malloc (); | ^~~~~~ * Seeing that there is '#undef malloc', it appears they don't want to use the malloc from stdlib.h. Therefore, we need to correctly define the parameters for malloc. Signed-off-by: mark.yang --- diff --git a/compat/malloc.c b/compat/malloc.c index d8097b13e..af9dcf134 100644 --- a/compat/malloc.c +++ b/compat/malloc.c @@ -6,7 +6,7 @@ #include #ifndef USE_WINSOCK -void *malloc (); +void *malloc (size_t n); #else /* provide a prototype */ void *malloc (size_t n);