[libvirt] [PATCH] genprotocol.pl: Fix code on FreeBSD too

On some systems (linux, cygwin and freebsd) rpcgen generates files which when compiling produces this warning: remote/remote_protocol.c: In function 'xdr_remote_node_get_cpu_stats_ret': remote/remote_protocol.c:530: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] Hence, on those systems we need to post-process the files by the rpc/genprotocol.pl perl script. At the beginning of the script the OS is detected via $^O perl variable. On FreeBSD it contains 'freebsd' string and not 'gnukfreebsd' as is currently there: http://perldoc.perl.org/perlport.html#PLATFORMS Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/rpc/genprotocol.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpc/genprotocol.pl b/src/rpc/genprotocol.pl index 4f8b6c4..abd40fd 100755 --- a/src/rpc/genprotocol.pl +++ b/src/rpc/genprotocol.pl @@ -43,7 +43,7 @@ open RPCGEN, "-|", $rpcgen, $mode, $xdrdef open TARGET, ">$target" or die "cannot create $target: $!"; -my $fixup = $^O eq "linux" || $^O eq "cygwin" || $^O eq "gnukfreebsd"; +my $fixup = $^O eq "linux" || $^O eq "cygwin" || $^O eq "freebsd"; if ($mode eq "-c") { print TARGET "#include <config.h>\n"; -- 1.8.1.5

On Fri, Sep 27, 2013 at 04:39:21PM +0200, Michal Privoznik wrote:
On some systems (linux, cygwin and freebsd) rpcgen generates files which when compiling produces this warning:
remote/remote_protocol.c: In function 'xdr_remote_node_get_cpu_stats_ret': remote/remote_protocol.c:530: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
Hence, on those systems we need to post-process the files by the rpc/genprotocol.pl perl script. At the beginning of the script the OS is detected via $^O perl variable. On FreeBSD it contains 'freebsd' string and not 'gnukfreebsd' as is currently there:
The 'gnukfreebsd' string there is for Debian/kFreeBSD, not FreeBSD. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Fri, Sep 27, 2013 at 04:39:21PM +0200, Michal Privoznik wrote:
On some systems (linux, cygwin and freebsd) rpcgen generates files which when compiling produces this warning:
remote/remote_protocol.c: In function 'xdr_remote_node_get_cpu_stats_ret': remote/remote_protocol.c:530: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
Hence, on those systems we need to post-process the files by the rpc/genprotocol.pl perl script. At the beginning of the script the OS is detected via $^O perl variable. On FreeBSD it contains 'freebsd' string and not 'gnukfreebsd' as is currently there:
http://perldoc.perl.org/perlport.html#PLATFORMS
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/rpc/genprotocol.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/rpc/genprotocol.pl b/src/rpc/genprotocol.pl index 4f8b6c4..abd40fd 100755 --- a/src/rpc/genprotocol.pl +++ b/src/rpc/genprotocol.pl @@ -43,7 +43,7 @@ open RPCGEN, "-|", $rpcgen, $mode, $xdrdef open TARGET, ">$target" or die "cannot create $target: $!";
-my $fixup = $^O eq "linux" || $^O eq "cygwin" || $^O eq "gnukfreebsd"; +my $fixup = $^O eq "linux" || $^O eq "cygwin" || $^O eq "freebsd";
NAK. As Daniel pointed out the above refers to GNU/kFreeBSD and should be kept and freebsd just added. Cheers, -- Guido
if ($mode eq "-c") { print TARGET "#include <config.h>\n"; -- 1.8.1.5
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
participants (3)
-
Daniel P. Berrange
-
Guido Günther
-
Michal Privoznik