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

Skip to content

Commit 3dcdbde

Browse files
bpo-42598: Fix implicit function declarations in configure (GH-23690) (GH-23756)
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 be9e440 commit 3dcdbde

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
@@ -11072,10 +11072,10 @@ else
1107211072
main() {
1107311073
pthread_attr_t attr;
1107411074
pthread_t id;
11075-
if (pthread_attr_init(&attr)) exit(-1);
11076-
if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
11077-
if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
11078-
exit(0);
11075+
if (pthread_attr_init(&attr)) return (-1);
11076+
if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) return (-1);
11077+
if (pthread_create(&id, &attr, foo, NULL)) return (-1);
11078+
return (0);
1107911079
}
1108011080
_ACEOF
1108111081
if ac_fn_c_try_run "$LINENO"; then :
@@ -15083,7 +15083,7 @@ else
1508315083
int main()
1508415084
{
1508515085
/* Success: exit code 0 */
15086-
exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
15086+
return ((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
1508715087
}
1508815088

1508915089
_ACEOF
@@ -15464,7 +15464,7 @@ else
1546415464

1546515465
int main()
1546615466
{
15467-
exit(((-1)>>3 == -1) ? 0 : 1);
15467+
return (((-1)>>3 == -1) ? 0 : 1);
1546815468
}
1546915469

1547015470
_ACEOF
@@ -15934,6 +15934,7 @@ else
1593415934
/* end confdefs.h. */
1593515935

1593615936
#include <poll.h>
15937+
#include <unistd.h>
1593715938

1593815939
int main()
1593915940
{

configure.ac

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3313,10 +3313,10 @@ if test "$posix_threads" = "yes"; then
33133313
main() {
33143314
pthread_attr_t attr;
33153315
pthread_t id;
3316-
if (pthread_attr_init(&attr)) exit(-1);
3317-
if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
3318-
if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
3319-
exit(0);
3316+
if (pthread_attr_init(&attr)) return (-1);
3317+
if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) return (-1);
3318+
if (pthread_create(&id, &attr, foo, NULL)) return (-1);
3319+
return (0);
33203320
}]])],
33213321
[ac_cv_pthread_system_supported=yes],
33223322
[ac_cv_pthread_system_supported=no],
@@ -4725,7 +4725,7 @@ then
47254725
int main()
47264726
{
47274727
/* Success: exit code 0 */
4728-
exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
4728+
return ((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
47294729
}
47304730
]])],
47314731
[ac_cv_wchar_t_signed=yes],
@@ -4847,7 +4847,7 @@ AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
48474847
AC_RUN_IFELSE([AC_LANG_SOURCE([[
48484848
int main()
48494849
{
4850-
exit(((-1)>>3 == -1) ? 0 : 1);
4850+
return (((-1)>>3 == -1) ? 0 : 1);
48514851
}
48524852
]])],
48534853
[ac_cv_rshift_extends_sign=yes],
@@ -4994,6 +4994,7 @@ AC_MSG_CHECKING(for broken poll())
49944994
AC_CACHE_VAL(ac_cv_broken_poll,
49954995
AC_RUN_IFELSE([AC_LANG_SOURCE([[
49964996
#include <poll.h>
4997+
#include <unistd.h>
49974998
49984999
int main()
49995000
{

0 commit comments

Comments
 (0)
0