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 2020-09-30 00:15:55.000000000 -0500 +++ b/acinclude.m4 2020-12-30 04:54:29.000000000 -0600 @@ -1212,14 +1212,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; } ],[ @@ -1242,14 +1242,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 @@ -1350,25 +1350,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 @@ -1698,6 +1699,7 @@ AC_CACHE_VAL(_cv_have_broken_glibc_fopen_append,[ AC_TRY_RUN([ #include +#include int main(int argc, char *argv[]) { FILE *fp; @@ -1707,7 +1709,7 @@ fp = fopen(filename, "w"); if (fp == NULL) { perror("fopen"); - exit(2); + return 2; } fputs("foobar", fp); fclose(fp); @@ -1781,13 +1783,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 2020-09-30 00:15:50.000000000 -0500 +++ b/build/libtool.m4 2020-12-30 04:54:29.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 2020-09-30 00:15:55.000000000 -0500 +++ b/configure 2020-12-30 04:54:42.000000000 -0600 @@ -12642,13 +12642,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; } @@ -12763,6 +12763,7 @@ /* end confdefs.h. */ #include +#include int main(int argc, char *argv[]) { FILE *fp; @@ -12772,7 +12773,7 @@ fp = fopen(filename, "w"); if (fp == NULL) { perror("fopen"); - exit(2); + return 2; } fputs("foobar", fp); fclose(fp); @@ -14945,6 +14946,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include #include #include #ifndef AF_INET @@ -14957,11 +14959,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; @@ -14969,16 +14971,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 @@ -15505,25 +15507,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 @@ -74757,14 +74760,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; } @@ -74799,14 +74802,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; } @@ -74868,14 +74871,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 @@ -74911,14 +74914,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 @@ -79588,6 +79591,8 @@ #include #include +#include +#include int main(int argc, char **argv) { @@ -79705,6 +79710,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + #if HAVE_UNISTD_H #include #endif @@ -79716,9 +79723,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 @@ -79753,6 +79760,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + #if HAVE_UNISTD_H #include #endif @@ -79764,9 +79773,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 @@ -79801,6 +79810,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + #if HAVE_UNISTD_H #include #endif @@ -79822,9 +79833,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 @@ -79859,6 +79870,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + #if HAVE_UNISTD_H #include #endif @@ -79877,9 +79890,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 @@ -79914,6 +79927,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + #if HAVE_UNISTD_H #include #endif @@ -79931,9 +79946,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 @@ -79968,6 +79983,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + #if HAVE_UNISTD_H #include #endif @@ -79985,9 +80002,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 @@ -96254,7 +96271,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 : @@ -96604,16 +96624,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 @@ -96699,10 +96719,6 @@ # endif #endif -#ifdef __cplusplus -extern "C" void exit (int); -#endif - void fnord() { int i=42;} int main () { @@ -96718,7 +96734,7 @@ else puts (dlerror ()); - exit (status); + return status; } EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 @@ -96932,7 +96948,7 @@ fprintf(fp, "%d %d\n", ZEND_MM_ALIGNMENT, zeros); fclose(fp); - exit(0); + return 0; } _ACEOF @@ -97042,6 +97058,7 @@ #include #include #include +#include #ifndef MAP_ANON # ifdef MAP_ANONYMOUS # define MAP_ANON MAP_ANONYMOUS @@ -102719,10 +102736,6 @@ # endif #endif -#ifdef __cplusplus -extern "C" void exit (int); -#endif - void fnord() { int i=42;} int main () { @@ -102738,7 +102751,7 @@ else puts (dlerror ()); - exit (status); + return status; } EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 @@ -102819,10 +102832,6 @@ # endif #endif -#ifdef __cplusplus -extern "C" void exit (int); -#endif - void fnord() { int i=42;} int main () { @@ -102838,7 +102847,7 @@ else puts (dlerror ()); - exit (status); + return status; } EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5