Re: Require C11 in PHP 8.4

From: Date: Tue, 06 Aug 2024 11:04:31 +0000
Subject: Re: Require C11 in PHP 8.4
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On 05.08.2024 at 18:42, Levi Morrison wrote:

> As a person who wrote some of those atomics, I would definitely prefer
> to move to standard C11/C17 atomics at some point in the future and
> remove all other fallbacks. The blocker right now is Microsoft Visual
> Studio. Although they added C11/C17 support a few versions back, they
> did not add atomics at that time. It's available now, but it is still
> experimental as far as I can tell.

There is a MS blog post from December, 2022[1] which claims that it is
experimental, and that you would need to specify the
/experimental:c11atomics flag in addition to /std:c11 to enable atomics
support.  I though, hey, why not try that out, added only /std:c11 and
got a failing minimal build, because apparently max_align_t is not
defined in stddef.h even with the latest available SDK (10.0.26100.0)
offered by Visual Studio 2022 for my Windows 10 machine.  It might be
available with SDK 10.0.22621.2428, which according to the
documentation[2] has been "Relesed in October 2024"[sic].  I wonder
whether I would trust more detailed information there.

(FWIW, the official Windows builds use 10.0.22621.0, and we probably
should enforce some common version; I think for now we use just what can
be found in the build environment.)

Anyway, I worked around the missing max_align_t definition, and the
build succeeded, even though I've added

#ifndef __STDC_NO_ATOMICS__
# error cmb
#endif

in zend_API.c.  Thus, I conclude that atomics support in latest Visual
Studio 17.10.5 is no longer deemed experimental, and locking atomics are
implemented now.  I think it is worth investigating whether that support
actually works for our purposes, but probably not use that for PHP 8.4.

[1]
<https://devblogs.microsoft.com/cppblog/c11-atomics-in-visual-studio-2022-version-17-5-preview-2/>
[2] <https://developer.microsoft.com/en-us/windows/downloads/sdk-archive/>

Christoph


Thread (33 messages)

« previous php.internals (#124801) next »