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

From: Paul Eggert <[email-masked]>
Date: Sun, 12 May 2024 12:18:53 -0700

On 2024-05-12 10:16, Eli Zaretskii wrote:

>> Oh, I hadn't seen that. Yep, with this flag the configure script's
>> errors turn into warnings and subsequent the compilation error is
>> gone.
> 
> Then I guess we should use that on MS-Windows when running the
> configure script.  Paul, is there a better way.

In the short run, having 'configure' use 
-Wno-error=implicit-function-declaration on MS-Windows should work 
around the issue. Eventually, though, I suspect it'll cause further 
problems, as the C standard indeed prohibits implicit function declarations.

We ran into this problem with Autoconf a while back, and we fixed it by 
supplying the missing decls. Emacs might be better off doing something 
similar, by adding the missing declarations to nt/inc/sys/wait.h. After 
all, the 'configure' diagnostic:

    checking for sys/wait.h that is POSIX.1 compatible.... no

is correct, as nt/inc/sys/wait.h doesn't declare 'wait' as POSIX 
requires. I realize this will be a bit of a hassle, but it shouldn't be 
much hassle and in the long run I expect it to be less hassle than using 
-Wno-error=implicit-function-declaration.

> My recommendation is to wait until GCC 14.2
> is released, and in the meantime stay with GCC 13.

I've had good luck building Emacs with gcc (GCC) 14.0.1 20240411 (Red 
Hat 14.0.1-0) on x86-64, in the sense that the only compiler bug I ran 
into was also present in GCC 13 and the bug didn't cause a serious 
problem with Emacs.

I would not be surprised if GCC 14 is buggier on MS-Windows, though.