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.
This commit is contained in:
Paul Smith 2022-10-14 14:33:08 -04:00 committed by Qi Wang
parent 1897f185d2
commit be65438f20

View File

@ -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 <malloc.h>
# define alloca _alloca