Subject: bug#70889: 29.3; GCC14.1 MinGW compilation error

From: Eli Zaretskii <[email-masked]>
Date: Sun, 12 May 2024 17:49:40 +0300

> Date: Sun, 12 May 2024 14:52:12 +0200
> Cc: [email-masked]
> From: Cyril Arnould <[email-masked]>
> 
>  > So please try to figure out how come HAVE_SYS_WAIT_H is not defined in
>  > your case.  It should be.
> 
> I see, I was not aware that HAVE_SYS_WAIT_H should be defined. It's
> the ./configure test that fails, the log is as follows:
> 
> configure:11647: checking for sys/wait.h that is POSIX.1 compatible
> configure:11674: gcc -I ./nt/inc -c -g3 -O2 -gdwarf-2 -mtune=generic   
> conftest.c >&5
> conftest.c: In function 'main':
> conftest.c:69:3: error: implicit declaration of function 'wait' 
> [-Wimplicit-function-declaration]
>     69 |   wait (&s);
>        |   ^~~~
> configure:11674: $? = 1
> configure: failed program was:
> | /* confdefs.h */

I don't understand something: -Wimplicit-function-declaration is a
_warning_ option, so how come it causes an error?  Is -Werror also in
effect or something?  If so, we just need to add -Wno-error to the
compiler options.  Warnings should not fail test programs.

> Is this an issue that should be solved by GNU autoconf? Or should the
> 'wait' function be added to nt/inc/sys/wait.h?

If we need to add to our w32 headers every single function that can
fail the compilation of some test program, we will never recover from
this slippery slope.  So I'd like first to understand why a warning
causes a compilation error.

> More worrying, I've checked through the config.log and found 28
> occurences of the "implicit declaration of function XY" error. The
> <sys/wait.h> test might not be the only one that works under GCC 13
> but fails under GCC 14.

Of course.  There'll be no end to this madness.