Skip to content

Commit 99ad327

Browse files
jmrootstratakis
authored andcommitted
00410: bpo-42598: 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.
1 parent 09801b6 commit 99ad327

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed
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

+7-6
Original file line numberDiff line numberDiff line change
@@ -10840,10 +10840,10 @@ else
1084010840
int main() {
1084110841
pthread_attr_t attr;
1084210842
pthread_t id;
10843-
if (pthread_attr_init(&attr)) exit(-1);
10844-
if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
10845-
if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
10846-
exit(0);
10843+
if (pthread_attr_init(&attr)) return (-1);
10844+
if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) return (-1);
10845+
if (pthread_create(&id, &attr, foo, NULL)) return (-1);
10846+
return (0);
1084710847
}
1084810848
_ACEOF
1084910849
if ac_fn_c_try_run "$LINENO"; then :
@@ -14891,7 +14891,7 @@ else
1489114891
int main()
1489214892
{
1489314893
/* Success: exit code 0 */
14894-
exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
14894+
return ((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
1489514895
}
1489614896
1489714897
_ACEOF
@@ -15213,7 +15213,7 @@ else
1521315213
1521415214
int main()
1521515215
{
15216-
exit(((-1)>>3 == -1) ? 0 : 1);
15216+
return (((-1)>>3 == -1) ? 0 : 1);
1521715217
}
1521815218
1521915219
_ACEOF
@@ -15725,6 +15725,7 @@ else
1572515725
/* end confdefs.h. */
1572615726
1572715727
#include <poll.h>
15728+
#include <unistd.h>
1572815729
1572915730
int main()
1573015731
{

configure.ac

+7-6
Original file line numberDiff line numberDiff line change
@@ -3188,10 +3188,10 @@ if test "$posix_threads" = "yes"; then
31883188
int main() {
31893189
pthread_attr_t attr;
31903190
pthread_t id;
3191-
if (pthread_attr_init(&attr)) exit(-1);
3192-
if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
3193-
if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
3194-
exit(0);
3191+
if (pthread_attr_init(&attr)) return (-1);
3192+
if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) return (-1);
3193+
if (pthread_create(&id, &attr, foo, NULL)) return (-1);
3194+
return (0);
31953195
}]])],
31963196
[ac_cv_pthread_system_supported=yes],
31973197
[ac_cv_pthread_system_supported=no],
@@ -4743,7 +4743,7 @@ then
47434743
int main()
47444744
{
47454745
/* Success: exit code 0 */
4746-
exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
4746+
return ((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
47474747
}
47484748
]])],
47494749
[ac_cv_wchar_t_signed=yes],
@@ -4818,7 +4818,7 @@ AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
48184818
AC_RUN_IFELSE([AC_LANG_SOURCE([[
48194819
int main()
48204820
{
4821-
exit(((-1)>>3 == -1) ? 0 : 1);
4821+
return (((-1)>>3 == -1) ? 0 : 1);
48224822
}
48234823
]])],
48244824
[ac_cv_rshift_extends_sign=yes],
@@ -4970,6 +4970,7 @@ AC_MSG_CHECKING(for broken poll())
49704970
AC_CACHE_VAL(ac_cv_broken_poll,
49714971
AC_RUN_IFELSE([AC_LANG_SOURCE([[
49724972
#include <poll.h>
4973+
#include <unistd.h>
49734974
49744975
int main()
49754976
{

0 commit comments

Comments
 (0)