mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
*/*.m4: update main() signatures.
The next generation of C compilers is going to enforce the C standard more strictly: https://wiki.gentoo.org/wiki/Modern_C_porting One warning that will soon become an error is -Wstrict-prototypes. This is relatively easy to catch in most code (it will fail to compile), but inside of autoconf tests it can go unnoticed because many feature-test compilations fail by design. For example, $ export CFLAGS="$CFLAGS -Werror=strict-prototypes" $ ./configure ... checking if iconv supports errno... no configure: error: iconv does not support errno (this is on a system where iconv *does* support errno). If errno support were optional, that test would have "silently" disabled it. The underlying issue here, from config.log, is conftest.c:211:5: error: function declaration isn't a prototype [-Werror=strict-prototypes] 211 | int main() { This commit goes through all of our autoconf tests, replacing main() with main(void). Up to equivalent types and variable renamings, that's one of the two valid signatures, and satisfies the compiler (gcc-12 in this case). Fixes GH-10751
This commit is contained in:
parent
3f7dadfeca
commit
fa65873502
7 changed files with 32 additions and 32 deletions
|
@ -73,7 +73,7 @@ void *thread_routine(void *data) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main(void) {
|
||||||
pthread_t thd;
|
pthread_t thd;
|
||||||
pthread_mutexattr_t mattr;
|
pthread_mutexattr_t mattr;
|
||||||
int data = 1;
|
int data = 1;
|
||||||
|
|
|
@ -162,7 +162,7 @@ int stack_grows_downwards(uintptr_t arg) {
|
||||||
return (uintptr_t)&local < arg;
|
return (uintptr_t)&local < arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main(void) {
|
||||||
int local;
|
int local;
|
||||||
|
|
||||||
f = stack_grows_downwards;
|
f = stack_grows_downwards;
|
||||||
|
@ -250,7 +250,7 @@ typedef union _mm_align_test {
|
||||||
#define ZEND_MM_ALIGNMENT (sizeof(mm_align_test))
|
#define ZEND_MM_ALIGNMENT (sizeof(mm_align_test))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
size_t i = ZEND_MM_ALIGNMENT;
|
size_t i = ZEND_MM_ALIGNMENT;
|
||||||
int zeros = 0;
|
int zeros = 0;
|
||||||
|
|
24
build/php.m4
24
build/php.m4
|
@ -1034,7 +1034,7 @@ AC_DEFUN([_PHP_CHECK_SIZEOF], [
|
||||||
#endif
|
#endif
|
||||||
$3
|
$3
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
FILE *fp = fopen("conftestval", "w");
|
FILE *fp = fopen("conftestval", "w");
|
||||||
if (!fp) return(1);
|
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([[
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
int main() {
|
int main(void) {
|
||||||
char buf[27];
|
char buf[27];
|
||||||
struct tm t;
|
struct tm t;
|
||||||
time_t old = 0;
|
time_t old = 0;
|
||||||
|
@ -1118,7 +1118,7 @@ return (1);
|
||||||
],[
|
],[
|
||||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
int main() {
|
int main(void) {
|
||||||
struct tm t, *s;
|
struct tm t, *s;
|
||||||
time_t old = 0;
|
time_t old = 0;
|
||||||
char buf[27], *p;
|
char buf[27], *p;
|
||||||
|
@ -1159,7 +1159,7 @@ AC_DEFUN([PHP_DOES_PWRITE_WORK],[
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
$1
|
$1
|
||||||
int main() {
|
int main(void) {
|
||||||
int fd = open("conftest_in", O_WRONLY|O_CREAT, 0600);
|
int fd = open("conftest_in", O_WRONLY|O_CREAT, 0600);
|
||||||
|
|
||||||
if (fd < 0) return 1;
|
if (fd < 0) return 1;
|
||||||
|
@ -1193,7 +1193,7 @@ AC_DEFUN([PHP_DOES_PREAD_WORK],[
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
$1
|
$1
|
||||||
int main() {
|
int main(void) {
|
||||||
char buf[3];
|
char buf[3];
|
||||||
int fd = open("conftest_in", O_RDONLY);
|
int fd = open("conftest_in", O_RDONLY);
|
||||||
if (fd < 0) return 1;
|
if (fd < 0) return 1;
|
||||||
|
@ -1405,7 +1405,7 @@ struct s
|
||||||
int i;
|
int i;
|
||||||
char c[1];
|
char c[1];
|
||||||
};
|
};
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
struct s *s = malloc(sizeof(struct s) + 3);
|
struct s *s = malloc(sizeof(struct s) + 3);
|
||||||
s->i = 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};
|
cookie_io_functions_t funcs = {reader, writer, seeker, closer};
|
||||||
|
|
||||||
int main() {
|
int main(void) {
|
||||||
struct cookiedata g = { 0 };
|
struct cookiedata g = { 0 };
|
||||||
FILE *fp = fopencookie(&g, "r", funcs);
|
FILE *fp = fopencookie(&g, "r", funcs);
|
||||||
|
|
||||||
|
@ -1590,7 +1590,7 @@ AC_DEFUN([PHP_CHECK_FUNC_LIB],[
|
||||||
if test "$found" = "yes"; then
|
if test "$found" = "yes"; then
|
||||||
ac_libs=$LIBS
|
ac_libs=$LIBS
|
||||||
LIBS="$LIBS -l$2"
|
LIBS="$LIBS -l$2"
|
||||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { return (0); }]])],[found=yes],[found=no],[
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[int main(void) { return (0); }]])],[found=yes],[found=no],[
|
||||||
dnl Cross compilation.
|
dnl Cross compilation.
|
||||||
found=yes
|
found=yes
|
||||||
])
|
])
|
||||||
|
@ -1644,7 +1644,7 @@ AC_DEFUN([PHP_TEST_BUILD], [
|
||||||
AC_LINK_IFELSE([AC_LANG_SOURCE([[
|
AC_LINK_IFELSE([AC_LANG_SOURCE([[
|
||||||
$5
|
$5
|
||||||
char $1();
|
char $1();
|
||||||
int main() {
|
int main(void) {
|
||||||
$1();
|
$1();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2296,7 +2296,7 @@ AC_DEFUN([PHP_TEST_WRITE_STDOUT],[
|
||||||
|
|
||||||
#define TEXT "This is the test message -- "
|
#define TEXT "This is the test message -- "
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
|
@ -2818,7 +2818,7 @@ AC_DEFUN([PHP_CHECK_AVX512_SUPPORTS], [
|
||||||
|
|
||||||
AC_LINK_IFELSE([AC_LANG_SOURCE([[
|
AC_LINK_IFELSE([AC_LANG_SOURCE([[
|
||||||
#include <immintrin.h>
|
#include <immintrin.h>
|
||||||
int main() {
|
int main(void) {
|
||||||
__m512i mask = _mm512_set1_epi32(0x1);
|
__m512i mask = _mm512_set1_epi32(0x1);
|
||||||
char out[32];
|
char out[32];
|
||||||
_mm512_storeu_si512(out, _mm512_shuffle_epi8(mask, mask));
|
_mm512_storeu_si512(out, _mm512_shuffle_epi8(mask, mask));
|
||||||
|
@ -2846,7 +2846,7 @@ AC_DEFUN([PHP_CHECK_AVX512_VBMI_SUPPORTS], [
|
||||||
CFLAGS="-mavx512f -mavx512cd -mavx512vl -mavx512dq -mavx512bw -mavx512vbmi $CFLAGS"
|
CFLAGS="-mavx512f -mavx512cd -mavx512vl -mavx512dq -mavx512bw -mavx512vbmi $CFLAGS"
|
||||||
AC_LINK_IFELSE([AC_LANG_SOURCE([[
|
AC_LINK_IFELSE([AC_LANG_SOURCE([[
|
||||||
#include <immintrin.h>
|
#include <immintrin.h>
|
||||||
int main() {
|
int main(void) {
|
||||||
__m512i mask = _mm512_set1_epi32(0x1);
|
__m512i mask = _mm512_set1_epi32(0x1);
|
||||||
char out[32];
|
char out[32];
|
||||||
_mm512_storeu_si512(out, _mm512_permutexvar_epi8(mask, mask));
|
_mm512_storeu_si512(out, _mm512_permutexvar_epi8(mask, mask));
|
||||||
|
|
|
@ -30,7 +30,7 @@ if test "$PHP_ICONV" != "no"; then
|
||||||
AC_MSG_CHECKING([if using GNU libiconv])
|
AC_MSG_CHECKING([if using GNU libiconv])
|
||||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
int main() {
|
int main(void) {
|
||||||
printf("%d", _libiconv_version);
|
printf("%d", _libiconv_version);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ int main() {
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
int main() {
|
int main(void) {
|
||||||
iconv_t cd;
|
iconv_t cd;
|
||||||
cd = iconv_open( "*blahblah*", "*blahblahblah*" );
|
cd = iconv_open( "*blahblah*", "*blahblahblah*" );
|
||||||
if (cd == (iconv_t)(-1)) {
|
if (cd == (iconv_t)(-1)) {
|
||||||
|
@ -117,7 +117,7 @@ int main() {
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
int main() {
|
int main(void) {
|
||||||
iconv_t cd = iconv_open( "UTF-8//IGNORE", "UTF-8" );
|
iconv_t cd = iconv_open( "UTF-8//IGNORE", "UTF-8" );
|
||||||
if(cd == (iconv_t)-1) {
|
if(cd == (iconv_t)-1) {
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -116,7 +116,7 @@ if test "$PHP_OPCACHE" != "no"; then
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
int main() {
|
int main(void) {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int status;
|
int status;
|
||||||
int ipc_id;
|
int ipc_id;
|
||||||
|
@ -195,7 +195,7 @@ int main() {
|
||||||
# define MAP_FAILED ((void*)-1)
|
# define MAP_FAILED ((void*)-1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main() {
|
int main(void) {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int status;
|
int status;
|
||||||
char *shm;
|
char *shm;
|
||||||
|
@ -257,7 +257,7 @@ int main() {
|
||||||
# define MAP_FAILED ((void*)-1)
|
# define MAP_FAILED ((void*)-1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main() {
|
int main(void) {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int status;
|
int status;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
|
@ -81,7 +81,7 @@ if test "$PHP_EXTERNAL_LIBCRYPT" != "no"; then
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
int main() {
|
int main(void) {
|
||||||
#if HAVE_CRYPT
|
#if HAVE_CRYPT
|
||||||
char *encrypted = crypt("rasmuslerdorf","rl");
|
char *encrypted = crypt("rasmuslerdorf","rl");
|
||||||
return !encrypted || strcmp(encrypted,"rl.3StKT.4T8M");
|
return !encrypted || strcmp(encrypted,"rl.3StKT.4T8M");
|
||||||
|
@ -111,7 +111,7 @@ int main() {
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
int main() {
|
int main(void) {
|
||||||
#if HAVE_CRYPT
|
#if HAVE_CRYPT
|
||||||
char *encrypted = crypt("rasmuslerdorf","_J9..rasm");
|
char *encrypted = crypt("rasmuslerdorf","_J9..rasm");
|
||||||
return !encrypted || strcmp(encrypted,"_J9..rasmBYk8r9AiWNc");
|
return !encrypted || strcmp(encrypted,"_J9..rasmBYk8r9AiWNc");
|
||||||
|
@ -141,7 +141,7 @@ int main() {
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
int main() {
|
int main(void) {
|
||||||
#if HAVE_CRYPT
|
#if HAVE_CRYPT
|
||||||
char salt[15], answer[40];
|
char salt[15], answer[40];
|
||||||
char *encrypted;
|
char *encrypted;
|
||||||
|
@ -181,7 +181,7 @@ int main() {
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
int main() {
|
int main(void) {
|
||||||
#if HAVE_CRYPT
|
#if HAVE_CRYPT
|
||||||
char salt[30], answer[70];
|
char salt[30], answer[70];
|
||||||
char *encrypted;
|
char *encrypted;
|
||||||
|
@ -218,7 +218,7 @@ int main() {
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
int main() {
|
int main(void) {
|
||||||
#if HAVE_CRYPT
|
#if HAVE_CRYPT
|
||||||
char salt[21], answer[21+86];
|
char salt[21], answer[21+86];
|
||||||
char *encrypted;
|
char *encrypted;
|
||||||
|
@ -254,7 +254,7 @@ int main() {
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
int main() {
|
int main(void) {
|
||||||
#if HAVE_CRYPT
|
#if HAVE_CRYPT
|
||||||
char salt[21], answer[21+43];
|
char salt[21], answer[21+43];
|
||||||
char *encrypted;
|
char *encrypted;
|
||||||
|
|
|
@ -66,7 +66,7 @@ AC_DEFUN([AC_FPM_CLOCK],
|
||||||
#include <mach/clock.h>
|
#include <mach/clock.h>
|
||||||
#include <mach/mach_error.h>
|
#include <mach/mach_error.h>
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
kern_return_t ret; clock_serv_t aClock; mach_timespec_t aTime;
|
kern_return_t ret; clock_serv_t aClock; mach_timespec_t aTime;
|
||||||
ret = host_get_clock_service(mach_host_self(), REALTIME_CLOCK, &aClock);
|
ret = host_get_clock_service(mach_host_self(), REALTIME_CLOCK, &aClock);
|
||||||
|
@ -134,7 +134,7 @@ AC_DEFUN([AC_FPM_TRACE],
|
||||||
#define PTRACE_PEEKDATA PT_READ_D
|
#define PTRACE_PEEKDATA PT_READ_D
|
||||||
#endif
|
#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 v1 = (unsigned int) -1; /* copy will fail if sizeof(long) == 8 and we've got "int ptrace()" */
|
||||||
long v2;
|
long v2;
|
||||||
|
@ -239,7 +239,7 @@ AC_DEFUN([AC_FPM_TRACE],
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
long v1 = (unsigned int) -1, v2 = 0;
|
long v1 = (unsigned int) -1, v2 = 0;
|
||||||
char buf[128];
|
char buf[128];
|
||||||
|
@ -578,7 +578,7 @@ if test "$PHP_FPM" != "no"; then
|
||||||
AC_CHECK_HEADERS([sys/acl.h])
|
AC_CHECK_HEADERS([sys/acl.h])
|
||||||
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/acl.h>
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/acl.h>
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
acl_t acl;
|
acl_t acl;
|
||||||
acl_entry_t user, group;
|
acl_entry_t user, group;
|
||||||
|
@ -597,7 +597,7 @@ if test "$PHP_FPM" != "no"; then
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
],[
|
],[
|
||||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/acl.h>
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/acl.h>
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
acl_t acl;
|
acl_t acl;
|
||||||
acl_entry_t user, group;
|
acl_entry_t user, group;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue