Skip to content

Commit 9feda9f

Browse files
bpo-42598: Fix implicit function declarations in configure (GH-23690) (GH-23757)
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. (cherry picked from commit 674fa0a) Co-authored-by: Joshua Root <jmr@macports.org>
1 parent 150b9bf commit 9feda9f

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix implicit function declarations in configure which could have resulted in
2+
incorrect configuration checks. Patch contributed by Joshua Root.

configure

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10928,10 +10928,10 @@ else
1092810928
main() {
1092910929
pthread_attr_t attr;
1093010930
pthread_t id;
10931-
if (pthread_attr_init(&attr)) exit(-1);
10932-
if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
10933-
if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
10934-
exit(0);
10931+
if (pthread_attr_init(&attr)) return (-1);
10932+
if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) return (-1);
10933+
if (pthread_create(&id, &attr, foo, NULL)) return (-1);
10934+
return (0);
1093510935
}
1093610936
_ACEOF
1093710937
if ac_fn_c_try_run "$LINENO"; then :
@@ -14916,7 +14916,7 @@ else
1491614916
int main()
1491714917
{
1491814918
/* Success: exit code 0 */
14919-
exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
14919+
return ((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
1492014920
}
1492114921
1492214922
_ACEOF
@@ -15261,7 +15261,7 @@ else
1526115261
1526215262
int main()
1526315263
{
15264-
exit(((-1)>>3 == -1) ? 0 : 1);
15264+
return (((-1)>>3 == -1) ? 0 : 1);
1526515265
}
1526615266
1526715267
_ACEOF
@@ -15731,6 +15731,7 @@ else
1573115731
/* end confdefs.h. */
1573215732
1573315733
#include <poll.h>
15734+
#include <unistd.h>
1573415735
1573515736
int main()
1573615737
{

configure.ac

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3210,10 +3210,10 @@ if test "$posix_threads" = "yes"; then
32103210
main() {
32113211
pthread_attr_t attr;
32123212
pthread_t id;
3213-
if (pthread_attr_init(&attr)) exit(-1);
3214-
if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
3215-
if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
3216-
exit(0);
3213+
if (pthread_attr_init(&attr)) return (-1);
3214+
if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) return (-1);
3215+
if (pthread_create(&id, &attr, foo, NULL)) return (-1);
3216+
return (0);
32173217
}]])],
32183218
[ac_cv_pthread_system_supported=yes],
32193219
[ac_cv_pthread_system_supported=no],
@@ -4616,7 +4616,7 @@ then
46164616
int main()
46174617
{
46184618
/* Success: exit code 0 */
4619-
exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
4619+
return ((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
46204620
}
46214621
]])],
46224622
[ac_cv_wchar_t_signed=yes],
@@ -4709,7 +4709,7 @@ AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
47094709
AC_RUN_IFELSE([AC_LANG_SOURCE([[
47104710
int main()
47114711
{
4712-
exit(((-1)>>3 == -1) ? 0 : 1);
4712+
return (((-1)>>3 == -1) ? 0 : 1);
47134713
}
47144714
]])],
47154715
[ac_cv_rshift_extends_sign=yes],
@@ -4856,6 +4856,7 @@ AC_MSG_CHECKING(for broken poll())
48564856
AC_CACHE_VAL(ac_cv_broken_poll,
48574857
AC_RUN_IFELSE([AC_LANG_SOURCE([[
48584858
#include <poll.h>
4859+
#include <unistd.h>
48594860
48604861
int main()
48614862
{

0 commit comments

Comments
 (0)