mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02: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:
parent
186a07f044
commit
37ce7199f2
1 changed files with 11 additions and 2 deletions
|
@ -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; */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue