mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Use __builtin_unreachable() directly in ZEND_UNREACHABLE
ZEND_UNREACHABLE() currently expands to the following in GCC:
if (__builtin_expect(!(0), 0)) __builtin_unreachable();
Even though the branch is always executed, GCC does not recognize the outer
branch as unreachable. Removing the if fixes some unexpected warnings.
Closes GH-12248
This commit is contained in:
@@ -106,10 +106,19 @@
|
|||||||
# define ZEND_ASSERT(c) ZEND_ASSUME(c)
|
# define ZEND_ASSERT(c) ZEND_ASSUME(c)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __has_builtin
|
||||||
|
# if __has_builtin(__builtin_unreachable)
|
||||||
|
# define _ZEND_UNREACHABLE() __builtin_unreachable()
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#ifndef _ZEND_UNREACHABLE
|
||||||
|
# define _ZEND_UNREACHABLE() ZEND_ASSUME(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ZEND_DEBUG
|
#if ZEND_DEBUG
|
||||||
# define ZEND_UNREACHABLE() do {ZEND_ASSERT(0); ZEND_ASSUME(0);} while (0)
|
# define ZEND_UNREACHABLE() do {ZEND_ASSERT(0); _ZEND_UNREACHABLE();} while (0)
|
||||||
#else
|
#else
|
||||||
# define ZEND_UNREACHABLE() ZEND_ASSUME(0)
|
# define ZEND_UNREACHABLE() _ZEND_UNREACHABLE()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* pseudo fallthrough keyword; */
|
/* pseudo fallthrough keyword; */
|
||||||
|
|||||||
Reference in New Issue
Block a user