On 03 Mar 2015 21:46, Dmitry V. Levin wrote:
> On Tue, Mar 03, 2015 at 01:23:53PM -0500, Mike Frysinger wrote:
> > On 03 Mar 2015 21:01, Dmitry V. Levin wrote:
> > > On Tue, Mar 03, 2015 at 12:47:19PM -0500, Mike Frysinger wrote:
> > > > build warnings:
> > > > there's still random -Wsign-compare warnings, but i guess we don't care
> > > > about those
> > > 
> > > There are exactly 3 different -Wsign-compare warning messages:
> > > socketutils.c:145: warning: comparison between signed and unsigned 
> > > integer expressions [-Wsign-compare]
> > > netlink_inet_diag.c:67: warning: comparison between signed and unsigned 
> > > integer expressions [-Wsign-compare]
> > > netlink_unix_diag.c:75: warning: comparison between signed and unsigned 
> > > integer expressions [-Wsign-compare]
> > > 
> > > The only way to fix them is to fix NLMSG_OK macro defined
> > > in <linux/netlink.h>.
> > 
> > hmm, i'm not so sure.  the kernel headers declare:
> > struct nlmsghdr {
> >     __u32           nlmsg_len;      /* Length of message including header */
> > ...
> > #define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \
> >                        (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
> >                        (nlh)->nlmsg_len <= (len))
> > 
> > and the strace code does:
> >             ssize_t ret;
> >             struct nlmsghdr *h;
> >             ...
> >                  NLMSG_OK(h, ret);
> > 
> > if the kernel headers provided a function instead of a macro, it'd be:
> > static bool NLMSG_OK(const struct nlmsghdr *nlh, __u32 len) {...}
> > 
> > which is to say, the API of this macro is that it takes a u32 len, but 
> > we're 
> > passing it a ssize_t (as that is what recvmsg/etc... returns).  it is 
> > annoying 
> > that there's a type mismatch here, but i think the problem is still on our 
> > side 
> > to sort out:
> >     NLMSG_OK(h, (size_t)ret)
> 
> If we pass (size_t)ret to NLMSG_OK, it would result to
>       ((size_t)ret) >= (int)sizeof(struct nlmsghdr)
> and this code generates the same -Wsign-compare warning.
> I actually tried it some time ago.

blah lame.  i'll try sending a patch upstream and see what they say.
-mike

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to