]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
malloc: Fix clang build after 1c588a2187 master
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 22 Dec 2025 14:42:18 +0000 (14:42 +0000)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 22 Dec 2025 18:55:34 +0000 (15:55 -0300)
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

index be29929993a2f7f3d269e7d9ed9952cf0d8f109d..20f24cce9f0fa15c8838d415fa35cfa0609e9574 100644 (file)
@@ -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