From be65438f20a5fe4fdc5c5bb2cfa7ba3f0e9da378 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Fri, 14 Oct 2022 14:33:08 -0400 Subject: jemalloc_internal_types.h: Use alloca if __STDC_NO_VLA__ is defined No currently-available version of Visual Studio C compiler supports variable length arrays, even if it defines __STDC_VERSION__ >= C99. As far as I know Microsoft has no plans to ever support VLAs in MSVC. The C11 standard requires that the __STDC_NO_VLA__ macro be defined if the compiler doesn't support VLAs, so fall back to alloca() if so. --- include/jemalloc/internal/jemalloc_internal_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/jemalloc/internal/jemalloc_internal_types.h b/include/jemalloc/internal/jemalloc_internal_types.h index 62c2b59c..b23a8bed 100644 --- a/include/jemalloc/internal/jemalloc_internal_types.h +++ b/include/jemalloc/internal/jemalloc_internal_types.h @@ -110,7 +110,7 @@ typedef enum malloc_init_e malloc_init_t; (((s) + (alignment - 1)) & ((~(alignment)) + 1)) /* Declare a variable-length array. */ -#if __STDC_VERSION__ < 199901L +#if __STDC_VERSION__ < 199901L || defined(__STDC_NO_VLA__) # ifdef _MSC_VER # include # define alloca _alloca -- cgit v1.2.1