[php-src] Issue #10751: Build system updates for modern C

From: Date: Thu, 02 Mar 2023 13:54:43 +0000
Subject: [php-src] Issue #10751: Build system updates for modern C
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-243834@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/10751 Author: orlitzky ### Description Ref: https://wiki.gentoo.org/wiki/Modern_C_porting clang-16 (imminent) and probably gcc-14 (next yearish) are going to turn some warnings into errors: * -Werror=implicit-function-declaration * -Werror=implicit-int * -Werror=int-conversion (this is in Clang 15, actually) * -Werror=incompatible-function-pointer-types (GCC does not have a specific equivalent error, use -Werror=incompatible-pointer-types instead when testing) Issues in the PHP source itself will probably be caught by developers, but issues buried in the build system are more subtle. For example, in ext/iconv/config.m4, ```m4 if test -z "$iconv_impl_name"; then AC_MSG_CHECKING([if using GNU libiconv]) AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <iconv.h> int main() { printf("%d", _libiconv_version); return 0; } ]])],[ AC_MSG_RESULT(yes) iconv_impl_name="gnu_libiconv" ],[ AC_MSG_RESULT(no) ],[ AC_MSG_RESULT([no, cross-compiling]) ]) fi ``` That feature test is missing #include <stdio.h>, so printf() is undefined when it is used. Thus the feature test can fail with clang-16 when it should pass. The other issue is visible above is, ```C int main() { ... } ``` That needs the correct signature, ```C int main(int argc, char** argv) { ... } ``` The same fix is needed in a few other m4 files, but is relatively easy to grep for. ### PHP Version 8.2.3 ### Operating System _No response_

« previous php.bugs (#243834) next »