From: Jacob Welsh <jacob+musl@welshcomputing.com>
To: musl@lists.openwall.com
Subject: Re: Using macro CMSG_NXTHDR generates warnings with CLANG
Date: 6 Mar 2018 17:16:14 -0000 [thread overview]
Message-ID: <20180306171614.9011.qmail@welshcomputing.com> (raw)
In-Reply-To: <20161011164644.GJ19318@brightrain.aerifal.cx>
Rich Felker wrote:
> On Tue, Oct 11, 2016 at 06:43:21PM +0200, Szabolcs Nagy wrote:
> > * Jan Vorlicek <janvorli@microsoft.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
prev parent reply other threads:[~2018-03-06 17:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-10 22:09 Jan Vorlicek
2016-10-11 14:45 ` Markus Wichmann
2016-10-11 15:09 ` Rich Felker
2016-10-11 15:17 ` Alexander Monakov
2016-10-11 15:22 ` Rich Felker
2016-10-11 15:25 ` Jan Vorlicek
2016-10-11 15:31 ` Szabolcs Nagy
2016-10-11 15:38 ` Jan Vorlicek
2016-10-11 16:43 ` Szabolcs Nagy
2016-10-11 16:46 ` Rich Felker
2018-03-06 17:16 ` Jacob Welsh [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180306171614.9011.qmail@welshcomputing.com \
--to=jacob+musl@welshcomputing.com \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).