Fix implicit declaration of functions. https://bugs.php.net/bug.php?id=80171 https://github.com/php/php-src/commit/aa405b7da270595d349d0596ad31305a41d4b1c0 https://github.com/php/php-src/commit/00ba784a2ce95e009f98e0e6d263634673a3f2e1 --- a/acinclude.m4.orig 2019-10-22 11:59:41.000000000 -0500 +++ b/acinclude.m4 2020-12-30 01:32:11.000000000 -0600 @@ -1225,14 +1225,14 @@ #include #include $1 - main() { + int main() { int fd = open("conftest_in", O_WRONLY|O_CREAT, 0600); - if (fd < 0) exit(1); - if (pwrite(fd, "text", 4, 0) != 4) exit(1); + if (fd < 0) return 1; + if (pwrite(fd, "text", 4, 0) != 4) return 1; /* Linux glibc breakage until 2.2.5 */ - if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) exit(1); - exit(0); + if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) return 1; + return 0; } ],[ @@ -1255,14 +1255,14 @@ #include #include $1 - main() { + int main() { char buf[3]; int fd = open("conftest_in", O_RDONLY); - if (fd < 0) exit(1); - if (pread(fd, buf, 2, 0) != 2) exit(1); + if (fd < 0) return 1; + if (pread(fd, buf, 2, 0) != 2) return 1; /* Linux glibc breakage until 2.2.5 */ - if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) exit(1); - exit(0); + if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) return 1; + return 0; } ],[ ac_cv_pread=yes @@ -1363,25 +1363,26 @@ #define _REENTRANT #include #include +#include #ifndef PATH_MAX #define PATH_MAX 1024 #endif -main() { +int main() { DIR *dir; char entry[sizeof(struct dirent)+PATH_MAX]; struct dirent *pentry = (struct dirent *) &entry; dir = opendir("/"); if (!dir) - exit(1); + return 1; if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0) { close(dir); - exit(0); + return 0; } close(dir); - exit(1); + return 1; } ],[ ac_cv_what_readdir_r=POSIX @@ -1711,6 +1712,7 @@ AC_CACHE_VAL(_cv_have_broken_glibc_fopen_append,[ AC_TRY_RUN([ #include +#include int main(int argc, char *argv[]) { FILE *fp; @@ -1720,7 +1722,7 @@ fp = fopen(filename, "w"); if (fp == NULL) { perror("fopen"); - exit(2); + return 2; } fputs("foobar", fp); fclose(fp); @@ -1794,13 +1796,13 @@ cookie_io_functions_t funcs = {reader, writer, seeker, closer}; -main() { +int main() { struct cookiedata g = { 0 }; FILE *fp = fopencookie(&g, "r", funcs); if (fp && fseek(fp, 8192, SEEK_SET) == 0 && g.pos == 8192) - exit(0); - exit(1); + return 0; + return 1; } ], [ --- a/build/libtool.m4.orig 2019-10-22 11:59:37.000000000 -0500 +++ b/build/libtool.m4 2020-12-30 01:32:23.000000000 -0600 @@ -978,10 +978,6 @@ # endif #endif -#ifdef __cplusplus -extern "C" void exit (int); -#endif - void fnord() { int i=42;} int main () { @@ -997,7 +993,7 @@ else puts (dlerror ()); - exit (status); + return status; }] EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then --- a/configure.orig 2019-10-22 11:59:36.000000000 -0500 +++ b/configure 2020-12-30 01:38:25.000000000 -0600 @@ -12556,13 +12544,13 @@ cookie_io_functions_t funcs = {reader, writer, seeker, closer}; -main() { +int main() { struct cookiedata g = { 0 }; FILE *fp = fopencookie(&g, "r", funcs); if (fp && fseek(fp, 8192, SEEK_SET) == 0 && g.pos == 8192) - exit(0); - exit(1); + return 0; + return 1; } @@ -12677,6 +12665,7 @@ /* end confdefs.h. */ #include +#include int main(int argc, char *argv[]) { FILE *fp; @@ -12686,7 +12675,7 @@ fp = fopen(filename, "w"); if (fp == NULL) { perror("fopen"); - exit(2); + return 2; } fputs("foobar", fp); fclose(fp); @@ -14613,6 +14602,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include #include #include #ifndef AF_INET @@ -14625,11 +14615,11 @@ hints.ai_flags = AI_NUMERICHOST; if (getaddrinfo("127.0.0.1", 0, &hints, &ai) < 0) { - exit(1); + return 1; } if (ai == 0) { - exit(1); + return 1; } pai = ai; @@ -14637,16 +14627,16 @@ while (pai) { if (pai->ai_family != AF_INET) { /* 127.0.0.1/NUMERICHOST should only resolve ONE way */ - exit(1); + return 1; } if (pai->ai_addr->sa_family != AF_INET) { /* 127.0.0.1/NUMERICHOST should only resolve ONE way */ - exit(1); + return 1; } pai = pai->ai_next; } freeaddrinfo(ai); - exit(0); + return 0; } _ACEOF @@ -15160,25 +15150,26 @@ #define _REENTRANT #include #include +#include #ifndef PATH_MAX #define PATH_MAX 1024 #endif -main() { +int main() { DIR *dir; char entry[sizeof(struct dirent)+PATH_MAX]; struct dirent *pentry = (struct dirent *) &entry; dir = opendir("/"); if (!dir) - exit(1); + return 1; if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0) { close(dir); - exit(0); + return 0; } close(dir); - exit(1); + return 1; } _ACEOF @@ -75738,14 +75729,14 @@ #include #include - main() { + int main() { int fd = open("conftest_in", O_WRONLY|O_CREAT, 0600); - if (fd < 0) exit(1); - if (pwrite(fd, "text", 4, 0) != 4) exit(1); + if (fd < 0) return 1; + if (pwrite(fd, "text", 4, 0) != 4) return 1; /* Linux glibc breakage until 2.2.5 */ - if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) exit(1); - exit(0); + if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) return 1; + return 0; } @@ -75780,14 +75771,14 @@ #include #include ssize_t pwrite(int, void *, size_t, off64_t); - main() { + int main() { int fd = open("conftest_in", O_WRONLY|O_CREAT, 0600); - if (fd < 0) exit(1); - if (pwrite(fd, "text", 4, 0) != 4) exit(1); + if (fd < 0) return 1; + if (pwrite(fd, "text", 4, 0) != 4) return 1; /* Linux glibc breakage until 2.2.5 */ - if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) exit(1); - exit(0); + if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) return 1; + return 0; } @@ -75849,14 +75840,14 @@ #include #include - main() { + int main() { char buf[3]; int fd = open("conftest_in", O_RDONLY); - if (fd < 0) exit(1); - if (pread(fd, buf, 2, 0) != 2) exit(1); + if (fd < 0) return 1; + if (pread(fd, buf, 2, 0) != 2) return 1; /* Linux glibc breakage until 2.2.5 */ - if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) exit(1); - exit(0); + if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) return 1; + return 0; } _ACEOF @@ -75892,14 +75883,14 @@ #include #include ssize_t pread(int, void *, size_t, off64_t); - main() { + int main() { char buf[3]; int fd = open("conftest_in", O_RDONLY); - if (fd < 0) exit(1); - if (pread(fd, buf, 2, 0) != 2) exit(1); + if (fd < 0) return 1; + if (pread(fd, buf, 2, 0) != 2) return 1; /* Linux glibc breakage until 2.2.5 */ - if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) exit(1); - exit(0); + if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) return 1; + return 0; } _ACEOF @@ -79966,6 +79957,8 @@ #include #include +#include +#include int main(int argc, char **argv) { @@ -80083,6 +80076,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + #if HAVE_UNISTD_H #include #endif @@ -80094,9 +80089,9 @@ int main() { #if HAVE_CRYPT char *encrypted = crypt("rasmuslerdorf","rl"); - exit(!encrypted || strcmp(encrypted,"rl.3StKT.4T8M")); + return !encrypted || strcmp(encrypted,"rl.3StKT.4T8M"); #else - exit(1); + return 1; #endif } _ACEOF @@ -80131,6 +80126,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + #if HAVE_UNISTD_H #include #endif @@ -80142,9 +80139,9 @@ int main() { #if HAVE_CRYPT char *encrypted = crypt("rasmuslerdorf","_J9..rasm"); - exit(!encrypted || strcmp(encrypted,"_J9..rasmBYk8r9AiWNc")); + return !encrypted || strcmp(encrypted,"_J9..rasmBYk8r9AiWNc"); #else - exit(1); + return 1; #endif } _ACEOF @@ -80179,6 +80176,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + #if HAVE_UNISTD_H #include #endif @@ -80200,9 +80199,9 @@ strcpy(answer,salt); strcat(answer,"rISCgZzpwk3UhDidwXvin0"); encrypted = crypt("rasmuslerdorf",salt); - exit(!encrypted || strcmp(encrypted,answer)); + return !encrypted || strcmp(encrypted,answer); #else - exit(1); + return 1; #endif } _ACEOF @@ -80237,6 +80236,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + #if HAVE_UNISTD_H #include #endif @@ -80255,9 +80256,9 @@ strcpy(answer,salt); strcpy(&answer[29],"nIdrcHdxcUxWomQX9j6kvERCFjTg7Ra"); encrypted = crypt("rasmuslerdorf",salt); - exit(!encrypted || strcmp(encrypted,answer)); + return !encrypted || strcmp(encrypted,answer); #else - exit(1); + return 1; #endif } _ACEOF @@ -80292,6 +80293,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + #if HAVE_UNISTD_H #include #endif @@ -80309,9 +80312,9 @@ strcpy(answer, salt); strcat(answer, "EeHCRjm0bljalWuALHSTs1NB9ipEiLEXLhYeXdOpx22gmlmVejnVXFhd84cEKbYxCo.XuUTrW.RLraeEnsvWs/"); encrypted = crypt("rasmuslerdorf",salt); - exit(!encrypted || strcmp(encrypted,answer)); + return !encrypted || strcmp(encrypted,answer); #else - exit(1); + return 1; #endif } _ACEOF @@ -80346,6 +80349,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + #if HAVE_UNISTD_H #include #endif @@ -80363,9 +80368,9 @@ strcpy(answer, salt); strcat(answer, "cFAm2puLCujQ9t.0CxiFIIvFi4JyQx5UncCt/xRIX23"); encrypted = crypt("rasmuslerdorf",salt); - exit(!encrypted || strcmp(encrypted,answer)); + return !encrypted || strcmp(encrypted,answer); #else - exit(1); + return 1; #endif } _ACEOF @@ -96494,7 +96499,10 @@ else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -main() {char buf[20];exit(sprintf(buf,"testing 123")!=11); } + +#include +int main() {char buf[20]; return sprintf(buf,"testing 123")!=11; } + _ACEOF if ac_fn_c_try_run "$LINENO"; then : @@ -96844,16 +96852,16 @@ double d = (double) LONG_MIN * LONG_MIN + 2e9; if ((long) d == 2e9 && (long) -d == -2e9) { - exit(0); + return 0; } } else if (sizeof(long) == 8) { double correct = 18e18 - ((double) LONG_MIN * -2); /* Subtract ULONG_MAX + 1 */ if ((long) 18e18 == correct) { /* On 64-bit, only check between LONG_MAX and ULONG_MAX */ - exit(0); + return 0; } } - exit(1); + return 1; } _ACEOF @@ -96939,10 +96947,6 @@ # endif #endif -#ifdef __cplusplus -extern "C" void exit (int); -#endif - void fnord() { int i=42;} int main () { @@ -96958,7 +96962,7 @@ else puts (dlerror ()); - exit (status); + return status; } EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 @@ -97172,7 +97176,7 @@ fprintf(fp, "%d %d\n", ZEND_MM_ALIGNMENT, zeros); fclose(fp); - exit(0); + return 0; } _ACEOF @@ -97282,6 +97286,7 @@ #include #include #include +#include #ifndef MAP_ANON # ifdef MAP_ANONYMOUS # define MAP_ANON MAP_ANONYMOUS @@ -102977,10 +102982,6 @@ # endif #endif -#ifdef __cplusplus -extern "C" void exit (int); -#endif - void fnord() { int i=42;} int main () { @@ -102996,7 +102997,7 @@ else puts (dlerror ()); - exit (status); + return status; } EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 @@ -103077,10 +103078,6 @@ # endif #endif -#ifdef __cplusplus -extern "C" void exit (int); -#endif - void fnord() { int i=42;} int main () { @@ -103096,7 +103093,7 @@ else puts (dlerror ()); - exit (status); + return status; } EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5