[php-src] Issue #15266: With GCC 14.2, trying to include /usr/include/php/main/php.h fails

From: Date: Wed, 07 Aug 2024 00:39:19 +0000
Subject: [php-src] Issue #15266: With GCC 14.2, trying to include /usr/include/php/main/php.h fails
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247450@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/15266 Author: jpbion ### Description The following code, called 'j.c': ---------- #include <stdio.h> #include <php/main/php.h> int main (int argc, char **argv) { fprintf(stdout, "Hi!\n"); exit(0); } ------------------------- Compiled with PHP 8.3.10 and GCC 14.2.0, using the following command: cc -o j -I /usr/include/php/Zend -I /usr/include/php -I /usr/include/php/main -I /usr/include/php/TSRM j.c ------------------------------ Resulted in this output: In file included from /usr/include/php/Zend/zend.h:418, from /usr/include/php/main/php.h:31, from j.c:2: /usr/include/php/Zend/zend_operators.h: In function 'zend_memrchr': /usr/include/php/Zend/zend_operators.h:208:29: error: implicit declaration of function 'memrchr'; did you mean 'memchr'? [-Wimplicit-function-declaration] 208 | return (const void*)memrchr(s, c, n); | ^~~~~~~ | memchr ---------------------- Thoughts: The definitions in zend_operators.h worked with previous versions of gcc, but aren't happy with GCC 14.2, particularly with the reference to 'memrchr' which is not given an explicit declaration. Now, my code may look quite random and arbitrary. But - it isn't. This code shows what happens when a C programmer happens to want to include "php.h" as a header file in their code - nothing more or less. I discovered this when attempting to have graphviz 12.0.0 build, and generate a PHP extension. Its check to see if php.h exists is pretty standard, and while this wasn't a problem pre-GCC 14.2, it is now. I fear I won't be the only one running into this. ### PHP Version PHP 8.3.10 ### Operating System Linux kernel 6.10.3 (LFS build)

« previous php.bugs (#247450) next »