From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10617 Path: news.gmane.org!.POSTED!not-for-mail From: Jan Vorlicek Newsgroups: gmane.linux.lib.musl.general Subject: Using macro CMSG_NXTHDR generates warnings with CLANG Date: Mon, 10 Oct 2016 22:09:38 +0000 Message-ID: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_000_HE1PR83MB0058EC22A38BBBAE5E0DA1AECADB0HE1PR83MB0058EURP_" X-Trace: blaine.gmane.org 1476137440 15673 195.159.176.226 (10 Oct 2016 22:10:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 10 Oct 2016 22:10:40 +0000 (UTC) To: "musl@lists.openwall.com" Original-X-From: musl-return-10630-gllmg-musl=m.gmane.org@lists.openwall.com Tue Oct 11 00:10:36 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 1btimH-0003Gs-H2 for gllmg-musl@m.gmane.org; Tue, 11 Oct 2016 00:10:33 +0200 Original-Received: (qmail 19777 invoked by uid 550); 10 Oct 2016 22:10:32 -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 19538 invoked from network); 10 Oct 2016 22:09:53 -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=W1zp+6dAy+wX97yW3aJoCa+Fpu3/ETIFEvM9kXYJORc=; b=ilFrERv/mLgwR/ezYCOwpv8lz4yLCz0Tkdt9PX8fFQMrlWS2KbL9hfrhHqFNKfLo4F9Z/lXfTQAKMSSdHoGVmV4RFdq39kNl1XYP/uGDjHNJKI4rxGtXNw3aRHEpluzpkDxWyBmHfff0Zojfs/otl1vdv3vgPUGGvJcDUcF14M8= Thread-Topic: Using macro CMSG_NXTHDR generates warnings with CLANG Thread-Index: AdIjQRMXenHgQGEXSke2PXInrhIJgA== 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: 06f9dc41-9b3b-4106-033b-08d3f15a2106 x-microsoft-exchange-diagnostics: 1;HE1PR83MB0059;7:6gbguzD7WXZPodGsS0pZ4q1w/FO5W5XTobKF5xBmprNnXHWEMdw4D2eHM4El48a2WXNMVYBlUBSYYXLTJkV49eHYC7N3L0Vy7N95sRincf/4gNETI8iOTMRiXDfejElckmoOlHT6IO8Lg/e4Es/FeI9S3NPKi62S5fMEgmo/zAmB/zFCjEf/bvc2xEdPR35sXnw8QTIBuh7xKCkSzUJdzl+9jWHMBIreAMnA/qtmNb9RYEWWM7lUnwO4RJ6XtkHGe7p9EhpTrGRa/znbDhNZoxy1w2+oEjp8/hoTFxqFeI5oGzOGkNfG7NOckvxTqdkRAHvG+a+YmTuNUrd+2gE4Apa3NODf2BefGP7tpNDA7RBBSAR2yWzsIgW+kOwdYVae x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HE1PR83MB0059; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(21748063052155); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(61426038)(61427038);SRVR:HE1PR83MB0059;BCL:0;PCL:0;RULEID:;SRVR:HE1PR83MB0059; x-forefront-prvs: 0091C8F1EB x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(7916002)(504964003)(189002)(51884002)(199003)(66066001)(54356999)(15975445007)(3660700001)(8936002)(7736002)(97736004)(7846002)(74316002)(16236675004)(106356001)(586003)(2351001)(11100500001)(2900100001)(3280700002)(790700001)(102836003)(3846002)(19580395003)(92566002)(229853001)(101416001)(450100001)(19300405004)(50986999)(6116002)(2906002)(105586002)(76576001)(19625215002)(10090500001)(5005710100001)(87936001)(10400500002)(7696004)(8990500004)(86612001)(122556002)(110136003)(33656002)(10290500002)(8676002)(107886002)(86362001)(68736007)(5660300001)(189998001)(2501003)(5002640100001)(81156014)(81166006)(9686002)(1730700003)(6916009);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR83MB0059;H:HE1PR83MB0058.EURPRD83.prod.outlook.com;FPR:;SPF:Non e;PTR:InfoNoRecords;MX:1;A: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: 10 Oct 2016 22:09:38.8401 (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:10617 Archived-At: --_000_HE1PR83MB0058EC22A38BBBAE5E0DA1AECADB0HE1PR83MB0058EURP_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Trying to build a piece of code that uses CMSG_NXTHDR macro using CLANG (te= sted with CLANG 3.8) with all warnings enabled using -Weverything generates= the following warnings: clang++ -Weverything ./nettest.cpp -c -o nettest.o ./nettest.cpp:5:12: warning: cast from 'unsigned char *' to 'struct cmsghdr= *' increases required alignment from 1 to 4 [-Wcast-align] return CMSG_NXTHDR(mhdr, cmsg); ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/sys/socket.h:270:8: note: expanded from macro 'CMSG_NXTHDR' ? 0 : (struct cmsghdr *)__CMSG_NEXT(cmsg)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./nettest.cpp:5:12: warning: comparison of integers of different signs: 'un= signed long' and 'long' [-Wsign-compare] return CMSG_NXTHDR(mhdr, cmsg); ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/sys/socket.h:269:44: note: expanded from macro 'CMSG_NXTHDR' __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >=3D __MHDR_END(mhdr) - (= unsigned char *)(cmsg) \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. The testing source is below: #include cmsghdr* GET_CMSG_NXTHDR(msghdr* mhdr, cmsghdr* cmsg); cmsghdr* GET_CMSG_NXTHDR(msghdr* mhdr, cmsghdr* cmsg) { return CMSG_NXTHDR(mhdr, cmsg); } Would it be possible to fix it so that no warnings are generated? We are bu= ilding our application with -Weverything and currently we need to disable t= hese two warnings around the CMSG_NXTHDR macro invocation. Thank you in advance for considering that! Jan --_000_HE1PR83MB0058EC22A38BBBAE5E0DA1AECADB0HE1PR83MB0058EURP_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Trying to build a piece of code that uses CMSG_NXTHD= R macro using CLANG (tested with CLANG 3.8) with all warnings enabled using= -Weverything generates the following warnings:

 

clang++ -Weverything ./nettest.cpp -c -o net= test.o

 

./nettest.cpp:5:12: warning: cast from 'unsigned cha= r *' to 'struct cmsghdr *' increases required alignment from 1 to 4 [-Wcast= -align]

    return CMSG_NXTHDR(mhdr, cmsg);

        &nbs= p;  ^~~~~~~~~~~~~~~~~~~~~~~

/usr/include/sys/socket.h:270:8: note: expanded from= macro 'CMSG_NXTHDR'

        ? 0 : (st= ruct cmsghdr *)__CMSG_NEXT(cmsg))

        &nbs= p;     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

./nettest.cpp:5:12: warning: comparison of integers = of different signs: 'unsigned long' and 'long' [-Wsign-compare]<= /p>

    return CMSG_NXTHDR(mhdr, cmsg);

        &nbs= p;  ^~~~~~~~~~~~~~~~~~~~~~~

/usr/include/sys/socket.h:269:44: note: expanded fro= m macro 'CMSG_NXTHDR'

        __CMSG_LE= N(cmsg) + sizeof(struct cmsghdr) >=3D __MHDR_END(mhdr) - (unsigned c= har *)(cmsg) \

        ~~~~~~~~~= ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~

2 warnings generated.

 

The testing source is below:

 

#include <sys/socket.h>

cmsghdr* GET_CMSG_NXTHDR(msghdr* mhdr, cmsghdr* cmsg= );

 

cmsghdr* GET_CMSG_NXTHDR(msghdr* mhdr, cmsghdr* cmsg= )

{

    return CMSG_NXTHDR(mhdr, cmsg);

}

 

Would it be possible to fix it so that no warnings a= re generated? We are building our application with -Weverything and current= ly we need to disable these two warnings around the CMSG_NXTHDR macro invoc= ation.

Thank you in advance for considering that!

 

Jan

--_000_HE1PR83MB0058EC22A38BBBAE5E0DA1AECADB0HE1PR83MB0058EURP_--