The current RPC code is post-processed to introduce an intermediate variable, rather than casting directly to char ** at time of use. This is said to be a workaround for type-puning warnings that the compiler emitted. Neither GCC or CLang emit any warnings for the code in question today, across any of the architectures we test in CI. Thus it is presumed that somewhere in the 15 years since the workaround was done, the compilers have got smarter and do the right thing. Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> --- src/rpc/genprotocol.pl | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/rpc/genprotocol.pl b/src/rpc/genprotocol.pl index f567260588..079627964f 100755 --- a/src/rpc/genprotocol.pl +++ b/src/rpc/genprotocol.pl @@ -92,29 +92,6 @@ while (<RPCGEN>) { @uses = grep /[^.>]\bi\b/, @function; @function = grep !/[^.>]\bi\b/, @function if @uses == 1; - # (char **)&objp->... gives: - # warning: dereferencing type-punned pointer will break - # strict-aliasing rules - # so rewrite it. - my %uses = (); - my $i = 0; - foreach (@function) { - $uses{$1} = $i++ if m/\(char \*\*\)\&(objp->[a-z_.]+_val)/i; - } - if (keys %uses >= 1) { - my $i = 1; - - foreach (sort(keys %uses)) { - $i = $uses{$_}; - unshift @function, - (" char **objp_cpp$i = (char **) (void *) &$_;\n"); - $i++; - } - @function = - map { s{\(char \*\*\)\&(objp->[a-z_.]+_val)} - {objp_cpp$uses{$1}}gi; $_ } @function; - } - # The code uses 'IXDR_PUT_{U_,}LONG' but it's wrong in two # ways: Firstly these functions are deprecated and don't # work on 64 bit platforms. Secondly the return value should -- 2.39.1