Date: Thu, 19 May 2016 09:43:54 +1000 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Ian Lepore <ian@freebsd.org> Cc: Gleb Smirnoff <glebius@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300167 - in head: contrib/bsnmp/snmpd usr.sbin/bsnmpd/bsnmpd Message-ID: <20160519092734.U1798@besplex.bde.org> In-Reply-To: <1463609665.1180.301.camel@freebsd.org> References: <201605182202.u4IM2JF7047307@repo.freebsd.org> <1463609665.1180.301.camel@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 18 May 2016, Ian Lepore wrote: > On Wed, 2016-05-18 at 22:02 +0000, Gleb Smirnoff wrote: >> Log: >> Revert r299830, it has couple of fatal errors. >> >> The CMSG_ family of macros take care of alignment, so we don't need >> r299830 >> at all, even if it was correct. Put NO_WCAST_ALIGN into Makefile. The breaks detection of cast-align bugs elsewhere in the program. > So all of this was about a "cast increases required alignment" kind of > warning for a macro that takes care of alignment? Wouldn't the proper > fix then be to change CMSG_DATA() so that its internal cast is void* > instead of unsigned char* (he asked, knowing Bruce would come along > soon and point out why that's a dumb question)? I don't know much about CMSG*, so I wouldn't have if you didn't ask :-). Changing its type might expose bugs. Kernel code mostly casts it so would get the same cast-align error if that were enabled in the kernel. netinet6 passes it to a function without an explicit cast. The function does an implicit conversion to a struct pointer and there should be a different warning for that. char * and u_char * are required to be binary compatible with void *, but it is bad style to depend on that. So void * works better in all cases in the kernel. LINUX_CMSG_DATA() already returns void *. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160519092734.U1798>