8000 bpo-42598: Fix implicit function declarations in configure (GH-23690) · python/cpython@674fa0a · GitHub
[go: up one dir, main page]

Skip to content

Commit 674fa0a

Browse files
authored
bpo-42598: Fix implicit function declarations in configure (GH-23690)
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.
1 parent 463c7d3 commit 674fa0a

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
@@ -11108,10 +11108,10 @@ else
1110811108
main() {
1110911109
pthread_attr_t attr;
1111011110
pthread_t id;
11111-
if (pthread_attr_init(&attr)) exit(-1);
11112-
if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
11113-
if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
11114-
exit(0);
11111+
if (pthread_attr_init(&attr)) return (-1);
11112+
if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) return (-1);
11113+
if (pthread_create(&id, &attr, foo, NULL)) return (-1);
11114+
return (0);
1111511115
}
1111611116
_ACEOF
1111711117
if ac_fn_c_try_run "$LINENO"; then :
@@ -15130,7 +15130,7 @@ else
1513015130
int main()
1513115131
{
1513215132
/* Success: exit code 0 */
15133-
exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
15133+
return ((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
1513415134
}
1513515135

1513615136
_ACEOF
@@ -15511,7 +15511,7 @@ else
1551115511

1551215512
int main()
1551315513
{
15514-
exit(((-1)>>3 == -1) ? 0 : 1);
15514+
return (((-1)>>3 == -1) ? 0 : 1);
1551515515
}
1551615516

1551715517
_ACEOF
@@ -15981,6 +15981,7 @@ else
1598115981
/* end confdefs.h. */
1598215982

1598315983
#include <poll.h>
15984+
#include <unistd.h>
1598415985

1598515986
int main()
1598615987
{

configure.ac

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3311,10 +3311,10 @@ if test "$posix_threads" = "yes"; then
33113311
main() {
33123312
pthread_attr_t attr;
33133313
pthread_t id;
3314-
if (pthread_attr_init(&attr)) exit(-1);
3315-
if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
3316-
if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
3317-
exit(0);
3314+
if (pthread_attr_init(&attr)) return (-1);
3315+
if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) return (-1);
3316+
if (pthread_create(&id, &attr, foo, NULL)) return (-1);
3317+
return (0);
33183318
}]])],
33193319
[ac_cv_pthread_system_supported=yes],
33203320
[ac_cv_pthread_system_supported=no],
@@ -4728,7 +4728,7 @@ then
47284728
int main()
47294729
{
47304730
/* Success: exit code 0 */
4731-
exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
4731+
return ((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
47324732
}
47334733
]])],
47344734
[ac_cv_wchar_t_signed=yes],
@@ -4850,7 +4850,7 @@ AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
48504850
AC_RUN_IFELSE([AC_LANG_SOURCE([[
48514851
int main()
48524852
{
4853-
exit(((-1)>>3 == -1) ? 0 : 1);
4853+
return (((-1)>>3 == -1) ? 0 : 1);
48544854
}
48554855
]])],
48564856
[ac_cv_rshift_extends_sign=yes],
@@ -4997,6 +4997,7 @@ AC_MSG_CHECKING(for broken poll())
49974997
AC_CACHE_VAL(ac_cv_broken_poll,
49984998
AC_RUN_IFELSE([AC_LANG_SOURCE([[
49994999
#include <poll.h>
5000+
#include <unistd.h>
50005001
50015002
int main()
50025003
{

0 commit comments

Comments
 (0)
0