From owner-svn-src-head@freebsd.org Thu Jul 5 18:12:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 882B91044101; Thu, 5 Jul 2018 18:12:37 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id C713E8DCD1; Thu, 5 Jul 2018 18:12:36 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id C48AF1047A97; Fri, 6 Jul 2018 04:12:27 +1000 (AEST) Date: Fri, 6 Jul 2018 04:12:27 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans cc: Brooks Davis , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r336002 - in head: usr.bin/netstat usr.sbin/tcpdrop In-Reply-To: <20180706031434.G2327@besplex.bde.org> Message-ID: <20180706035359.U2464@besplex.bde.org> References: <201807051702.w65H2AXB058831@repo.freebsd.org> <20180706031434.G2327@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=1IadEPXVrUyXDEyL5O8A:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2018 18:12:37 -0000 On Fri, 6 Jul 2018, Bruce Evans wrote: > On Thu, 5 Jul 2018, Brooks Davis wrote: > >> Log: >> Work around lame warnings in ancient gcc on 32-bit platforms. >> >> Fixes r335979. > > These are correct warnings. > > Why not fix the bug instead of rorking around it? > >> Modified: head/usr.bin/netstat/inet.c >> ============================================================================== >> --- head/usr.bin/netstat/inet.c Thu Jul 5 16:43:15 2018 >> (r336001) >> +++ head/usr.bin/netstat/inet.c Thu Jul 5 17:02:10 2018 >> (r336002) >> @@ -159,12 +159,12 @@ sotoxsocket(struct socket *so, struct xsocket *xso) >> >> bzero(xso, sizeof *xso); >> xso->xso_len = sizeof *xso; >> - xso->xso_so = (kvaddr_t)so; >> + xso->xso_so = (kvaddr_t)(long)so; > > This (and kvaddr_t having the same 64-bit size for all arches) are > unportable. > ... Lots is still broken. In just my kernel with few options: X cc1: warnings being treated as errors X ../../../kern/uipc_usrreq.c: In function 'unp_pcblist': X ../../../kern/uipc_usrreq.c:1856: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] X ../../../kern/uipc_usrreq.c:1873: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] X ../../../kern/uipc_usrreq.c:1874: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] X ../../../kern/uipc_usrreq.c:1875: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] X ../../../kern/uipc_usrreq.c:1876: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] X cc1: warnings being treated as errors X ../../../netinet/in_pcb.c: In function 'in_pcbtoxinpcb': X ../../../netinet/in_pcb.c:2909: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] X cc1: warnings being treated as errors X ../../../kern/kern_descrip.c: In function 'sysctl_kern_file': X ../../../kern/kern_descrip.c:3365: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] X ../../../kern/kern_descrip.c:3366: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] X ../../../kern/kern_descrip.c:3367: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] X --- in_pcb.o --- X *** [in_pcb.o] Error code 1 X X make: stopped in /home/bde/syscn/i386/compile/Bsmp X --- uipc_usrreq.o --- X *** [uipc_usrreq.o] Error code 1 X X make: stopped in /home/bde/syscn/i386/compile/Bsmp X --- kern_descrip.o --- X *** [kern_descrip.o] Error code 1 X X make: stopped in /home/bde/syscn/i386/compile/Bsmp X cc1: warnings being treated as errors X ../../../kern/uipc_socket.c: In function 'sotoxsocket': X ../../../kern/uipc_socket.c:3988: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] X ../../../kern/uipc_socket.c:3993: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] X --- uipc_socket.o --- X *** [uipc_socket.o] Error code 1 X X make: stopped in /home/bde/syscn/i386/compile/Bsmp The warnings are especially correct since they were asked for by [-Wpointer-to-int-cast]. I think this is implicit in -W or -Wall. clang doesn't even warn that it doesn't support this flag when the flag is added explicitly. It apparently silently ignores this flag, since it accepts it but doesn't even warn for downcasts. Bruce