[PATCH] rpc: genprotocol: Always apply fixups to rpcgen's output

Peter Krempa posted 1 patch 1 year ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/548ac5242c48636388a70c0696e82ea7a7415272.1678265775.git.pkrempa@redhat.com
src/rpc/genprotocol.pl | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
[PATCH] rpc: genprotocol: Always apply fixups to rpcgen's output
Posted by Peter Krempa 1 year ago
The platform check which determines when to apply the fixups mentions
all officially supported build targets (per docs/platforms.rst) thus
it's not really necessary.

Additionally while not explicitly written as supported the check does
not work properly when building with the MinGW toolchain on Windows as
it does not apply the needed transformations. They are necessary
there the same way as with MinGW on Linux.

https://gitlab.com/libvirt/libvirt/-/issues/453

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/rpc/genprotocol.pl | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/src/rpc/genprotocol.pl b/src/rpc/genprotocol.pl
index f567260588..adf3991d7a 100755
--- a/src/rpc/genprotocol.pl
+++ b/src/rpc/genprotocol.pl
@@ -1,6 +1,6 @@
 #!/usr/bin/env perl
 #
-# Generate code for an XDR protocol, optionally applying
+# Generate code for an XDR protocol, applying
 # fixups to the glibc rpcgen code so that it compiles
 # with warnings turned on.
 #
@@ -47,20 +47,11 @@ open RPCGEN, "-|", "$rpcgen $mode $xdrdef"
 open TARGET, ">$target"
     or die "cannot create $target: $!";

-my $fixup = $^O eq "linux" || $^O eq "gnukfreebsd" || $^O eq "freebsd" || $^O eq "darwin";
-
 if ($mode eq "-c") {
     print TARGET "#include <config.h>\n";
 }

 while (<RPCGEN>) {
-    # We only want to fixup the GLibc rpcgen output
-    # So just print data unchanged, if non-Linux
-    unless ($fixup) {
-        print TARGET;
-        next;
-    }
-
     if (m/^{/) {
         $in_function = 1;
         print TARGET;
-- 
2.39.2
Re: [PATCH] rpc: genprotocol: Always apply fixups to rpcgen's output
Posted by Ján Tomko 1 year ago
On a Wednesday in 2023, Peter Krempa wrote:
>The platform check which determines when to apply the fixups mentions
>all officially supported build targets (per docs/platforms.rst) thus
>it's not really necessary.
>
>Additionally while not explicitly written as supported the check does
>not work properly when building with the MinGW toolchain on Windows as
>it does not apply the needed transformations. They are necessary
>there the same way as with MinGW on Linux.
>
>https://gitlab.com/libvirt/libvirt/-/issues/453
>
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/rpc/genprotocol.pl | 11 +----------
> 1 file changed, 1 insertion(+), 10 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano