Skip to content

Commit 34a4e7f

Browse files
committed
zend_portability: Simplify definition of ZEND_NORETURN
1 parent c5e45a1 commit 34a4e7f

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

‎UPGRADING.INTERNALS‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ PHP 8.7 INTERNALS UPGRADE NOTES
1717
- Removed zend_execute_scripts(). Manually call zend_execute_script() in a loop
1818
instead.
1919
- Removed ZEND_STATIC_ASSERT(). Use C11 static_assert() directly instead.
20+
- Removed HAVE_NORETURN and HAVE_NORETURN_ALIAS. ZEND_NORETURN is guaranteed to
21+
work.
2022

2123
========================
2224
2. Build system changes

‎Zend/zend_portability.h‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -356,14 +356,10 @@ char *alloca();
356356
# endif
357357
#endif
358358

359-
#if (defined(__GNUC__) && __GNUC__ >= 3 && !defined(__INTEL_COMPILER) && !defined(__APPLE__) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__)) || __has_attribute(noreturn)
360-
# define HAVE_NORETURN
361-
# define ZEND_NORETURN __attribute__((noreturn))
362-
#elif defined(ZEND_WIN32)
363-
# define HAVE_NORETURN
364-
# define ZEND_NORETURN __declspec(noreturn)
359+
#if __STDC_VERSION__ >= 202311L || defined(__cplusplus)
360+
# define ZEND_NORETURN [[noreturn]]
365361
#else
366-
# define ZEND_NORETURN
362+
# define ZEND_NORETURN _Noreturn
367363
#endif
368364

369365
#if __has_attribute(force_align_arg_pointer)
@@ -373,7 +369,6 @@ char *alloca();
373369
#endif
374370

375371
#if (defined(__GNUC__) && __GNUC__ >= 3 && !defined(__INTEL_COMPILER) && !defined(__APPLE__) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__))
376-
# define HAVE_NORETURN_ALIAS
377372
# define HAVE_ATTRIBUTE_WEAK
378373
#endif
379374

0 commit comments

Comments
 (0)