[php-src] Issue #12273: __builtin_cpu_init configure check relies on void return value
| From: | Freaky | Date: | Fri, 22 Sep 2023 15:49:07 +0000 |
| Subject: | [php-src] Issue #12273: __builtin_cpu_init configure check relies on void return value | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245420@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12273
Author: Freaky
### Description
Testing [enabling ifunc support on
FreeBSD](https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=274011), alongside having to remove the
hardcoded check that disables it I also run into:
```
checking for __builtin_cpu_init... no
```
https://github.com/php/php-src/blob/f6fae19a109a40026239e61e26c0403e7c340efb/build/php.m4#L2735
```m4
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
return __builtin_cpu_init()? 1 : 0;
]])], [
```
While this does technically appear to return
int on gcc, it's documented as
void __builtin_cpu_init (void), and indeed returns such on clang. Changing this to:
```m4
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
__builtin_cpu_init(); return 1;
]])], [
```
Results in a successful check and much faster addslashes, base64_encode, etc.
### PHP Version
PHP 8.1.23
### Operating System
FreeBSD 13.2-RELEASE