From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10622 Path: news.gmane.org!.POSTED!not-for-mail From: Jan Vorlicek Newsgroups: gmane.linux.lib.musl.general Subject: RE: Using macro CMSG_NXTHDR generates warnings with CLANG Date: Tue, 11 Oct 2016 15:25:24 +0000 Message-ID: References: <20161011150901.GG19318@brightrain.aerifal.cx> <20161011152237.GI19318@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1476199561 30991 195.159.176.226 (11 Oct 2016 15:26:01 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 11 Oct 2016 15:26:01 +0000 (UTC) To: "musl@lists.openwall.com" Original-X-From: musl-return-10635-gllmg-musl=m.gmane.org@lists.openwall.com Tue Oct 11 17:25:54 2016 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 1btyvx-0005Q3-AT for gllmg-musl@m.gmane.org; Tue, 11 Oct 2016 17:25:37 +0200 Original-Received: (qmail 23918 invoked by uid 550); 11 Oct 2016 15:25: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 23900 invoked from network); 11 Oct 2016 15:25:37 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Dbj6fYanxCjKga9tlLZWffXWCpk3PQmQIqN13KKH0Sg=; b=Rm72logiBAcGEy+Qz2vrnMrBzO9n8nHKMxJZjlJwHZTRx5/YmG73rwhxVM01O2tHmlrxrHnqC7kp1qXfcG6xuXFmtB/dOAQsG16Q4s5gsehVfEnvZa46zY3ERBJNdAPB8ujujly6vWFzB+IJnjFqMf1BREMJf0LlR0NmqWOwI80= Thread-Topic: [musl] Using macro CMSG_NXTHDR generates warnings with CLANG Thread-Index: AdIjQRMXenHgQGEXSke2PXInrhIJgAAkFKyAAABOiAAAACsQgAAAFFaw In-Reply-To: <20161011152237.GI19318@brightrain.aerifal.cx> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=janvorli@microsoft.com; x-originating-ip: [89.177.13.111] x-ms-office365-filtering-correlation-id: 3b8a9db3-3598-4483-9297-08d3f1ead2c9 x-microsoft-exchange-diagnostics: 1;HE1PR83MB0059;7:N/gUegUaprAguhw4TYZAOsYpaPlvZmvoJwfZhAhdqXHUJSqun450BRV9R7nC2sqeluPOfCUjvUYVwg4CtW55FIN37nOvwUkNG1JB2yr1SYLewKpFHhZ0ZBoWLi302186CZ9c9lWMJ/GFmtvb4lP6niZgP+gXhP7yJ6oyJ9UP2sKoV6bN8+vAHvA0tXO3O8squdCMc7lr5THvJev++VvqgQ7jX8/BmjWRADuNtSS8k+Y7CGSnUd5Jmg+TvH5eJPkk0IMjgqJ5HaMlltm0c6wo3hQQL6QNzXGQU2LELV0KuIxZAVpf6eC7WSGrcF/J6f9Dwal1jb4iPlHLqNmud9cE9OVm9wbaEX5n+W24n41QZJF/dM8Rn2s6QzgcDwt/AONL x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HE1PR83MB0059; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(61426038)(61427038);SRVR:HE1PR83MB0059;BCL:0;PCL:0;RULEID:;SRVR:HE1PR83MB0059; x-forefront-prvs: 00922518D8 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(7916002)(377454003)(199003)(13464003)(189002)(24454002)(122556002)(110136003)(10290500002)(33656002)(86612001)(8990500004)(8676002)(107886002)(10400500002)(86362001)(10090500001)(76576001)(7696004)(5005710100001)(87936001)(81166006)(2950100002)(9686002)(6916009)(68736007)(5002640100001)(305945005)(2501003)(5660300001)(81156014)(189998001)(1730700003)(8936002)(7736002)(7846002)(74316002)(97736004)(66066001)(76176999)(54356999)(3660700001)(19580395003)(92566002)(2906002)(450100001)(101416001)(105586002)(6116002)(50986999)(11100500001)(19580405001)(586003)(2351001)(106356001)(102836003)(3846002)(93886004)(2900100001)(3280700002);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR83MB0059;H:HE1PR83MB0058.EURPRD83.prod.outlook.com;FPR:;SPF:None;PTR:In foNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Oct 2016 15:25:24.6035 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR83MB0059 Xref: news.gmane.org gmane.linux.lib.musl.general:10622 Archived-At: The simple repro was in my email - just cut and paste the 6 lines of code i= nto a file named nettest.cpp and then run clang++ -Weverything ./nettest.cp= p -c -o nettest.o. I have hit this issue on Alpine Linux 3.4.3 in a docker container. The same code compiles without any warnings with the same clang compiler e.= g. on Ubuntu 14.04 with glibc. I have noticed a difference though. On Alpin= e, the CMSG_NXTHDR is a macro defined in /usr/include/sys/socket.h. On Ubun= tu, it is defined in /usr/include/x86_64-linux-gnu/bits/socket.h. The defin= ition is also different: Alpine: #define CMSG_NXTHDR(mhdr, cmsg) ((cmsg)->cmsg_len < sizeof (struct cmsghdr)= || \ __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >=3D __MHDR_END(mhdr) - (= unsigned char *)(cmsg) \ ? 0 : (struct cmsghdr *)__CMSG_NEXT(cmsg)) Ubuntu: #define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg) Where the __cmsg_nxthdr is defined as an inline function in the same header= file as the CMSG_NXTHDR. Thanks, Jan -----Original Message----- From: Rich Felker [mailto:dalias@aerifal.cx] On Behalf Of Rich Felker Sent: Tuesday, October 11, 2016 5:23 PM To: musl@lists.openwall.com Subject: Re: [musl] Using macro CMSG_NXTHDR generates warnings with CLANG On Tue, Oct 11, 2016 at 06:17:48PM +0300, Alexander Monakov wrote: > On Tue, 11 Oct 2016, Rich Felker wrote: > > As these are system headers, the compiler should not be producing=20 > > any warnings from them. If it does that's a compiler bug. Are you=20 > > perhaps using an odd setup where musl's headers aren't in the=20 > > default system include path but instead passed in via -I rather than=20 > > -isystem? If you have a minimal test file I could see if the same=20 > > warnings appear with clang on Alpine Linux. >=20 > As mentioned on IRC some time ago, Clang suppresses warnings in macros=20 > expanded from definitions in system headers on a case-by-case basis,=20 > i.e. some warnings are suppressed (if someone deliberately enabled=20 > suppression), some are not. As seen here, -Wcast-align is among those war= nings that are not suppressed. Ah. I think this should just be considered a clang bug then... Rich