From: Adhemerval Zanella Date: Mon, 22 Dec 2025 14:42:18 +0000 (+0000) Subject: malloc: Fix clang build after 1c588a2187 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bd569425330c6f5644c232b4b253e9ab905fcdba;p=thirdparty%2Fglibc.git malloc: Fix clang build after 1c588a2187 clang issues: malloc.c:1909:8: error: converting the result of '<<' to a boolean always evaluates to true [-Werror,-Wtautological-constant-compare] 1909 | if (!DEFAULT_THP_PAGESIZE || mp_.thp_mode != malloc_thp_mode_not_supported) | ^ ../sysdeps/unix/sysv/linux/aarch64/malloc-hugepages.h:19:35: note: expanded from macro 'DEFAULT_THP_PAGESIZE' 19 | #define DEFAULT_THP_PAGESIZE (1UL << 21) Checked on aarch64-linux-gnu. --- diff --git a/malloc/malloc.c b/malloc/malloc.c index be29929993..20f24cce9f 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -1906,7 +1906,7 @@ static __always_inline void thp_init (void) { /* Initialize only once if DEFAULT_THP_PAGESIZE is defined. */ - if (!DEFAULT_THP_PAGESIZE || mp_.thp_mode != malloc_thp_mode_not_supported) + if (DEFAULT_THP_PAGESIZE == 0 || mp_.thp_mode != malloc_thp_mode_not_supported) return; /* Set thp_pagesize even if thp_mode is never. This reduces frequency