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

Simon Kelley simon at thekelleys.org.uk
Thu Jan 23 12:38:43 UTC 2025



On 1/23/25 11:29, Petr Menšík wrote:
> 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
> 
> 
>



da2cc84854a01dd08a8bb4161428be20b83a5ec7 and 
a664c03db4f4d4ce6bf4af6d83c33a8906b3e65 fix this, I think

Cheers,

Simon.



More information about the Dnsmasq-discuss mailing list