From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12586 Path: news.gmane.org!.POSTED!not-for-mail From: Jacob Welsh Newsgroups: gmane.linux.lib.musl.general Subject: Re: Using macro CMSG_NXTHDR generates warnings with CLANG Date: 6 Mar 2018 17:16:14 -0000 Message-ID: <20180306171614.9011.qmail@welshcomputing.com> References: <20161011164644.GJ19318@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1520356849 21390 195.159.176.226 (6 Mar 2018 17:20:49 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 6 Mar 2018 17:20:49 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-12602-gllmg-musl=m.gmane.org@lists.openwall.com Tue Mar 06 18:20:45 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1etGGS-0004Bn-9D for gllmg-musl@m.gmane.org; Tue, 06 Mar 2018 18:20:36 +0100 Original-Received: (qmail 1902 invoked by uid 550); 6 Mar 2018 17:22:38 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 26103 invoked from network); 6 Mar 2018 17:17:08 -0000 In-Reply-To: <20161011164644.GJ19318@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:12586 Archived-At: Rich Felker wrote: > On Tue, Oct 11, 2016 at 06:43:21PM +0200, Szabolcs Nagy wrote: > > * Jan Vorlicek [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 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