s3: Fix a typed-punned warning

Andrew Bartlett abartlet at samba.org
Mon Feb 14 04:30:33 MST 2011


On Mon, 2011-02-14 at 11:47 +0100, Volker Lendecke wrote:
> The branch, master has been updated
>        via  e9f5529 s3: Fix a typed-punned warning
>       from  a6af1ef s4-dsdb: cope with broken exchange schema with single valued backlinks
> 
> http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
> 
> 
> - Log -----------------------------------------------------------------
> commit e9f552925d0c007379d81af6ea9b0973011aed80
> Author: Volker Lendecke <vl at samba.org>
> Date:   Mon Feb 7 14:43:09 2011 +0100
> 
>     s3: Fix a typed-punned warning
>     
>     Autobuild-User: Volker Lendecke <vlendec at samba.org>
>     Autobuild-Date: Mon Feb 14 11:46:50 CET 2011 on sn-devel-104
> 
> -----------------------------------------------------------------------
> 
> Summary of changes:
>  source3/nmbd/nmbd_packets.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> 
> Changeset truncated at 500 lines:
> 
> diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c
> index 48d10cc..5f900c4 100644
> --- a/source3/nmbd/nmbd_packets.c
> +++ b/source3/nmbd/nmbd_packets.c
> @@ -497,7 +497,7 @@ struct response_record *queue_register_name( struct subnet_record *subrec,
>  		return NULL;
>  
>  	in_addr_to_sockaddr_storage(&ss, subrec->bcast_ip);
> -	pss = iface_ip((struct sockaddr *)&ss);
> +	pss = iface_ip((struct sockaddr *)(void *)&ss);

Does adding the void * actually help with the type punning, or is this just about the warning?

As far as I understand it, the void * here just shuts up the compiler.
Should we consider -fno-strict-alising (so we can instead rely on the
casting), or perhaps see if the higher levels of -Wstrict-aliasing=n put
out less warnings?

Andrew Bartlett
-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org
Samba Developer, Cisco Inc.



More information about the samba-technical mailing list