[php-src] master: adding const attribute to trailing/leading zeros helpers. (#13861)
| From: | David CARLIER via GitHub | Date: | Tue, 02 Apr 2024 11:10:23 +0000 |
| Subject: | [php-src] master: adding const attribute to trailing/leading zeros helpers. (#13861) | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-127931@lists.php.net to get a copy of this message | ||
Author: David CARLIER (devnexen)
Committer: GitHub (web-flow)
Pusher: devnexen
Date: 2024-04-02T12:10:18+01:00
Commit: https://github.com/php/php-src/commit/dad2d561e83fcdb7b7b204dc981b52f557228dab
Raw diff: https://github.com/php/php-src/commit/dad2d561e83fcdb7b7b204dc981b52f557228dab.diff
adding const attribute to trailing/leading zeros helpers. (#13861)
and adding noreturn to php_sighup_handler for compiler/dev clarification sake.
Changed paths:
M Zend/zend_bitset.h
M sapi/phpdbg/phpdbg.c
Diff:
diff --git a/Zend/zend_bitset.h b/Zend/zend_bitset.h
index 262fab24a5eb..a42b35712f4e 100644
--- a/Zend/zend_bitset.h
+++ b/Zend/zend_bitset.h
@@ -45,7 +45,7 @@ typedef zend_ulong *zend_bitset;
(zend_bitset)do_alloca((n) * ZEND_BITSET_ELM_SIZE, use_heap)
/* Number of trailing zero bits (0x01 -> 0; 0x40 -> 6; 0x00 -> LEN) */
-static zend_always_inline int zend_ulong_ntz(zend_ulong num)
+ZEND_ATTRIBUTE_CONST static zend_always_inline int zend_ulong_ntz(zend_ulong num)
{
#if (defined(__GNUC__) || __has_builtin(__builtin_ctzl)) \
&& SIZEOF_ZEND_LONG == SIZEOF_LONG && defined(PHP_HAVE_BUILTIN_CTZL)
@@ -83,7 +83,7 @@ static zend_always_inline int zend_ulong_ntz(zend_ulong num)
}
/* Number of leading zero bits (Undefined for zero) */
-static zend_always_inline int zend_ulong_nlz(zend_ulong num)
+ZEND_ATTRIBUTE_CONST static zend_always_inline int zend_ulong_nlz(zend_ulong num)
{
#if (defined(__GNUC__) || __has_builtin(__builtin_clzl)) \
&& SIZEOF_ZEND_LONG == SIZEOF_LONG && defined(PHP_HAVE_BUILTIN_CLZL)
diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
index 37e7ca07e93d..ffff7e2c219b 100644
--- a/sapi/phpdbg/phpdbg.c
+++ b/sapi/phpdbg/phpdbg.c
@@ -1066,7 +1066,7 @@ void phpdbg_signal_handler(int sig, siginfo_t *info, void *context) /* {{{ */
} /* }}} */
-void phpdbg_sighup_handler(int sig) /* {{{ */
+ZEND_NORETURN void phpdbg_sighup_handler(int sig) /* {{{ */
{
exit(0);
} /* }}} */