dhcpcd-discuss

Re: git master: compiler warnings

Roy Marples

Thu Oct 05 08:26:19 2017

On 04/10/2017 18:02, Roy Marples wrote:
> On 04/10/2017 00:07, Roy Marples wrote:
> c) src/ipv4.c
> ipv4.c: In function ‘inet_getroutes’:
> ipv4.c:436:6: warning: assuming signed overflow does not occur when
> simplifying conditional to constant [-Wstrict-overflow]
>    if (inet_routerhostroute(routes, ifp) == -1)
>       ^
> 
> d) src/ipv6.c
> ipv6.c: In function ‘inet6_getroutes’:
> ipv6.c:2313:5: warning: assuming signed overflow does not occur when
> simplifying conditional to constant [-Wstrict-overflow]
>   if (inet6_staticroutes(routes, ctx) == -1)
> 
> I still think these are gcc bugs, but I'll try and look into them a
> little more.

OK, I understand the QA warning now.
I could just change int to ssize_t and the warning magically vanishes
(that in itself is a gcc bug), but that doesn't fix it really.
Because we only really care about the error state and not the number of
added routes for that part, we only return a 0 or -1 value now and the
warning vanishes.

So as of now, the only compile time warnings are due to crappy system
headers which you should try and push upstream.

Roy

References:
git master: compiler warningsM. Buecher
Re: git master: compiler warningsRoy Marples
Re: git master: compiler warningsRoy Marples
Archive administrator: postmaster@marples.name