Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Jul 2018 04:12:27 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        Brooks Davis <brooks@freebsd.org>, 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
Message-ID:  <20180706035359.U2464@besplex.bde.org>
In-Reply-To: <20180706031434.G2327@besplex.bde.org>
References:  <201807051702.w65H2AXB058831@repo.freebsd.org> <20180706031434.G2327@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180706035359.U2464>