|
|
Message-ID: <20180306171614.9011.qmail@welshcomputing.com>
Date: 6 Mar 2018 17:16:14 -0000
From: Jacob Welsh <jacob+musl@...shcomputing.com>
To: musl@...ts.openwall.com
Subject: Re: Using macro CMSG_NXTHDR generates warnings with CLANG
Rich Felker wrote:
> On Tue, Oct 11, 2016 at 06:43:21PM +0200, Szabolcs Nagy wrote:
> > * Jan Vorlicek <janvorli@...rosoft.com> [2016-10-11 15:38:38 +0000]:
> > > My test was a c++ code :-). That's why the struct was not there.
> > >
> >
> > don't top post.
> >
> > including sys/socket.h (or any posix header) in c++ code is undefined
> > (neither iso c++ nor posix defines the behaviour) so you are on your own.
>
> C++ isn't the issue here. The header is obviously expected to work in
> C++, even though there's no formal spec for it (although of course you
> should have extern "C" around it). The issue at hand is the clang
> warnings and I think they happen just the same in equivalent C code.
Reviving this thread to confirm this does come up in C code, including
with GCC 4.7 for one of the two warnings:
#include <sys/socket.h>
struct cmsghdr *test(struct msghdr *m, struct cmsghdr *c) {
return CMSG_NXTHDR(m,c);
}
$ gcc -c cmsg.c -Wall -Wextra
cmsg.c: In function 'test':
cmsg.c:3:12: warning: comparison between signed and unsigned integer
expressions [-Wsign-compare]
I came across this in nginx which uses -Werror by default.
J. Welsh
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.