From 300b58b49ba2df0ca524acff8a57a44af170a1c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= Date: Sat, 9 May 2026 12:49:50 +0200 Subject: [PATCH] arena_s: Replace bin_t all_bins[0] by [] for C99 or newer Zero-sized arrays are not allowed by ISO C. C99 introduced a way to express this. Type-checking fails, because all_bins is asigned malloced storage of length > 0. Found by GCC and Clang (-Wpedantic). --- include/jemalloc/internal/arena_structs.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/jemalloc/internal/arena_structs.h b/include/jemalloc/internal/arena_structs.h index 77777f1d..ccab0a17 100644 --- a/include/jemalloc/internal/arena_structs.h +++ b/include/jemalloc/internal/arena_structs.h @@ -104,7 +104,11 @@ struct arena_s { "Do not use this field directly. " "Use `arena_get_bin` instead.") JEMALLOC_ALIGNED(CACHELINE) +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + bin_t all_bins[]; +#else bin_t all_bins[0]; +#endif }; #endif /* JEMALLOC_INTERNAL_ARENA_STRUCTS_H */