Re: [systemd-devel] Warnings from recent commits

2014-08-14 Thread Lennart Poettering
On Mon, 21.07.14 16:09, Samuli Suominen (ssuomi...@gentoo.org) wrote:

 
 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

I am fine with supporting gcc 4.5. This patch really looks like it could
be turned into something upstreamable. I mean, we already have a manual
fallback for assert_cc(), so it shouldn't be too hard to figure
something out that works on gcc 4.5. I mean, i think it would be totally
OK to throw warnings on gcc 4.5, as long as it compiles. And the
DISABLE_WARNING_xyz stuff is really only stuff to make warnings go away,
that is all...

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Warnings from recent commits

2014-07-21 Thread Thomas H.P. Andersen
On Mon, Jul 21, 2014 at 4:18 AM, Zbigniew Jędrzejewski-Szmek
zbys...@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.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Warnings from recent commits

2014-07-20 Thread Zbigniew Jędrzejewski-Szmek
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.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Warnings from recent commits

2014-07-19 Thread Thomas H.P. Andersen
On Thu, Jul 17, 2014 at 8:51 PM, Thomas H.P. Andersen pho...@gmail.com 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);

Zbigniew dealt with 2) in 901fd8164797f3eeb9921c85915dc409d49ab5d8.

 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;
 ^
 1 warning generated.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Warnings from recent commits

2014-07-19 Thread David Herrmann
Hi

On Thu, Jul 17, 2014 at 8:51 PM, Thomas H.P. Andersen pho...@gmail.com 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.

This is a false-positive. poll() must return 0 in our case, so either
revents must be set. I added else continue; to suppress this
warning.

Thanks!
David

 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;
 ^
 1 warning generated.
 ___
 systemd-devel mailing list
 systemd-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/systemd-devel
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Warnings from recent commits

2014-07-17 Thread Thomas H.P. Andersen
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;
^
1 warning generated.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel