[systemd-devel] Warnings from recent commits

Samuli Suominen ssuominen at gentoo.org
Mon Jul 21 06:09:50 PDT 2014


On 21/07/14 16:05, Thomas H.P. Andersen wrote:
> On Mon, Jul 21, 2014 at 4:18 AM, Zbigniew Jędrzejewski-Szmek
> <zbyszek at in.waw.pl> wrote:
>> On Thu, Jul 17, 2014 at 08:51:52PM +0200, Thomas H.P. Andersen wrote:
>>> From recent commits I have noticed the following new issues from
>>> static analysis with scan-build and with clang. I am not sure how they
>>> should be fixed (or even if) but I just though I would let you know.
>>>
>>> 1) src/shared/barrier.c in barrier_read starting at line 274
>>>
>>> if (pfd[1].revents) {
>>>         len = read(b->them, &buf, sizeof(buf));
>>>         ...
>>> } else if (pfd[0].revents & (POLLHUP | POLLERR | POLLNVAL)) {
>>>         ...
>>>         buf = BARRIER_ABORTION;
>>> }
>>>
>>> If neither if/else if are true then buf will be used unset.
>>>
>>> 2) src/resolve/resolved-dns-scope.c in dns_scope_tcp_socket
>>> if s->link is null then ifindex will not be set but will be used later in:
>>>
>>> } else if (srv->family == AF_INET6) {
>>>         sa.in6.sin6_port = htobe16(53);
>>>         sa.in6.sin6_addr = srv->address.in6;
>>>         sa.in6.sin6_scope_id = ifindex;
>>>         salen = sizeof(sa.in6);
>>>
>>> 3) I see a couple of these:
>>>
>>> In file included from src/resolve/resolved-gperf.c:8:
>>> In file included from ./src/resolve/resolved.h:34:
>>> In file included from ./src/resolve/resolved-dns-query.h:33:
>>> In file included from ./src/resolve/resolved-dns-scope.h:33:
>>> ./src/resolve/resolved-dns-cache.h:45:3: warning: redefinition of
>>> typedef 'DnsCacheItem' is a C11 feature [-Wtypedef-redefinition]
>>> } DnsCacheItem;
>>>   ^
>>> ./src/resolve/resolved-dns-cache.h:31:29: note: previous definition is here
>>> typedef struct DnsCacheItem DnsCacheItem;
>> I'd simply add -Wno-typedef-redefinition to CLAGS... This is one
>> of those cases where the medicine is worse than the disease.
> Fine by me. Typedef redefinition was added in gcc 4.6 so we will need that.
>

4.6 is the minimum dependency as-is, for eg. _Static_assert,
DISABLE_WARNING_{DECLARATION_AFTER_STATEMENT,FORMAT_NONLITERAL,MISSING_PROTOTYPES,NONNULL},
REENABLE_WARNING
Just to get the udev part of the systemd tree compiled with gcc-4.5 or
older, you need something like,
http://510524.bugs.gentoo.org/attachment.cgi?id=380992

Just saying, that 4.6 minimum wouldn't be a new thing, it's been around
for several releases now

- Samuli


More information about the systemd-devel mailing list