1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Use __attribute__((assume())) in ZEND_ASSUME when available

Closes GH-13171
This commit is contained in:
Ilija Tovilo
2024-01-16 22:41:21 +01:00
parent 98e2948ca7
commit bf4ec8bd9d
2 changed files with 7 additions and 2 deletions

View File

@@ -89,6 +89,9 @@
#if defined(ZEND_WIN32) && !defined(__clang__)
# define ZEND_ASSUME(c) __assume(c)
#elif defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 13
/* GCC emits a warning when __attribute__ appears directly after a label, so we need a do-while loop. */
# define ZEND_ASSUME(c) do { __attribute__((assume(c))); } while (0)
#elif defined(__clang__) && __has_builtin(__builtin_assume)
# pragma clang diagnostic ignored "-Wassume"
# define ZEND_ASSUME(c) __builtin_assume(c)

View File

@@ -333,8 +333,10 @@ void *phpdbg_watchpoint_userfaultfd_thread(void *phpdbg_globals) {
/* ### REGISTER WATCHPOINT ### To be used only by watch element and collision managers ### */
static inline void phpdbg_store_watchpoint_btree(phpdbg_watchpoint_t *watch) {
phpdbg_btree_result *res;
ZEND_ASSERT((res = phpdbg_btree_find(&PHPDBG_G(watchpoint_tree), (zend_ulong) watch->addr.ptr)) == NULL || res->ptr == watch);
#if ZEND_DEBUG
phpdbg_btree_result *res = phpdbg_btree_find(&PHPDBG_G(watchpoint_tree), (zend_ulong) watch->addr.ptr);
ZEND_ASSERT(res == NULL || res->ptr == watch);
#endif
phpdbg_btree_insert(&PHPDBG_G(watchpoint_tree), (zend_ulong) watch->addr.ptr, watch);
}