Skip to content

Commit 807b103

Browse files
authored
[3.10] GH-99086: Fix -Wstrict-prototypes, -Wimplicit-function-declara… (#99920)
[3.10] gh-99086: Fix -Wstrict-prototypes, -Wimplicit-function-declaration warnings in configure.ac (GH-99406) Follow up to 12078e7. (cherry picked from commit e35ca41) Co-authored-by: Sam James <sam@gentoo.org>
1 parent 80f4624 commit 807b103

File tree

3 files changed

+57
-48
lines changed

3 files changed

+57
-48
lines changed
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

+28-24
Original file line numberDiff line numberDiff line change
@@ -5929,7 +5929,7 @@ if test "x$enable_profiling" = xyes; then
59295929
CC="$CC -pg"
59305930
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
59315931
/* end confdefs.h. */
5932-
int main() { return 0; }
5932+
int main(void) { return 0; }
59335933
_ACEOF
59345934
if ac_fn_c_try_link "$LINENO"; then :
59355935

@@ -7752,7 +7752,7 @@ else
77527752

77537753
void* routine(void* p){return NULL;}
77547754

7755-
int main(){
7755+
int main(void){
77567756
pthread_t p;
77577757
if(pthread_create(&p,NULL,routine,NULL)!=0)
77587758
return 1;
@@ -7808,7 +7808,7 @@ else
78087808

78097809
void* routine(void* p){return NULL;}
78107810

7811-
int main(){
7811+
int main(void){
78127812
pthread_t p;
78137813
if(pthread_create(&p,NULL,routine,NULL)!=0)
78147814
return 1;
@@ -7858,7 +7858,7 @@ else
78587858

78597859
void* routine(void* p){return NULL;}
78607860

7861-
int main(){
7861+
int main(void){
78627862
pthread_t p;
78637863
if(pthread_create(&p,NULL,routine,NULL)!=0)
78647864
return 1;
@@ -7908,7 +7908,7 @@ else
79087908

79097909
void* routine(void* p){return NULL;}
79107910

7911-
int main(){
7911+
int main(void){
79127912
pthread_t p;
79137913
if(pthread_create(&p,NULL,routine,NULL)!=0)
79147914
return 1;
@@ -10447,7 +10447,7 @@ else
1044710447
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1044810448
/* end confdefs.h. */
1044910449

10450-
int main()
10450+
int main(void)
1045110451
{
1045210452
char s[16];
1045310453
int i, *p1, *p2;
@@ -11024,6 +11024,7 @@ $as_echo_n "checking for pthread_create in -lpthread... " >&6; }
1102411024
/* end confdefs.h. */
1102511025

1102611026
#include <stdio.h>
11027+
#include <stdlib.h>
1102711028
#include <pthread.h>
1102811029

1102911030
void * start_routine (void *arg) { exit (0); }
@@ -11325,7 +11326,7 @@ else
1132511326
void *foo(void *parm) {
1132611327
return NULL;
1132711328
}
11328-
int main() {
11329+
int main(void) {
1132911330
pthread_attr_t attr;
1133011331
pthread_t id;
1133111332
if (pthread_attr_init(&attr)) return (-1);
@@ -12687,7 +12688,7 @@ else
1268712688

1268812689
#include <sys/stat.h>
1268912690
#include <unistd.h>
12690-
int main(int argc, char*argv[])
12691+
int main(int argc, char *argv[])
1269112692
{
1269212693
if(chflags(argv[0], 0) != 0)
1269312694
return 1;
@@ -12736,7 +12737,7 @@ else
1273612737

1273712738
#include <sys/stat.h>
1273812739
#include <unistd.h>
12739-
int main(int argc, char*argv[])
12740+
int main(int argc, char *argv[])
1274012741
{
1274112742
if(lchflags(argv[0], 0) != 0)
1274212743
return 1;
@@ -13653,7 +13654,7 @@ else
1365313654
#include <sys/socket.h>
1365413655
#include <netinet/in.h>
1365513656

13656-
int main()
13657+
int main(void)
1365713658
{
1365813659
int passive, gaierr, inet4 = 0, inet6 = 0;
1365913660
struct addrinfo hints, *ai, *aitop;
@@ -14880,7 +14881,7 @@ else
1488014881

1488114882
#include <stdlib.h>
1488214883
#include <math.h>
14883-
int main() {
14884+
int main(void) {
1488414885
volatile double x, y, z;
1488514886
/* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
1488614887
x = 0.99999999999999989; /* 1-2**-53 */
@@ -15730,7 +15731,7 @@ else
1573015731
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1573115732
/* end confdefs.h. */
1573215733

15733-
int main()
15734+
int main(void)
1573415735
{
1573515736
return (((-1)>>3 == -1) ? 0 : 1);
1573615737
}
@@ -16178,7 +16179,7 @@ else
1617816179

1617916180
#include <stdlib.h>
1618016181
#include <unistd.h>
16181-
int main()
16182+
int main(void)
1618216183
{
1618316184
int val1 = nice(1);
1618416185
if (val1 != -1 && val1 == nice(2))
@@ -16221,7 +16222,7 @@ else
1622116222
#include <poll.h>
1622216223
#include <unistd.h>
1622316224

16224-
int main()
16225+
int main(void)
1622516226
{
1622616227
struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
1622716228
int poll_test;
@@ -16279,7 +16280,7 @@ else
1627916280
extern char *tzname[];
1628016281
#endif
1628116282

16282-
int main()
16283+
int main(void)
1628316284
{
1628416285
/* Note that we need to ensure that not only does tzset(3)
1628516286
do 'something' with localtime, but it works as documented
@@ -17040,9 +17041,10 @@ else
1704017041
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1704117042
/* end confdefs.h. */
1704217043

17044+
#include <stddef.h>
1704317045
#include <stdio.h>
17044-
#include<stdlib.h>
17045-
int main() {
17046+
#include <stdlib.h>
17047+
int main(void) {
1704617048
size_t len = -1;
1704717049
const char *str = "text";
1704817050
len = mbstowcs(NULL, str, 0);
@@ -17219,7 +17221,7 @@ else
1721917221
#include <stdlib.h>
1722017222
#include <string.h>
1722117223
void foo(void *p, void *q) { memmove(p, q, 19); }
17222-
int main() {
17224+
int main(void) {
1722317225
char a[32] = "123456789000000000";
1722417226
foo(&a[9], a);
1722517227
if (strcmp(a, "123456789123456789000000000") != 0)
@@ -17274,7 +17276,7 @@ else
1727417276
);
1727517277
return r;
1727617278
}
17277-
int main() {
17279+
int main(void) {
1727817280
int p = 8;
1727917281
if ((foo(&p) ? : p) != 6)
1728017282
return 1;
@@ -17313,7 +17315,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1731317315
#include <stdatomic.h>
1731417316
atomic_int int_var;
1731517317
atomic_uintptr_t uintptr_var;
17316-
int main() {
17318+
int main(void) {
1731717319
atomic_store_explicit(&int_var, 5, memory_order_relaxed);
1731817320
atomic_store_explicit(&uintptr_var, 0, memory_order_relaxed);
1731917321
int loaded_value = atomic_load_explicit(&int_var, memory_order_seq_cst);
@@ -17347,7 +17349,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1734717349

1734817350

1734917351
int val;
17350-
int main() {
17352+
int main(void) {
1735117353
__atomic_store_n(&val, 1, __ATOMIC_SEQ_CST);
1735217354
(void)__atomic_load_n(&val, __ATOMIC_SEQ_CST);
1735317355
return 0;
@@ -17406,7 +17408,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1740617408

1740717409
#include <dirent.h>
1740817410

17409-
int main() {
17411+
int main(void) {
1741017412
struct dirent entry;
1741117413
return entry.d_type == DT_UNKNOWN;
1741217414
}
@@ -17436,11 +17438,12 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1743617438
/* end confdefs.h. */
1743717439

1743817440

17441+
#include <stddef.h>
1743917442
#include <unistd.h>
1744017443
#include <sys/syscall.h>
1744117444
#include <linux/random.h>
1744217445

17443-
int main() {
17446+
int main(void) {
1744417447
char buffer[1];
1744517448
const size_t buflen = sizeof(buffer);
1744617449
const int flags = GRND_NONBLOCK;
@@ -17475,9 +17478,10 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1747517478
/* end confdefs.h. */
1747617479

1747717480

17481+
#include <stddef.h>
1747817482
#include <sys/random.h>
1747917483

17480-
int main() {
17484+
int main(void) {
1748117485
char buffer[1];
1748217486
const size_t buflen = sizeof(buffer);
1748317487
const int flags = 0;

0 commit comments

Comments
 (0)