Variable-length arrays (VLA) are a feature of C99, that was made optional in C11. A compliant C11 compiler defines __STDC_NO_VLA__ to 1 if it doesn't support VLAs.
MSVC doesn't implement VLAs in C99 (non-compliant) but defines __STDC_NO_VLA__ in C11 mode. If we don't guard the VLA in _AC_C_C99_TEST_MAIN, as the test is included in _AC_C_C11_TEST_PROGRAM, MSVC won't be considered as a compiler supporting C11 (which, to some extent, it does). Fix this by guarding the C99 code using VLA with the C11 macro __STDC_NO_VLA__. --- lib/autoconf/c.m4 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4 index 306ee63e..0ba98b28 100644 --- a/lib/autoconf/c.m4 +++ b/lib/autoconf/c.m4 @@ -1337,13 +1337,18 @@ ac_c_conftest_c99_main=' ni.number = 58; +#if !defined(__STDC_NO_VLA__) || __STDC_NO_VLA__ != 1 int dynamic_array[ni.number]; dynamic_array[0] = argv[0][0]; dynamic_array[ni.number - 1] = 543; +#endif // work around unused variable warnings ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' - || dynamic_array[ni.number - 1] != 543); +#if !defined(__STDC_NO_VLA__) || __STDC_NO_VLA__ != 1 + || dynamic_array[ni.number - 1] != 543 +#endif + ); ' ]])]) -- 2.44.0