Subject: bug#78160: closed (Re: bug#78160: Emacs fail to build with GCC 15)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 30 Apr 2025 11:18:02 +0000

Your bug report

#78160: Emacs fail to build with GCC 15

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
78160: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78160
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#78160: Emacs fail to build with GCC 15
From: Eli Zaretskii <[email-masked]>
To: MAN ONE <[email-masked]>
Cc: [email-masked]
Date: Wed, 30 Apr 2025 14:17:27 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: MAN ONE <[email-masked]>
> CC: "[email-masked]" <[email-masked]>
> Date: Wed, 30 Apr 2025 11:02:26 +0000
> msip_labels:
> 
> The second patch produce no compilation error or warnings, emacsclient.exe and emacsclientw.exe also working, I think the second patch does the trick.

Thanks, installed on both the emacs-30 and the master branch, and
closing this bug.

As for the other warnings, feel free to submit a separate bug report
with them, so we could consider how and on which branch to fix them.

Subject: Emacs fail to build with GCC 15
From: MAN ONE <[email-masked]>
To: "[email-masked]" <[email-masked]>
Date: Wed, 30 Apr 2025 04:38:42 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Earlier this week Msys2 upgraded GCC to version 15.1.0, which lead to this build error:

emacsclient.c:1718:9: warning: no previous declaration for 'set_fg' [-Wmissing-variable-de
clarations]
 1718 | FARPROC set_fg;  /* Pointer to AllowSetForegroundWindow.  */
      |         ^~~~~~
emacsclient.c:1719:9: warning: no previous declaration for 'get_wc' [-Wmissing-variable-de
clarations]
 1719 | FARPROC get_wc;  /* Pointer to RealGetWindowClassA.  */
      |         ^~~~~~
emacsclient.c: In function 'w32_find_emacs_process':
emacsclient.c:1759:9: error: too many arguments to function 'get_wc'; expected 0, have 3
 1759 |   if (! get_wc (hWnd, class, sizeof (class))
      |         ^~~~~~  ~~~~
emacsclient.c:1770:3: error: too many arguments to function 'set_fg'; expected 0, have 1
 1770 |   set_fg (emacs_pid);
      |   ^~~~~~  ~~~~~~~~~
emacsclient.c:1718:9: warning: no previous declaration for 'set_fg' [-Wmissing-variable-de
clarations]
 1718 | FARPROC set_fg;  /* Pointer to AllowSetForegroundWindow.  */
      |         ^~~~~~
emacsclient.c:1719:9: warning: no previous declaration for 'get_wc' [-Wmissing-variable-de
clarations]
 1719 | FARPROC get_wc;  /* Pointer to RealGetWindowClassA.  */
      |         ^~~~~~
emacsclient.c: In function 'w32_find_emacs_process':
emacsclient.c:1759:9: error: too many arguments to function 'get_wc'; expected 0, have 3
 1759 |   if (! get_wc (hWnd, class, sizeof (class))
      |         ^~~~~~  ~~~~
emacsclient.c:1770:3: error: too many arguments to function 'set_fg'; expected 0, have 1
 1770 |   set_fg (emacs_pid);
      |   ^~~~~~  ~~~~~~~~~
make[2]: *** [Makefile:446: emacsclientw.exe] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [Makefile:439: emacsclient.exe] Error 1
make[2]: Leaving directory '/e/home/repo/emacs/lib-src'
make[1]: *** [Makefile:529: lib-src] Error 2
make[1]: *** Waiting for unfinished jobs....

I think the cause is GCC 15 now use C23 by default[1], and appending ` -std=gnu17 ` compiler flag does solve the problem.

[1]https://gcc.gnu.org/gcc-15/porting_to.html#c23