Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <HE1PR83MB00580C599FBDD5C8BC7DFC08CADA0@HE1PR83MB0058.EURPRD83.prod.outlook.com>
Date: Tue, 11 Oct 2016 15:25:24 +0000
From: Jan Vorlicek <janvorli@...rosoft.com>
To: "musl@...ts.openwall.com" <musl@...ts.openwall.com>
Subject: RE: Using macro CMSG_NXTHDR generates warnings with CLANG

The simple repro was in my email - just cut and paste the 6 lines of code into a file named nettest.cpp and then run clang++ -Weverything ./nettest.cpp -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 Alpine, the CMSG_NXTHDR is a macro defined in /usr/include/sys/socket.h. On Ubuntu, it is defined in /usr/include/x86_64-linux-gnu/bits/socket.h. The definition is also different:
Alpine:
#define CMSG_NXTHDR(mhdr, cmsg) ((cmsg)->cmsg_len < sizeof (struct cmsghdr) || \
        __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __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@...ifal.cx] On Behalf Of Rich Felker
Sent: Tuesday, October 11, 2016 5:23 PM
To: musl@...ts.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 
> > any warnings from them. If it does that's a compiler bug. Are you 
> > perhaps using an odd setup where musl's headers aren't in the 
> > default system include path but instead passed in via -I rather than 
> > -isystem? If you have a minimal test file I could see if the same 
> > warnings appear with clang on Alpine Linux.
> 
> As mentioned on IRC some time ago, Clang suppresses warnings in macros 
> expanded from definitions in system headers on a case-by-case basis, 
> i.e. some warnings are suppressed (if someone deliberately enabled 
> suppression), some are not. As seen here, -Wcast-align is among those warnings that are not suppressed.

Ah. I think this should just be considered a clang bug then...

Rich

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.