|
Message-ID: <HE1PR83MB0058AFEDEFC690543732A70BCADA0@HE1PR83MB0058.EURPRD83.prod.outlook.com> Date: Tue, 11 Oct 2016 15:38:38 +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 My test was a c++ code :-). That's why the struct was not there. Thanks, Jan -----Original Message----- From: Szabolcs Nagy [mailto:nsz@...t70.net] Sent: Tuesday, October 11, 2016 5:31 PM To: musl@...ts.openwall.com Subject: Re: [musl] Using macro CMSG_NXTHDR generates warnings with CLANG * Rich Felker <dalias@...c.org> [2016-10-11 11:09:01 -0400]: > On Mon, Oct 10, 2016 at 10:09:38PM +0000, Jan Vorlicek wrote: > > The testing source is below: > > > > #include <sys/socket.h> > > cmsghdr* GET_CMSG_NXTHDR(msghdr* mhdr, cmsghdr* cmsg); > > this is invalid c code (you cannot leave 'struct' off). > > 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 building our application with -Weverything and currently we need > > to disable these two warnings around the CMSG_NXTHDR macro > > invocation. > > Thank you in advance for considering that! > > 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. > fwiw i see the warnings with clang -c -Wcast-align test.c i assume they cannot easily tell if they should warn when a macro defined in a system header expanded with user arguments. i think this warning is problematic: it warns about casting char*, but not about casting void* which has the exact same issue. so if you have apis that uses char* instead of void* for generic pointers (e.g. for abi compat reasons), then you get loads of false positives (which is what happens here). it can be worked around by adding a void* cast (but in my opinion that makes things worse: users will add more casts to get rid of the warning which has the opposite effect than what you would want).
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.