Re: git master: compiler warnings
Roy Marples
Wed Oct 04 17:02:49 2017
On 04/10/2017 00:07, Roy Marples wrote:
>> a) src/common.c
>> common.c: In function ‘recvmsg_realloc’:
>> common.c:240:9: warning: negative integer implicitly converted to
>> unsigned type [-Wsign-conversion]
>> len = roundup(len, IOVEC_BUFSIZ);
>
> Might be fixable.
This is an error with glibc.
https://sourceware.org/git/?p=glibc.git;a=blob;f=misc/sys/param.h;h=97216135f29beea91ec5a155d60a3ea789b843b6;hb=refs/heads/master#l92
#ifdef __GNUC__
# define roundup(x, y) (__builtin_constant_p (y) && powerof2 (y)
\
? (((x) + (y) - 1) & ~((y) - 1))
\
: ((((x) + ((y) - 1)) / (y)) * (y)))
#else
# define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
#endif
Because __GNUC__ is defined, the former is hit and the warning is produced.
If I unset it in that file, the latter is used like on other libc's and
the warning vanishes.
Tell glibc folks to fix their foo.
I think that's all the compilter warnings addressed in some form or
other now aside from:
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.
PS - I comitted a fix for a new warning in gcc-7.4.0 which is very
stupid in assuming that the buffer to print sun_path into must be big
enough to hold the full sun_path. This is wrong, because the path is
limited via pre-defined fixed sizes. The irony is that dhcpcd is
actually smaller as it now has a strlcpy(3) implementation rather than
abusing snprintf.
Roy
Archive administrator: postmaster@marples.name