From 04fdb6cb9c713d9d5e802c2f048a496ccd92586d Mon Sep 17 00:00:00 2001 From: Joshua Root Date: Tue, 8 Dec 2020 22:10:38 +1100 Subject: [PATCH 1/2] Fix implicit function declarations in configure This is invalid in C99 and later and is an error with some compilers (e.g. clang in Xcode 12), and can thus cause configure checks to produce incorrect results. --- configure.ac | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 7f7dfa588a8144..31e39ec4f7d4c7 100644 --- a/configure.ac +++ b/configure.ac @@ -3311,10 +3311,10 @@ if test "$posix_threads" = "yes"; then main() { pthread_attr_t attr; pthread_t id; - if (pthread_attr_init(&attr)) exit(-1); - if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1); - if (pthread_create(&id, &attr, foo, NULL)) exit(-1); - exit(0); + if (pthread_attr_init(&attr)) return (-1); + if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) return (-1); + if (pthread_create(&id, &attr, foo, NULL)) return (-1); + return (0); }]])], [ac_cv_pthread_system_supported=yes], [ac_cv_pthread_system_supported=no], @@ -4728,7 +4728,7 @@ then int main() { /* Success: exit code 0 */ - exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1); + return ((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1); } ]])], [ac_cv_wchar_t_signed=yes], @@ -4850,7 +4850,7 @@ AC_CACHE_VAL(ac_cv_rshift_extends_sign, [ AC_RUN_IFELSE([AC_LANG_SOURCE([[ int main() { - exit(((-1)>>3 == -1) ? 0 : 1); + return (((-1)>>3 == -1) ? 0 : 1); } ]])], [ac_cv_rshift_extends_sign=yes], @@ -4997,6 +4997,7 @@ AC_MSG_CHECKING(for broken poll()) AC_CACHE_VAL(ac_cv_broken_poll, AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include +#include int main() { From 3338a3688b118413909da01627d29335369be7fe Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Sun, 13 Dec 2020 14:43:55 -0500 Subject: [PATCH 2/2] add blurb entry and run autoconf against current HEAD --- .../Build/2020-12-13-14-43-10.bpo-42598.7ipr5H.rst | 2 ++ configure | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2020-12-13-14-43-10.bpo-42598.7ipr5H.rst diff --git a/Misc/NEWS.d/next/Build/2020-12-13-14-43-10.bpo-42598.7ipr5H.rst b/Misc/NEWS.d/next/Build/2020-12-13-14-43-10.bpo-42598.7ipr5H.rst new file mode 100644 index 00000000000000..7dafc105c45ea9 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2020-12-13-14-43-10.bpo-42598.7ipr5H.rst @@ -0,0 +1,2 @@ +Fix implicit function declarations in configure which could have resulted in +incorrect configuration checks. Patch contributed by Joshua Root. diff --git a/configure b/configure index 9ee750b70f4a19..0c0aee96d507d2 100755 --- a/configure +++ b/configure @@ -11108,10 +11108,10 @@ else main() { pthread_attr_t attr; pthread_t id; - if (pthread_attr_init(&attr)) exit(-1); - if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1); - if (pthread_create(&id, &attr, foo, NULL)) exit(-1); - exit(0); + if (pthread_attr_init(&attr)) return (-1); + if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) return (-1); + if (pthread_create(&id, &attr, foo, NULL)) return (-1); + return (0); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : @@ -15130,7 +15130,7 @@ else int main() { /* Success: exit code 0 */ - exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1); + return ((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1); } _ACEOF @@ -15511,7 +15511,7 @@ else int main() { - exit(((-1)>>3 == -1) ? 0 : 1); + return (((-1)>>3 == -1) ? 0 : 1); } _ACEOF @@ -15981,6 +15981,7 @@ else /* end confdefs.h. */ #include +#include int main() {