From 7e878ea9330a0d8bf15834f0d3a056536568efbe Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Mon, 16 Dec 2024 16:54:45 +0100 Subject: [PATCH] Fix GH-17107: Building ext/intl fails with GCC 8.5.0 A previous fix to be able to build C++ extensions with MSVC[1], was based on two assumptions: * `max_align_t` would be defined in stddef.h on Windows * additionally including cstddef as extern C++ would not interfere with the already included stddef.h The former was plain wrong; there is no such typedef (or macro); the latter was presumptuous, as can be seen in the bug tracker ticket. Thus we revert that fix, and instead make an exception for Windows, where we always use the fallback definition, which should work fine on Windows. [1] --- Zend/zend_portability.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h index 0acec2bf3baf..8cc2967e6062 100644 --- a/Zend/zend_portability.h +++ b/Zend/zend_portability.h @@ -791,13 +791,9 @@ extern "C++" { # define ZEND_STATIC_ASSERT(c, m) #endif -#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) /* C11 */ +#if ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) /* C11 */ \ + || (defined(__cplusplus) && __cplusplus >= 201103L) /* C++11 */) && !defined(ZEND_WIN32) typedef max_align_t zend_max_align_t; -#elif (defined(__cplusplus) && __cplusplus >= 201103L) /* C++11 */ -extern "C++" { -# include -} -typedef std::max_align_t zend_max_align_t; #else typedef union { char c;