summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Smith <paul@mad-scientist.net>2022-10-14 14:33:08 -0400
committerQi Wang <interwq@gmail.com>2022-10-14 15:48:32 -0700
commitbe65438f20a5fe4fdc5c5bb2cfa7ba3f0e9da378 (patch)
tree41f9403cc2d436c5643cb00e44df61535001da2c
parent1897f185d2c06307fefc4d8f4512eeb13c474999 (diff)
downloadjemalloc-be65438f20a5fe4fdc5c5bb2cfa7ba3f0e9da378.tar.gz
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.
-rw-r--r--include/jemalloc/internal/jemalloc_internal_types.h2
1 files changed, 1 insertions, 1 deletions
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 <malloc.h>
# define alloca _alloca