[Dnsmasq-discuss] iface_enumerate does not compile with gcc 15

Petr Menšík pemensik at redhat.com
Thu Jan 23 11:29:24 UTC 2025


Hello everyone!

Fedora just changed to gcc 15 in upcoming Fedora 42. And it seems 
dnsmasq is not able to compile [1][2] with the new compiler, like it 
could before. Example error is:

dhcp.c: In function ‘dhcp_packet’:
dhcp.c:320:49: error: passing argument 3 of ‘iface_enumerate’ from incompatible pointer type [-Wincompatible-pointer-types]
   320 |               !iface_enumerate(AF_INET, &match, check_listen_addrs) ||
       |                                                 ^~~~~~~~~~~~~~~~~~
       |                                                 |
       |                                                 int (*)(struct in_addr,  int,  char *, struct in_addr,  struct in_addr,  void *)

That is because the default compiler used -std version has changed to 
gnu23. There is a nice page with porting instructions for that version 
[3], which mentions full handler specification should be used before 
calling.

Our problem is iface_enumerate uses callbacks with different prototypes, 
depending on family passed to the function. It seems to me ideal change 
would be to make separate functions with just reused common parts. 
Because they have something in common, but are significantly different 
at the same time. It does not seem possible to have single prototype 
function callback for the current code.

I am not sending a patch yet, because I am not sure how exactly it 
should be changed. Of course temporary alternative would be explicitly 
using older -std=gnu17 in CFLAGS. But I think some other change should 
be made, but not yet sure what is should be.

Any opinions? Has anyone else hit already gcc 15 new issues?

Cheers,
Petr

1. https://bugzilla.redhat.com/show_bug.cgi?id=2340085
2. https://kojipkgs.fedoraproject.org//work/tasks/5223/127945223/build.log
3. https://gcc.gnu.org/gcc-15/porting_to.html#c23
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20250123/2f6f41f5/attachment-0001.htm>


More information about the Dnsmasq-discuss mailing list