Re: Making MSVC/clang-cl succeed AC_PROG_CC C11 discovery

Sam James <[email protected]> Tue, 30 Apr 2024 19:01:13 +0100
Newsgroups gmane.comp.sysutils.autoconf.general
Organization Gentoo
Message-ID <[email protected]>
Paul Eggert <[email protected]> writes:

> On 2024-04-26 08:10, Zack Weinberg wrote:
>
>> I think what we should do here is fold AC_C_VARARRAYS into AC_PROG_CC.
>> Take the test for VLAs completely out of _AC_C_C99_TEST_MAIN, but
>> unconditionally *run* a test for VLAs as part of AC_PROG_CC.  If that
>> test fails, and __STDC_NO_VLA__ was not defined by the compiler,
>> then AC_DEFINE([__STDC_NO_VLA__], 1)
>
> Although the basic strategy sounds reasonable, AC_PROG_CC is
> documented to operate by setting compiler options not via AC_DEFINE,
> so presumably this should put -D__STDC_NO_VLA__ into $CC rather than
> use AC_DEFINE.
>
> I installed the attached patch, which is less ambitious but should
> address the original problem report. The attached patch doesn't
> preclude your suggestion, which can be done later as needed.
>
> [2. text/x-patch; 0001-Port-better-to-MSVC.patch]...

Note that "or later" isn't right -- C23 makes VLAs mandatory again.
signature.asc (application/pgp-signature, 377 B)
-----BEGIN PGP SIGNATURE-----

iOUEARYKAI0WIQQlpruI3Zt2TGtVQcJzhAn1IN+RkAUCZjEx6l8UgAAAAAAuAChp
c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0MjVB
NkJCODhERDlCNzY0QzZCNTU0MUMyNzM4NDA5RjUyMERGOTE5MA8cc2FtQGdlbnRv
by5vcmcACgkQc4QJ9SDfkZBLrwEAk5adLTZSc8aAbueoUHAgOkKfs5aDtkcPLi+o
QJnLHLYA/RBt8ncYDZicy0+LJwZxuM6zGDKQwhGr4H5e5T6d2cwH
=WKTP
-----END PGP SIGNATURE-----