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
This commit is contained in:
David Carlier 2024-03-16 17:00:15 +00:00
parent aa34e0acb4
commit 868257a3de
12 changed files with 47 additions and 45 deletions

2
NEWS
View File

@ -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

View File

@ -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;

View File

@ -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;

10
build/libtool.m4 vendored
View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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])

View File

@ -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"

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;