[libvirt PATCH 0/2] rpc: Make rpcgen produce ANSI C code

Test pipeline: https://gitlab.com/abologna/libvirt/-/pipelines/1059558331 Should make it possible to build libvirt on macOS 14, where it currently fails with src/rpc/virnetprotocol.c:13:1: error: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] xdr_virNetMessageType(xdrs, objp) Andrea Bolognani (2): rpc: Drop support for portable-rpcgen rpc: Make rpcgen produce ANSI C code meson.build | 12 +----------- src/rpc/genprotocol.pl | 5 ++--- 2 files changed, 3 insertions(+), 14 deletions(-) -- 2.41.0

We use the native version of rpcgen everywhere. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- meson.build | 12 +----------- src/rpc/genprotocol.pl | 3 --- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/meson.build b/meson.build index dc0969abcc..158a7cae01 100644 --- a/meson.build +++ b/meson.build @@ -779,14 +779,11 @@ endif required_programs = [ 'perl', 'python3', + 'rpcgen', 'xmllint', 'xsltproc', ] -required_programs_groups = [ - { 'name': 'rpcgen', 'prog': [ 'rpcgen', 'portable-rpcgen' ] }, -] - if host_machine.system() == 'freebsd' required_programs += 'ifconfig' endif @@ -798,13 +795,6 @@ foreach name : required_programs set_variable('@0@_prog'.format(varname), prog) endforeach -foreach item : required_programs_groups - prog = find_program(item.get('prog'), dirs: libvirt_sbin_path) - varname = item.get('name').underscorify() - conf.set_quoted(varname.to_upper(), prog.full_path()) - set_variable('@0@_prog'.format(varname), prog) -endforeach - # optional programs optional_programs = [ diff --git a/src/rpc/genprotocol.pl b/src/rpc/genprotocol.pl index adf3991d7a..6c664f48e7 100755 --- a/src/rpc/genprotocol.pl +++ b/src/rpc/genprotocol.pl @@ -39,9 +39,6 @@ my $target = shift; unlink $target; -if ($rpcgen =~ /portable-rpcgen/) { - $rpcgen = "$rpcgen -o -"; -} open RPCGEN, "-|", "$rpcgen $mode $xdrdef" or die "cannot run $rpcgen $mode $xdrdef: $!"; open TARGET, ">$target" -- 2.41.0

On Fri, Nov 03, 2023 at 12:37:17AM +0100, Andrea Bolognani wrote:
We use the native version of rpcgen everywhere.
This is true of our CI systems, but not true of user environments. For our Mingw CI we're able to run the Linux native rpcgen since we're cross compiling. For someone using MSys to build natively for mingw, only portablexdr-rpcgen will be available, so we can't drop this.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- meson.build | 12 +----------- src/rpc/genprotocol.pl | 3 --- 2 files changed, 1 insertion(+), 14 deletions(-)
diff --git a/meson.build b/meson.build index dc0969abcc..158a7cae01 100644 --- a/meson.build +++ b/meson.build @@ -779,14 +779,11 @@ endif required_programs = [ 'perl', 'python3', + 'rpcgen', 'xmllint', 'xsltproc', ]
-required_programs_groups = [ - { 'name': 'rpcgen', 'prog': [ 'rpcgen', 'portable-rpcgen' ] }, -] - if host_machine.system() == 'freebsd' required_programs += 'ifconfig' endif @@ -798,13 +795,6 @@ foreach name : required_programs set_variable('@0@_prog'.format(varname), prog) endforeach
-foreach item : required_programs_groups - prog = find_program(item.get('prog'), dirs: libvirt_sbin_path) - varname = item.get('name').underscorify() - conf.set_quoted(varname.to_upper(), prog.full_path()) - set_variable('@0@_prog'.format(varname), prog) -endforeach - # optional programs
optional_programs = [ diff --git a/src/rpc/genprotocol.pl b/src/rpc/genprotocol.pl index adf3991d7a..6c664f48e7 100755 --- a/src/rpc/genprotocol.pl +++ b/src/rpc/genprotocol.pl @@ -39,9 +39,6 @@ my $target = shift;
unlink $target;
-if ($rpcgen =~ /portable-rpcgen/) { - $rpcgen = "$rpcgen -o -"; -} open RPCGEN, "-|", "$rpcgen $mode $xdrdef" or die "cannot run $rpcgen $mode $xdrdef: $!"; open TARGET, ">$target" -- 2.41.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org
With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

On Fri, Nov 03, 2023 at 08:55:27AM +0000, Daniel P. Berrangé wrote:
On Fri, Nov 03, 2023 at 12:37:17AM +0100, Andrea Bolognani wrote:
We use the native version of rpcgen everywhere.
This is true of our CI systems, but not true of user environments.
For our Mingw CI we're able to run the Linux native rpcgen since we're cross compiling.
For someone using MSys to build natively for mingw, only portablexdr-rpcgen will be available, so we can't drop this.
I wonder how broken that setup is, given that it has zero CI coverage. Anyway, fair point, let's not go out of our way to break things :) v2 here: https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/MLESR... -- Andrea Bolognani / Red Hat / Virtualization

This is the default for the version of rpcgen shipped with Linux distributions, but the one in macOS and possibly others default to K&R C, which modern compilers don't appreciate. Luckily, all versions of rpcgen shipped with our target platforms seem to support the -C option. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- src/rpc/genprotocol.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/rpc/genprotocol.pl b/src/rpc/genprotocol.pl index 6c664f48e7..5eb654cb7c 100755 --- a/src/rpc/genprotocol.pl +++ b/src/rpc/genprotocol.pl @@ -39,6 +39,8 @@ my $target = shift; unlink $target; +$rpcgen = "$rpcgen -C"; + open RPCGEN, "-|", "$rpcgen $mode $xdrdef" or die "cannot run $rpcgen $mode $xdrdef: $!"; open TARGET, ">$target" -- 2.41.0

On 11/2/23 7:37 PM, Andrea Bolognani wrote:
Test pipeline: https://gitlab.com/abologna/libvirt/-/pipelines/1059558331
Should make it possible to build libvirt on macOS 14, where it currently fails with
src/rpc/virnetprotocol.c:13:1: error: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] xdr_virNetMessageType(xdrs, objp)
Andrea Bolognani (2): rpc: Drop support for portable-rpcgen rpc: Make rpcgen produce ANSI C code
meson.build | 12 +----------- src/rpc/genprotocol.pl | 5 ++--- 2 files changed, 3 insertions(+), 14 deletions(-)
Reviewed-by: Laine Stump <laine@redhat.com> although I had to apply the patches manually (git am -3 failed).
participants (3)
-
Andrea Bolognani
-
Daniel P. Berrangé
-
Laine Stump