Skip to content

Commit 142ae54

Browse files
thesamesammgorny
authored andcommitted
[3.10] pythonGH-99086: Fix -Wstrict-prototypes, -Wimplicit-function-declara… (python#99920)
[3.10] pythongh-99086: Fix -Wstrict-prototypes, -Wimplicit-function-declaration warnings in configure.ac (pythonGH-99406) Follow up to 12078e7. (cherry picked from commit e35ca41) Co-authored-by: Sam James <[email protected]>
1 parent 7d4a071 commit 142ae54

File tree

3 files changed

+63
-52
lines changed

3 files changed

+63
-52
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix ``-Wimplicit-int``, ``-Wstrict-prototypes``, and ``-Wimplicit-function-declaration`` compiler warnings in :program:`configure` checks.

configure

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5861,7 +5861,7 @@ if test "x$enable_profiling" = xyes; then
58615861
CC="$CC -pg"
58625862
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
58635863
/* end confdefs.h. */
5864-
int main() { return 0; }
5864+
int main(void) { return 0; }
58655865
_ACEOF
58665866
if ac_fn_c_try_link "$LINENO"; then :
58675867

@@ -7593,7 +7593,7 @@ else
75937593
75947594
void* routine(void* p){return NULL;}
75957595
7596-
int main(){
7596+
int main(void){
75977597
pthread_t p;
75987598
if(pthread_create(&p,NULL,routine,NULL)!=0)
75997599
return 1;
@@ -7649,7 +7649,7 @@ else
76497649
76507650
void* routine(void* p){return NULL;}
76517651
7652-
int main(){
7652+
int main(void){
76537653
pthread_t p;
76547654
if(pthread_create(&p,NULL,routine,NULL)!=0)
76557655
return 1;
@@ -7699,7 +7699,7 @@ else
76997699
77007700
void* routine(void* p){return NULL;}
77017701
7702-
int main(){
7702+
int main(void){
77037703
pthread_t p;
77047704
if(pthread_create(&p,NULL,routine,NULL)!=0)
77057705
return 1;
@@ -7749,7 +7749,7 @@ else
77497749
77507750
void* routine(void* p){return NULL;}
77517751
7752-
int main(){
7752+
int main(void){
77537753
pthread_t p;
77547754
if(pthread_create(&p,NULL,routine,NULL)!=0)
77557755
return 1;
@@ -10060,7 +10060,7 @@ else
1006010060
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1006110061
/* end confdefs.h. */
1006210062
10063-
int main()
10063+
int main(void)
1006410064
{
1006510065
char s[16];
1006610066
int i, *p1, *p2;
@@ -10646,6 +10646,7 @@ $as_echo_n "checking for pthread_create in -lpthread... " >&6; }
1064610646
/* end confdefs.h. */
1064710647
1064810648
#include <stdio.h>
10649+
#include <stdlib.h>
1064910650
#include <pthread.h>
1065010651
1065110652
void * start_routine (void *arg) { exit (0); }
@@ -10947,7 +10948,7 @@ else
1094710948
void *foo(void *parm) {
1094810949
return NULL;
1094910950
}
10950-
int main() {
10951+
int main(void) {
1095110952
pthread_attr_t attr;
1095210953
pthread_t id;
1095310954
if (pthread_attr_init(&attr)) return (-1);
@@ -12256,7 +12257,7 @@ else
1225612257
1225712258
#include <sys/stat.h>
1225812259
#include <unistd.h>
12259-
int main(int argc, char*argv[])
12260+
int main(int argc, char *argv[])
1226012261
{
1226112262
if(chflags(argv[0], 0) != 0)
1226212263
return 1;
@@ -12305,7 +12306,7 @@ else
1230512306
1230612307
#include <sys/stat.h>
1230712308
#include <unistd.h>
12308-
int main(int argc, char*argv[])
12309+
int main(int argc, char *argv[])
1230912310
{
1231012311
if(lchflags(argv[0], 0) != 0)
1231112312
return 1;
@@ -13266,7 +13267,7 @@ else
1326613267
#include <sys/socket.h>
1326713268
#include <netinet/in.h>
1326813269
13269-
int main()
13270+
int main(void)
1327013271
{
1327113272
int passive, gaierr, inet4 = 0, inet6 = 0;
1327213273
struct addrinfo hints, *ai, *aitop;
@@ -14493,7 +14494,7 @@ else
1449314494
1449414495
#include <stdlib.h>
1449514496
#include <math.h>
14496-
int main() {
14497+
int main(void) {
1449714498
volatile double x, y, z;
1449814499
/* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
1449914500
x = 0.99999999999999989; /* 1-2**-53 */
@@ -15291,7 +15292,7 @@ else
1529115292
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1529215293
/* end confdefs.h. */
1529315294
15294-
int main()
15295+
int main(void)
1529515296
{
1529615297
return (((-1)>>3 == -1) ? 0 : 1);
1529715298
}
@@ -15722,7 +15723,7 @@ else
1572215723
1572315724
#include <stdlib.h>
1572415725
#include <unistd.h>
15725-
int main()
15726+
int main(void)
1572615727
{
1572715728
int val1 = nice(1);
1572815729
if (val1 != -1 && val1 == nice(2))
@@ -15765,7 +15766,7 @@ else
1576515766
#include <poll.h>
1576615767
#include <unistd.h>
1576715768
15768-
int main()
15769+
int main(void)
1576915770
{
1577015771
struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
1577115772
int poll_test;
@@ -15823,7 +15824,7 @@ else
1582315824
extern char *tzname[];
1582415825
#endif
1582515826
15826-
int main()
15827+
int main(void)
1582715828
{
1582815829
/* Note that we need to ensure that not only does tzset(3)
1582915830
do 'something' with localtime, but it works as documented
@@ -16584,9 +16585,10 @@ else
1658416585
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1658516586
/* end confdefs.h. */
1658616587
16588+
#include <stddef.h>
1658716589
#include <stdio.h>
16588-
#include<stdlib.h>
16589-
int main() {
16590+
#include <stdlib.h>
16591+
int main(void) {
1659016592
size_t len = -1;
1659116593
const char *str = "text";
1659216594
len = mbstowcs(NULL, str, 0);
@@ -16763,7 +16765,7 @@ else
1676316765
#include <stdlib.h>
1676416766
#include <string.h>
1676516767
void foo(void *p, void *q) { memmove(p, q, 19); }
16766-
int main() {
16768+
int main(void) {
1676716769
char a[32] = "123456789000000000";
1676816770
foo(&a[9], a);
1676916771
if (strcmp(a, "123456789123456789000000000") != 0)
@@ -16818,7 +16820,7 @@ else
1681816820
);
1681916821
return r;
1682016822
}
16821-
int main() {
16823+
int main(void) {
1682216824
int p = 8;
1682316825
if ((foo(&p) ? : p) != 6)
1682416826
return 1;
@@ -16857,7 +16859,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1685716859
#include <stdatomic.h>
1685816860
atomic_int int_var;
1685916861
atomic_uintptr_t uintptr_var;
16860-
int main() {
16862+
int main(void) {
1686116863
atomic_store_explicit(&int_var, 5, memory_order_relaxed);
1686216864
atomic_store_explicit(&uintptr_var, 0, memory_order_relaxed);
1686316865
int loaded_value = atomic_load_explicit(&int_var, memory_order_seq_cst);
@@ -16890,9 +16892,10 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1689016892
/* end confdefs.h. */
1689116893
1689216894
16893-
volatile int val = 1;
16894-
int main() {
16895-
__atomic_load_n(&val, __ATOMIC_SEQ_CST);
16895+
int val;
16896+
int main(void) {
16897+
__atomic_store_n(&val, 1, __ATOMIC_SEQ_CST);
16898+
(void)__atomic_load_n(&val, __ATOMIC_SEQ_CST);
1689616899
return 0;
1689716900
}
1689816901
@@ -16949,7 +16952,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1694916952
1695016953
#include <dirent.h>
1695116954
16952-
int main() {
16955+
int main(void) {
1695316956
struct dirent entry;
1695416957
return entry.d_type == DT_UNKNOWN;
1695516958
}
@@ -16979,11 +16982,12 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1697916982
/* end confdefs.h. */
1698016983
1698116984
16985+
#include <stddef.h>
1698216986
#include <unistd.h>
1698316987
#include <sys/syscall.h>
1698416988
#include <linux/random.h>
1698516989
16986-
int main() {
16990+
int main(void) {
1698716991
char buffer[1];
1698816992
const size_t buflen = sizeof(buffer);
1698916993
const int flags = GRND_NONBLOCK;
@@ -17018,9 +17022,10 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1701817022
/* end confdefs.h. */
1701917023
1702017024
17025+
#include <stddef.h>
1702117026
#include <sys/random.h>
1702217027
17023-
int main() {
17028+
int main(void) {
1702417029
char buffer[1];
1702517030
const size_t buflen = sizeof(buffer);
1702617031
const int flags = 0;

0 commit comments

Comments
 (0)