Skip to content

Commit eeea35c

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 c1c1fcd commit eeea35c

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
@@ -5919,7 +5919,7 @@ if test "x$enable_profiling" = xyes; then
59195919
CC="$CC -pg"
59205920
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
59215921
/* end confdefs.h. */
5922-
int main() { return 0; }
5922+
int main(void) { return 0; }
59235923
_ACEOF
59245924
if ac_fn_c_try_link "$LINENO"; then :
59255925

@@ -7698,7 +7698,7 @@ else
76987698

76997699
void* routine(void* p){return NULL;}
77007700

7701-
int main(){
7701+
int main(void){
77027702
pthread_t p;
77037703
if(pthread_create(&p,NULL,routine,NULL)!=0)
77047704
return 1;
@@ -7754,7 +7754,7 @@ else
77547754

77557755
void* routine(void* p){return NULL;}
77567756

7757-
int main(){
7757+
int main(void){
77587758
pthread_t p;
77597759
if(pthread_create(&p,NULL,routine,NULL)!=0)
77607760
return 1;
@@ -7804,7 +7804,7 @@ else
78047804

78057805
void* routine(void* p){return NULL;}
78067806

7807-
int main(){
7807+
int main(void){
78087808
pthread_t p;
78097809
if(pthread_create(&p,NULL,routine,NULL)!=0)
78107810
return 1;
@@ -7854,7 +7854,7 @@ else
78547854

78557855
void* routine(void* p){return NULL;}
78567856

7857-
int main(){
7857+
int main(void){
78587858
pthread_t p;
78597859
if(pthread_create(&p,NULL,routine,NULL)!=0)
78607860
return 1;
@@ -10228,7 +10228,7 @@ else
1022810228
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1022910229
/* end confdefs.h. */
1023010230

10231-
int main()
10231+
int main(void)
1023210232
{
1023310233
char s[16];
1023410234
int i, *p1, *p2;
@@ -10855,6 +10855,7 @@ $as_echo_n "checking for pthread_create in -lpthread... " >&6; }
1085510855
/* end confdefs.h. */
1085610856

1085710857
#include <stdio.h>
10858+
#include <stdlib.h>
1085810859
#include <pthread.h>
1085910860

1086010861
void * start_routine (void *arg) { exit (0); }
@@ -11156,7 +11157,7 @@ else
1115611157
void *foo(void *parm) {
1115711158
return NULL;
1115811159
}
11159-
int main() {
11160+
int main(void) {
1116011161
pthread_attr_t attr;
1116111162
pthread_t id;
1116211163
if (pthread_attr_init(&attr)) return (-1);
@@ -12494,7 +12495,7 @@ else
1249412495

1249512496
#include <sys/stat.h>
1249612497
#include <unistd.h>
12497-
int main(int argc, char*argv[])
12498+
int main(int argc, char *argv[])
1249812499
{
1249912500
if(chflags(argv[0], 0) != 0)
1250012501
return 1;
@@ -12543,7 +12544,7 @@ else
1254312544

1254412545
#include <sys/stat.h>
1254512546
#include <unistd.h>
12546-
int main(int argc, char*argv[])
12547+
int main(int argc, char *argv[])
1254712548
{
1254812549
if(lchflags(argv[0], 0) != 0)
1254912550
return 1;
@@ -13473,7 +13474,7 @@ else
1347313474
#include <sys/socket.h>
1347413475
#include <netinet/in.h>
1347513476

13476-
int main()
13477+
int main(void)
1347713478
{
1347813479
int passive, gaierr, inet4 = 0, inet6 = 0;
1347913480
struct addrinfo hints, *ai, *aitop;
@@ -14700,7 +14701,7 @@ else
1470014701

1470114702
#include <stdlib.h>
1470214703
#include <math.h>
14703-
int main() {
14704+
int main(void) {
1470414705
volatile double x, y, z;
1470514706
/* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
1470614707
x = 0.99999999999999989; /* 1-2**-53 */
@@ -15550,7 +15551,7 @@ else
1555015551
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1555115552
/* end confdefs.h. */
1555215553

15553-
int main()
15554+
int main(void)
1555415555
{
1555515556
return (((-1)>>3 == -1) ? 0 : 1);
1555615557
}
@@ -15981,7 +15982,7 @@ else
1598115982

1598215983
#include <stdlib.h>
1598315984
#include <unistd.h>
15984-
int main()
15985+
int main(void)
1598515986
{
1598615987
int val1 = nice(1);
1598715988
if (val1 != -1 && val1 == nice(2))
@@ -16024,7 +16025,7 @@ else
1602416025
#include <poll.h>
1602516026
#include <unistd.h>
1602616027

16027-
int main()
16028+
int main(void)
1602816029
{
1602916030
struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
1603016031
int poll_test;
@@ -16082,7 +16083,7 @@ else
1608216083
extern char *tzname[];
1608316084
#endif
1608416085

16085-
int main()
16086+
int main(void)
1608616087
{
1608716088
/* Note that we need to ensure that not only does tzset(3)
1608816089
do 'something' with localtime, but it works as documented
@@ -16843,9 +16844,10 @@ else
1684316844
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1684416845
/* end confdefs.h. */
1684516846

16847+
#include <stddef.h>
1684616848
#include <stdio.h>
16847-
#include<stdlib.h>
16848-
int main() {
16849+
#include <stdlib.h>
16850+
int main(void) {
1684916851
size_t len = -1;
1685016852
const char *str = "text";
1685116853
len = mbstowcs(NULL, str, 0);
@@ -17022,7 +17024,7 @@ else
1702217024
#include <stdlib.h>
1702317025
#include <string.h>
1702417026
void foo(void *p, void *q) { memmove(p, q, 19); }
17025-
int main() {
17027+
int main(void) {
1702617028
char a[32] = "123456789000000000";
1702717029
foo(&a[9], a);
1702817030
if (strcmp(a, "123456789123456789000000000") != 0)
@@ -17077,7 +17079,7 @@ else
1707717079
);
1707817080
return r;
1707917081
}
17080-
int main() {
17082+
int main(void) {
1708117083
int p = 8;
1708217084
if ((foo(&p) ? : p) != 6)
1708317085
return 1;
@@ -17116,7 +17118,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1711617118
#include <stdatomic.h>
1711717119
atomic_int int_var;
1711817120
atomic_uintptr_t uintptr_var;
17119-
int main() {
17121+
int main(void) {
1712017122
atomic_store_explicit(&int_var, 5, memory_order_relaxed);
1712117123
atomic_store_explicit(&uintptr_var, 0, memory_order_relaxed);
1712217124
int loaded_value = atomic_load_explicit(&int_var, memory_order_seq_cst);
@@ -17149,9 +17151,10 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1714917151
/* end confdefs.h. */
1715017152

1715117153

17152-
volatile int val = 1;
17153-
int main() {
17154-
__atomic_load_n(&val, __ATOMIC_SEQ_CST);
17154+
int val;
17155+
int main(void) {
17156+
__atomic_store_n(&val, 1, __ATOMIC_SEQ_CST);
17157+
(void)__atomic_load_n(&val, __ATOMIC_SEQ_CST);
1715517158
return 0;
1715617159
}
1715717160

@@ -17208,7 +17211,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1720817211

1720917212
#include <dirent.h>
1721017213

17211-
int main() {
17214+
int main(void) {
1721217215
struct dirent entry;
1721317216
return entry.d_type == DT_UNKNOWN;
1721417217
}
@@ -17238,11 +17241,12 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1723817241
/* end confdefs.h. */
1723917242

1724017243

17244+
#include <stddef.h>
1724117245
#include <unistd.h>
1724217246
#include <sys/syscall.h>
1724317247
#include <linux/random.h>
1724417248

17245-
int main() {
17249+
int main(void) {
1724617250
char buffer[1];
1724717251
const size_t buflen = sizeof(buffer);
1724817252
const int flags = GRND_NONBLOCK;
@@ -17277,9 +17281,10 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1727717281
/* end confdefs.h. */
1727817282

1727917283

17284+
#include <stddef.h>
1728017285
#include <sys/random.h>
1728117286

17282-
int main() {
17287+
int main(void) {
1728317288
char buffer[1];
1728417289
const size_t buflen = sizeof(buffer);
1728517290
const int flags = 0;

0 commit comments

Comments
 (0)