From bd569425330c6f5644c232b4b253e9ab905fcdba Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Mon, 22 Dec 2025 14:42:18 +0000 Subject: [PATCH] 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. --- malloc/malloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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