Closed
Description
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
,
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,
int main() { ... }
That needs the correct signature,
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