From owner-svn-src-all@freebsd.org Wed May 18 23:58:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 220B7B41265 for ; Wed, 18 May 2016 23:58:13 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from erouter6.ore.mailhop.org (erouter6.ore.mailhop.org [54.187.213.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F0208170E for ; Wed, 18 May 2016 23:58:12 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 41e29c99-1d54-11e6-896e-fd5016d7ee1b X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.34.117.227 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.34.117.227]) by outbound3.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Wed, 18 May 2016 23:57:19 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.14.9) with ESMTP id u4INwAo0053900; Wed, 18 May 2016 17:58:10 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1463615890.1180.306.camel@freebsd.org> Subject: Re: svn commit: r300167 - in head: contrib/bsnmp/snmpd usr.sbin/bsnmpd/bsnmpd From: Ian Lepore To: Bruce Evans Cc: Gleb Smirnoff , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Wed, 18 May 2016 17:58:10 -0600 In-Reply-To: <20160519092734.U1798@besplex.bde.org> References: <201605182202.u4IM2JF7047307@repo.freebsd.org> <1463609665.1180.301.camel@freebsd.org> <20160519092734.U1798@besplex.bde.org> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.16.5 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 May 2016 23:58:13 -0000 On Thu, 2016-05-19 at 09:43 +1000, Bruce Evans wrote: > 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 > For some reason I had assumed a (void*) cast would wish away the warning about increasing alignment (without losing that warning at other places in that code). Now I can't say for sure why I thought that would be so, but it does seem to me I've fixed warnings like that by casting through void* as an intermediate type. But maybe that was a different situation/different warning. -- Ian