* Noteworthy changes in release ?.? (????-??-??) [?]
+** Backward incompatibilities
+
+*** AC_PROG_CC no longer tests for VLAs, or whether __STDC__ is defined.
+ This ports better to MSVC, which does not support variable length
+ arrays and does not define __STDC__. Although C99 requires VLAs,
+ they are optional in C11 and later. Programs can use AC_C_VARARRAYS
+ and __STDC_NO_VLA__ to use VLAs if available.
* Noteworthy changes in release 2.72 (2023-12-22) [release]
standard C at all.
The tests for standard conformance are not comprehensive. They test the
-values of @code{__STDC__} and @code{__STDC_VERSION__}, and a
+value of @code{__STDC_VERSION__}, and a
representative sample of the language features added in each version of
-the C standard. They do not test the C standard library, because the C
+the C standard. They do not examine @code{__STDC__}
+because some compilers by default leave it undefined.
+They do not test for variable-length arrays,
+a C99 feature that was made optional in C11;
+if you need to use this feature when available, use @code{AC_C_VARARRAYS}.
+They do not test the C standard library, because the C
compiler might be generating code for a ``freestanding environment''
(in which most of the standard library is optional). If you need to know
whether a particular C standard header exists, use @code{AC_CHECK_HEADER}.
[m4_divert_text([INIT_PREPARE],
[[# Test code for whether the C compiler supports C89 (global declarations)
ac_c_conftest_c89_globals='
-/* Does the compiler advertise C89 conformance?
- Do not test the value of __STDC__, because some compilers set it to 0
- while being otherwise adequately conformant. */
-#if !defined __STDC__
-# error "Compiler does not advertise C89 conformance"
-#endif
+/* Do not test the value of __STDC__, because some compilers define it to 0
+ or do not define it, while otherwise adequately conforming. */
#include <stddef.h>
#include <stdarg.h>
ni.number = 58;
- int dynamic_array[ni.number];
- dynamic_array[0] = argv[0][0];
- dynamic_array[ni.number - 1] = 543;
+ // Do not test for VLAs, as some otherwise-conforming compilers lack them.
+ // C code should instead use __STDC_NO_VLA__; see Autoconf manual.
// work around unused variable warnings
ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\''
- || dynamic_array[ni.number - 1] != 543);
+ || ni.number != 58);
'
]])])
# shell quotes around the group.
#
# GCC, Clang -std=gnu11
+# MSVC -std:c11
#
# For IBM XL C for AIX V16.1 or later, '-std=gnu11' should work if
# the user configured with CC='xlclang'. Otherwise, do not try
# _Noreturn, which is a win.
m4_define([_AC_C_C11_OPTIONS], [
-std=gnu11
+ -std:c11
])