aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-12-01 11:02:49 +0000
committerMichał Górny <mgorny@gentoo.org>2022-12-07 08:55:41 +0100
commit1ee498b848422d828489081f8e93a75518c38ac3 (patch)
tree8774dffb67877487e2ab6460a9f30c2eda609195
parentSkip sched/priority tests (diff)
downloadcpython-1ee498b848422d828489081f8e93a75518c38ac3.tar.gz
cpython-1ee498b848422d828489081f8e93a75518c38ac3.tar.bz2
cpython-1ee498b848422d828489081f8e93a75518c38ac3.zip
[3.10] GH-99086: Fix -Wstrict-prototypes, -Wimplicit-function-declara… (#99920)gentoo-3.8.16
[3.10] gh-99086: Fix -Wstrict-prototypes, -Wimplicit-function-declaration warnings in configure.ac (GH-99406) Follow up to 12078e78f6e4a21f344e4eaff529e1ff3b97734f. (cherry picked from commit e35ca417fe81a64985c2b29e863ce418ae75b96e) Co-authored-by: Sam James <sam@gentoo.org>
-rw-r--r--Misc/NEWS.d/next/Build/2022-11-24-02-58-10.gh-issue-99086.DV_4Br.rst1
-rwxr-xr-xconfigure57
-rw-r--r--configure.ac57
3 files changed, 63 insertions, 52 deletions
diff --git a/Misc/NEWS.d/next/Build/2022-11-24-02-58-10.gh-issue-99086.DV_4Br.rst b/Misc/NEWS.d/next/Build/2022-11-24-02-58-10.gh-issue-99086.DV_4Br.rst
new file mode 100644
index 00000000000..2dace165ca1
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2022-11-24-02-58-10.gh-issue-99086.DV_4Br.rst
@@ -0,0 +1 @@
+Fix ``-Wimplicit-int``, ``-Wstrict-prototypes``, and ``-Wimplicit-function-declaration`` compiler warnings in :program:`configure` checks.
diff --git a/configure b/configure
index 3db256d679f..34bf9eae16d 100755
--- a/configure
+++ b/configure
@@ -5849,7 +5849,7 @@ if test "x$enable_profiling" = xyes; then
CC="$CC -pg"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-int main() { return 0; }
+int main(void) { return 0; }
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
@@ -7581,7 +7581,7 @@ else
void* routine(void* p){return NULL;}
-int main(){
+int main(void){
pthread_t p;
if(pthread_create(&p,NULL,routine,NULL)!=0)
return 1;
@@ -7637,7 +7637,7 @@ else
void* routine(void* p){return NULL;}
-int main(){
+int main(void){
pthread_t p;
if(pthread_create(&p,NULL,routine,NULL)!=0)
return 1;
@@ -7687,7 +7687,7 @@ else
void* routine(void* p){return NULL;}
-int main(){
+int main(void){
pthread_t p;
if(pthread_create(&p,NULL,routine,NULL)!=0)
return 1;
@@ -7737,7 +7737,7 @@ else
void* routine(void* p){return NULL;}
-int main(){
+int main(void){
pthread_t p;
if(pthread_create(&p,NULL,routine,NULL)!=0)
return 1;
@@ -10048,7 +10048,7 @@ else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-int main()
+int main(void)
{
char s[16];
int i, *p1, *p2;
@@ -10634,6 +10634,7 @@ $as_echo_n "checking for pthread_create in -lpthread... " >&6; }
/* end confdefs.h. */
#include <stdio.h>
+#include <stdlib.h>
#include <pthread.h>
void * start_routine (void *arg) { exit (0); }
@@ -10935,7 +10936,7 @@ else
void *foo(void *parm) {
return NULL;
}
- int main() {
+ int main(void) {
pthread_attr_t attr;
pthread_t id;
if (pthread_attr_init(&attr)) return (-1);
@@ -12244,7 +12245,7 @@ else
#include <sys/stat.h>
#include <unistd.h>
-int main(int argc, char*argv[])
+int main(int argc, char *argv[])
{
if(chflags(argv[0], 0) != 0)
return 1;
@@ -12293,7 +12294,7 @@ else
#include <sys/stat.h>
#include <unistd.h>
-int main(int argc, char*argv[])
+int main(int argc, char *argv[])
{
if(lchflags(argv[0], 0) != 0)
return 1;
@@ -13254,7 +13255,7 @@ else
#include <sys/socket.h>
#include <netinet/in.h>
-int main()
+int main(void)
{
int passive, gaierr, inet4 = 0, inet6 = 0;
struct addrinfo hints, *ai, *aitop;
@@ -14481,7 +14482,7 @@ else
#include <stdlib.h>
#include <math.h>
-int main() {
+int main(void) {
volatile double x, y, z;
/* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
x = 0.99999999999999989; /* 1-2**-53 */
@@ -15279,7 +15280,7 @@ else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-int main()
+int main(void)
{
return (((-1)>>3 == -1) ? 0 : 1);
}
@@ -15710,7 +15711,7 @@ else
#include <stdlib.h>
#include <unistd.h>
-int main()
+int main(void)
{
int val1 = nice(1);
if (val1 != -1 && val1 == nice(2))
@@ -15753,7 +15754,7 @@ else
#include <poll.h>
#include <unistd.h>
-int main()
+int main(void)
{
struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
int poll_test;
@@ -15811,7 +15812,7 @@ else
extern char *tzname[];
#endif
-int main()
+int main(void)
{
/* Note that we need to ensure that not only does tzset(3)
do 'something' with localtime, but it works as documented
@@ -16572,9 +16573,10 @@ else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
+#include <stddef.h>
#include <stdio.h>
-#include<stdlib.h>
-int main() {
+#include <stdlib.h>
+int main(void) {
size_t len = -1;
const char *str = "text";
len = mbstowcs(NULL, str, 0);
@@ -16751,7 +16753,7 @@ else
#include <stdlib.h>
#include <string.h>
void foo(void *p, void *q) { memmove(p, q, 19); }
-int main() {
+int main(void) {
char a[32] = "123456789000000000";
foo(&a[9], a);
if (strcmp(a, "123456789123456789000000000") != 0)
@@ -16806,7 +16808,7 @@ else
);
return r;
}
- int main() {
+ int main(void) {
int p = 8;
if ((foo(&p) ? : p) != 6)
return 1;
@@ -16845,7 +16847,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#include <stdatomic.h>
atomic_int int_var;
atomic_uintptr_t uintptr_var;
- int main() {
+ int main(void) {
atomic_store_explicit(&int_var, 5, memory_order_relaxed);
atomic_store_explicit(&uintptr_var, 0, memory_order_relaxed);
int loaded_value = atomic_load_explicit(&int_var, memory_order_seq_cst);
@@ -16878,9 +16880,10 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
- volatile int val = 1;
- int main() {
- __atomic_load_n(&val, __ATOMIC_SEQ_CST);
+ int val;
+ int main(void) {
+ __atomic_store_n(&val, 1, __ATOMIC_SEQ_CST);
+ (void)__atomic_load_n(&val, __ATOMIC_SEQ_CST);
return 0;
}
@@ -16937,7 +16940,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#include <dirent.h>
- int main() {
+ int main(void) {
struct dirent entry;
return entry.d_type == DT_UNKNOWN;
}
@@ -16967,11 +16970,12 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
+ #include <stddef.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <linux/random.h>
- int main() {
+ int main(void) {
char buffer[1];
const size_t buflen = sizeof(buffer);
const int flags = GRND_NONBLOCK;
@@ -17006,9 +17010,10 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
+ #include <stddef.h>
#include <sys/random.h>
- int main() {
+ int main(void) {
char buffer[1];
const size_t buflen = sizeof(buffer);
const int flags = 0;
diff --git a/configure.ac b/configure.ac
index 33390aed2f0..4874185c703 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1090,7 +1090,7 @@ AC_ARG_ENABLE(profiling,
if test "x$enable_profiling" = xyes; then
ac_save_cc="$CC"
CC="$CC -pg"
- AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
+ AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void) { return 0; }]])],
[],
[enable_profiling=no])
CC="$ac_save_cc"
@@ -2008,7 +2008,7 @@ AC_CACHE_VAL(ac_cv_pthread_is_default,
void* routine(void* p){return NULL;}
-int main(){
+int main(void){
pthread_t p;
if(pthread_create(&p,NULL,routine,NULL)!=0)
return 1;
@@ -2043,7 +2043,7 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
void* routine(void* p){return NULL;}
-int main(){
+int main(void){
pthread_t p;
if(pthread_create(&p,NULL,routine,NULL)!=0)
return 1;
@@ -2072,7 +2072,7 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
void* routine(void* p){return NULL;}
-int main(){
+int main(void){
pthread_t p;
if(pthread_create(&p,NULL,routine,NULL)!=0)
return 1;
@@ -2101,7 +2101,7 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
void* routine(void* p){return NULL;}
-int main(){
+int main(void){
pthread_t p;
if(pthread_create(&p,NULL,routine,NULL)!=0)
return 1;
@@ -2884,7 +2884,7 @@ esac
AC_MSG_CHECKING(aligned memory access is required)
AC_CACHE_VAL(ac_cv_aligned_required,
[AC_RUN_IFELSE([AC_LANG_SOURCE([[
-int main()
+int main(void)
{
char s[16];
int i, *p1, *p2;
@@ -3167,6 +3167,7 @@ yes
AC_MSG_CHECKING([for pthread_create in -lpthread])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
+#include <stdlib.h>
#include <pthread.h>
void * start_routine (void *arg) { exit (0); }]], [[
@@ -3232,7 +3233,7 @@ if test "$posix_threads" = "yes"; then
void *foo(void *parm) {
return NULL;
}
- int main() {
+ int main(void) {
pthread_attr_t attr;
pthread_t id;
if (pthread_attr_init(&attr)) return (-1);
@@ -3786,7 +3787,7 @@ AC_CACHE_CHECK([for chflags], [ac_cv_have_chflags], [dnl
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <sys/stat.h>
#include <unistd.h>
-int main(int argc, char*argv[])
+int main(int argc, char *argv[])
{
if(chflags(argv[0], 0) != 0)
return 1;
@@ -3808,7 +3809,7 @@ AC_CACHE_CHECK([for lchflags], [ac_cv_have_lchflags], [dnl
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <sys/stat.h>
#include <unistd.h>
-int main(int argc, char*argv[])
+int main(int argc, char *argv[])
{
if(lchflags(argv[0], 0) != 0)
return 1;
@@ -4021,7 +4022,7 @@ then
#include <sys/socket.h>
#include <netinet/in.h>
-int main()
+int main(void)
{
int passive, gaierr, inet4 = 0, inet6 = 0;
struct addrinfo hints, *ai, *aitop;
@@ -4479,7 +4480,7 @@ CC="$CC $BASECFLAGS"
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdlib.h>
#include <math.h>
-int main() {
+int main(void) {
volatile double x, y, z;
/* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
x = 0.99999999999999989; /* 1-2**-53 */
@@ -4751,7 +4752,7 @@ fi],
AC_MSG_CHECKING(whether right shift extends the sign bit)
AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
AC_RUN_IFELSE([AC_LANG_SOURCE([[
-int main()
+int main(void)
{
return (((-1)>>3 == -1) ? 0 : 1);
}
@@ -4878,7 +4879,7 @@ AC_CACHE_VAL(ac_cv_broken_nice, [
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdlib.h>
#include <unistd.h>
-int main()
+int main(void)
{
int val1 = nice(1);
if (val1 != -1 && val1 == nice(2))
@@ -4902,7 +4903,7 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <poll.h>
#include <unistd.h>
-int main()
+int main(void)
{
struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
int poll_test;
@@ -4940,7 +4941,7 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
extern char *tzname[];
#endif
-int main()
+int main(void)
{
/* Note that we need to ensure that not only does tzset(3)
do 'something' with localtime, but it works as documented
@@ -5296,9 +5297,10 @@ AC_CHECK_TYPE(socklen_t,,
AC_MSG_CHECKING(for broken mbstowcs)
AC_CACHE_VAL(ac_cv_broken_mbstowcs,
AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <stddef.h>
#include <stdio.h>
-#include<stdlib.h>
-int main() {
+#include <stdlib.h>
+int main(void) {
size_t len = -1;
const char *str = "text";
len = mbstowcs(NULL, str, 0);
@@ -5409,7 +5411,7 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdlib.h>
#include <string.h>
void foo(void *p, void *q) { memmove(p, q, 19); }
-int main() {
+int main(void) {
char a[32] = "123456789000000000";
foo(&a[9], a);
if (strcmp(a, "123456789123456789000000000") != 0)
@@ -5450,7 +5452,7 @@ if test "$have_gcc_asm_for_x87" = yes; then
);
return r;
}
- int main() {
+ int main(void) {
int p = 8;
if ((foo(&p) ? : p) != 6)
return 1;
@@ -5478,7 +5480,7 @@ AC_LINK_IFELSE(
#include <stdatomic.h>
atomic_int int_var;
atomic_uintptr_t uintptr_var;
- int main() {
+ int main(void) {
atomic_store_explicit(&int_var, 5, memory_order_relaxed);
atomic_store_explicit(&uintptr_var, 0, memory_order_relaxed);
int loaded_value = atomic_load_explicit(&int_var, memory_order_seq_cst);
@@ -5499,9 +5501,10 @@ AC_MSG_CHECKING(for GCC >= 4.7 __atomic builtins)
AC_LINK_IFELSE(
[
AC_LANG_SOURCE([[
- volatile int val = 1;
- int main() {
- __atomic_load_n(&val, __ATOMIC_SEQ_CST);
+ int val;
+ int main(void) {
+ __atomic_store_n(&val, 1, __ATOMIC_SEQ_CST);
+ (void)__atomic_load_n(&val, __ATOMIC_SEQ_CST);
return 0;
}
]])
@@ -5535,7 +5538,7 @@ AC_LINK_IFELSE(
AC_LANG_SOURCE([[
#include <dirent.h>
- int main() {
+ int main(void) {
struct dirent entry;
return entry.d_type == DT_UNKNOWN;
}
@@ -5553,11 +5556,12 @@ AC_MSG_CHECKING(for the Linux getrandom() syscall)
AC_LINK_IFELSE(
[
AC_LANG_SOURCE([[
+ #include <stddef.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <linux/random.h>
- int main() {
+ int main(void) {
char buffer[1];
const size_t buflen = sizeof(buffer);
const int flags = GRND_NONBLOCK;
@@ -5580,9 +5584,10 @@ AC_MSG_CHECKING(for the getrandom() function)
AC_LINK_IFELSE(
[
AC_LANG_SOURCE([[
+ #include <stddef.h>
#include <sys/random.h>
- int main() {
+ int main(void) {
char buffer[1];
const size_t buflen = sizeof(buffer);
const int flags = 0;