[php-src] master: Fix GH-13727: macro generating invalid call test prototypes fixes.
| From: | David Carlier | Date: | Mon, 18 Mar 2024 07:14:23 +0000 |
| Subject: | [php-src] master: Fix GH-13727: macro generating invalid call test prototypes fixes. | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-127771@lists.php.net to get a copy of this message | ||
Author: David Carlier (devnexen)
Date: 2024-03-18T06:53:39Z
Commit: https://github.com/php/php-src/commit/868257a3de8236c4aa0508d23ac0a068a4e76139
Raw diff: https://github.com/php/php-src/commit/868257a3de8236c4aa0508d23ac0a068a4e76139.diff
Fix GH-13727: macro generating invalid call test prototypes fixes.
autoconf/libtool generating code to test features missed
void for
C calls prototypes w/o arguments.
Note that specific changes related to libtool have to be upstreamed.
Co-authored-by: Peter Kokot <petk@php.net>
close GH-13732
Changed paths:
M NEWS
M TSRM/threads.m4
M Zend/Zend.m4
M build/libtool.m4
M build/ltmain.sh
M build/php.m4
M configure.ac
M ext/gd/config.m4
M ext/iconv/config.m4
M ext/opcache/config.m4
M ext/standard/config.m4
M sapi/fpm/config.m4
Diff:
diff --git a/NEWS b/NEWS
index 927a536d89519..dd3e7703cd3ed 100644
--- a/NEWS
+++ b/NEWS
@@ -151,6 +151,8 @@ PHP NEWS
loading composer classmaps with more than 11k elements). (nielsdos)
. Fixed bug GH-12966 (missing cross-compiling 3rd argument so Autoconf doesn't
emit warnings). (Peter Kokot)
+ . Fixed bug GH-13727 (missing void keyword for C generate code for feature test).
+ (Peter Kokot/David Carlier)
- Cli:
. Fix incorrect timeout in built-in web server when using router script and
diff --git a/TSRM/threads.m4 b/TSRM/threads.m4
index dc5719bbec056..c42b328dd6651 100644
--- a/TSRM/threads.m4
+++ b/TSRM/threads.m4
@@ -73,7 +73,7 @@ void *thread_routine(void *data) {
return data;
}
-int main() {
+int main(void) {
pthread_t thd;
pthread_mutexattr_t mattr;
int data = 1;
diff --git a/Zend/Zend.m4 b/Zend/Zend.m4
index 06b19c85c712b..e7a6603ddbf07 100644
--- a/Zend/Zend.m4
+++ b/Zend/Zend.m4
@@ -220,7 +220,7 @@ typedef union _mm_align_test {
#define ZEND_MM_ALIGNMENT (sizeof(mm_align_test))
#endif
-int main()
+int main(void)
{
size_t i = ZEND_MM_ALIGNMENT;
int zeros = 0;
diff --git a/build/libtool.m4 b/build/libtool.m4
index 8ee7b453010f1..5b518d50e4ef5 100644
--- a/build/libtool.m4
+++ b/build/libtool.m4
@@ -277,7 +277,7 @@ dnl This sometimes fails to find confdefs.h, for some reason.
dnl [#]line __oline__ "[$]0"
[#]line __oline__ "configure"
#include "confdefs.h"
-int main() {
+int main(void) {
; return 0; }
EOF
if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
@@ -978,8 +978,8 @@ else
# endif
#endif
-void fnord() { int i=42;}
-int main ()
+void fnord(void) { int i=42;}
+int main (void)
{
void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
int status = $lt_dlunknown;
@@ -2750,7 +2750,7 @@ _LT_AC_TAGVAR(objext, $1)=$objext
lt_simple_compile_test_code="int some_variable = 0;"
# Code to be used in simple link tests
-lt_simple_link_test_code='int main(){return(0);}'
+lt_simple_link_test_code='int main(void){return(0);}'
_LT_AC_SYS_COMPILER
@@ -4640,7 +4640,7 @@ void nm_test_func(){}
#ifdef __cplusplus
}
#endif
-int main(){nm_test_var='a';nm_test_func();return(0);}
+int main(void){nm_test_var='a';nm_test_func();return(0);}
EOF
if AC_TRY_EVAL(ac_compile); then
diff --git a/build/ltmain.sh b/build/ltmain.sh
index 2f1c8c9dc80f0..ff1685c8a89f9 100755
--- a/build/ltmain.sh
+++ b/build/ltmain.sh
@@ -3598,7 +3598,7 @@ EOF
# whether they linked in statically or dynamically with ldd.
$rm conftest.c
cat > conftest.c <<EOF
- int main() { return 0; }
+ int main(void) { return 0; }
EOF
$rm conftest
if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
diff --git a/build/php.m4 b/build/php.m4
index 6ebc54b1b466d..2bc0733a978a6 100644
--- a/build/php.m4
+++ b/build/php.m4
@@ -1034,7 +1034,7 @@ AC_DEFUN([_PHP_CHECK_SIZEOF], [
#endif
$3
-int main()
+int main(void)
{
FILE *fp = fopen("conftestval", "w");
if (!fp) return(1);
@@ -1102,7 +1102,7 @@ AC_CACHE_CHECK(for type of reentrant time-related functions,
ac_cv_time_r_type,[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <time.h>
-int main() {
+int main(void) {
char buf[27];
struct tm t;
time_t old = 0;
@@ -1118,7 +1118,7 @@ return (1);
],[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <time.h>
-int main() {
+int main(void) {
struct tm t, *s;
time_t old = 0;
char buf[27], *p;
@@ -1159,7 +1159,7 @@ AC_DEFUN([PHP_DOES_PWRITE_WORK],[
#include <errno.h>
#include <stdlib.h>
$1
- int main() {
+ int main(void) {
int fd = open("conftest_in", O_WRONLY|O_CREAT, 0600);
if (fd < 0) return 1;
@@ -1193,7 +1193,7 @@ AC_DEFUN([PHP_DOES_PREAD_WORK],[
#include <errno.h>
#include <stdlib.h>
$1
- int main() {
+ int main(void) {
char buf[3];
int fd = open("conftest_in", O_RDONLY);
if (fd < 0) return 1;
@@ -1261,27 +1261,27 @@ dnl PHP_MISSING_TIME_R_DECL
dnl
AC_DEFUN([PHP_MISSING_TIME_R_DECL],[
AC_MSG_CHECKING([for missing declarations of reentrant functions])
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm *(*func)() =
localtime_r]])],[
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm *(*func)(void) =
localtime_r]])],[
:
],[
AC_DEFINE(MISSING_LOCALTIME_R_DECL,1,[Whether localtime_r is declared])
])
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm *(*func)() =
gmtime_r]])],[
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm *(*func)(void) =
gmtime_r]])],[
:
],[
AC_DEFINE(MISSING_GMTIME_R_DECL,1,[Whether gmtime_r is declared])
])
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[char *(*func)() =
asctime_r]])],[
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[char *(*func)(void) =
asctime_r]])],[
:
],[
AC_DEFINE(MISSING_ASCTIME_R_DECL,1,[Whether asctime_r is declared])
])
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[char *(*func)() = ctime_r]])],[
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[char *(*func)(void) =
ctime_r]])],[
:
],[
AC_DEFINE(MISSING_CTIME_R_DECL,1,[Whether ctime_r is declared])
])
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string.h>]], [[char *(*func)() =
strtok_r]])],[
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string.h>]], [[char *(*func)(void) =
strtok_r]])],[
:
],[
AC_DEFINE(MISSING_STRTOK_R_DECL,1,[Whether strtok_r is declared])
@@ -1315,7 +1315,7 @@ dnl See if we have broken header files like SunOS has.
dnl
AC_DEFUN([PHP_MISSING_FCLOSE_DECL],[
AC_MSG_CHECKING([for fclose declaration])
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[int (*func)() = fclose]])],[
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[int (*func)(void) =
fclose]])],[
AC_DEFINE(MISSING_FCLOSE_DECL,0,[ ])
AC_MSG_RESULT([ok])
],[
@@ -1405,7 +1405,7 @@ struct s
int i;
char c[1];
};
-int main()
+int main(void)
{
struct s *s = malloc(sizeof(struct s) + 3);
s->i = 3;
@@ -1463,7 +1463,7 @@ int seeker(void *cookie, off64_t *position, int whence)
cookie_io_functions_t funcs = {reader, writer, seeker, closer};
-int main() {
+int main(void) {
struct cookiedata g = { 0 };
FILE *fp = fopencookie(&g, "r", funcs);
@@ -1590,7 +1590,7 @@ AC_DEFUN([PHP_CHECK_FUNC_LIB],[
if test "$found" = "yes"; then
ac_libs=$LIBS
LIBS="$LIBS -l$2"
- AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { return (0); }]])],[found=yes],[found=no],[
+ AC_RUN_IFELSE([AC_LANG_PROGRAM()],[found=yes],[found=no],[
dnl Cross compilation.
found=yes
])
@@ -1643,8 +1643,8 @@ AC_DEFUN([PHP_TEST_BUILD], [
LIBS="$4 $LIBS"
AC_LINK_IFELSE([AC_LANG_SOURCE([[
$5
- char $1();
- int main() {
+ char $1(void);
+ int main(void) {
$1();
return 0;
}
@@ -2296,7 +2296,7 @@ AC_DEFUN([PHP_TEST_WRITE_STDOUT],[
#define TEXT "This is the test message -- "
-int main()
+int main(void)
{
int n;
diff --git a/configure.ac b/configure.ac
index 701e6d5b966a2..de0eac8498ec8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1120,7 +1120,7 @@ case $host_alias in
save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-zcommon-page-size=2097152 -Wl,-zmax-page-size=2097152"
AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[int main() {return 0;}]])],
+ [AC_LANG_PROGRAM()],
[ac_cv_common_page_size=yes],
[ac_cv_common_page_size=no],
[ac_cv_common_page_size=no])
@@ -1134,7 +1134,7 @@ case $host_alias in
save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-zmax-page-size=2097152"
AC_RUN_IFELSE(
- [AC_LANG_SOURCE([[int main() {return 0;}]])],
+ [AC_LANG_PROGRAM()],
[ac_cv_max_page_size=yes],
[ac_cv_max_page_size=no],
[ac_cv_max_page_size=no])
diff --git a/ext/gd/config.m4 b/ext/gd/config.m4
index 9bdd6bb11c04d..a8b1c76d2d131 100644
--- a/ext/gd/config.m4
+++ b/ext/gd/config.m4
@@ -239,7 +239,7 @@ dnl Various checks for GD features
PHP_TEST_BUILD(foobar, [], [
AC_MSG_ERROR([GD build test failed. Please check the config.log for details.])
- ], [ $GD_SHARED_LIBADD ], [char foobar () {}])
+ ], [ $GD_SHARED_LIBADD ], [char foobar (void) {}])
else
extra_sources="gd_compat.c"
diff --git a/ext/iconv/config.m4 b/ext/iconv/config.m4
index ac57c81e7d472..5d408de8331d9 100644
--- a/ext/iconv/config.m4
+++ b/ext/iconv/config.m4
@@ -30,7 +30,7 @@ if test "$PHP_ICONV" != "no"; then
AC_MSG_CHECKING([if using GNU libiconv])
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <iconv.h>
-int main() {
+int main(void) {
printf("%d", _libiconv_version);
return 0;
}
@@ -90,7 +90,7 @@ int main() {
#include <iconv.h>
#include <errno.h>
-int main() {
+int main(void) {
iconv_t cd;
cd = iconv_open( "*blahblah*", "*blahblahblah*" );
if (cd == (iconv_t)(-1)) {
@@ -117,7 +117,7 @@ int main() {
#include <iconv.h>
#include <stdlib.h>
-int main() {
+int main(void) {
iconv_t cd = iconv_open( "UTF-8//IGNORE", "UTF-8" );
if(cd == (iconv_t)-1) {
return 1;
diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
index d35efbc689ed9..6bf07ad35e2e0 100644
--- a/ext/opcache/config.m4
+++ b/ext/opcache/config.m4
@@ -121,7 +121,7 @@ if test "$PHP_OPCACHE" != "no"; then
#include <unistd.h>
#include <string.h>
-int main() {
+int main(void) {
pid_t pid;
int status;
int ipc_id;
@@ -200,7 +200,7 @@ int main() {
# define MAP_FAILED ((void*)-1)
#endif
-int main() {
+int main(void) {
pid_t pid;
int status;
char *shm;
@@ -262,7 +262,7 @@ int main() {
# define MAP_FAILED ((void*)-1)
#endif
-int main() {
+int main(void) {
pid_t pid;
int status;
int fd;
diff --git a/ext/standard/config.m4 b/ext/standard/config.m4
index 8e77e75134c9e..1f25edb9ee058 100644
--- a/ext/standard/config.m4
+++ b/ext/standard/config.m4
@@ -81,7 +81,7 @@ if test "$PHP_EXTERNAL_LIBCRYPT" != "no"; then
#include <stdlib.h>
#include <string.h>
-int main() {
+int main(void) {
#if HAVE_CRYPT
char *encrypted = crypt("rasmuslerdorf","rl");
return !encrypted || strcmp(encrypted,"rl.3StKT.4T8M");
@@ -111,7 +111,7 @@ int main() {
#include <stdlib.h>
#include <string.h>
-int main() {
+int main(void) {
#if HAVE_CRYPT
char *encrypted = crypt("rasmuslerdorf","_J9..rasm");
return !encrypted || strcmp(encrypted,"_J9..rasmBYk8r9AiWNc");
@@ -141,7 +141,7 @@ int main() {
#include <stdlib.h>
#include <string.h>
-int main() {
+int main(void) {
#if HAVE_CRYPT
char salt[15], answer[40];
char *encrypted;
@@ -181,7 +181,7 @@ int main() {
#include <stdlib.h>
#include <string.h>
-int main() {
+int main(void) {
#if HAVE_CRYPT
char salt[30], answer[70];
char *encrypted;
@@ -218,7 +218,7 @@ int main() {
#include <stdlib.h>
#include <string.h>
-int main() {
+int main(void) {
#if HAVE_CRYPT
char salt[21], answer[21+86];
char *encrypted;
@@ -254,7 +254,7 @@ int main() {
#include <stdlib.h>
#include <string.h>
-int main() {
+int main(void) {
#if HAVE_CRYPT
char salt[21], answer[21+43];
char *encrypted;
diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4
index aa2a85d2ca632..e3d52084c8204 100644
--- a/sapi/fpm/config.m4
+++ b/sapi/fpm/config.m4
@@ -90,7 +90,7 @@ AC_DEFUN([AC_FPM_CLOCK],
#include <mach/clock.h>
#include <mach/mach_error.h>
- int main()
+ int main(void)
{
kern_return_t ret; clock_serv_t aClock; mach_timespec_t aTime;
ret = host_get_clock_service(mach_host_self(), REALTIME_CLOCK, &aClock);
@@ -158,7 +158,7 @@ AC_DEFUN([AC_FPM_TRACE],
#define PTRACE_PEEKDATA PT_READ_D
#endif
- int main()
+ int main(void)
{
long v1 = (unsigned int) -1; /* copy will fail if sizeof(long) == 8 and we've got
"int ptrace()" */
long v2;
@@ -263,7 +263,7 @@ AC_DEFUN([AC_FPM_TRACE],
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
- int main()
+ int main(void)
{
long v1 = (unsigned int) -1, v2 = 0;
char buf[128];
@@ -604,7 +604,7 @@ if test "$PHP_FPM" != "no"; then
AC_CHECK_HEADERS([sys/acl.h])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/acl.h>
- int main()
+ int main(void)
{
acl_t acl;
acl_entry_t user, group;
@@ -623,7 +623,7 @@ if test "$PHP_FPM" != "no"; then
AC_MSG_RESULT([yes])
],[
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/acl.h>
- int main()
+ int main(void)
{
acl_t acl;
acl_entry_t user, group;