[PATCH] rpc: Make the dispatch generator handle 'void name(void)' style procedures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently there are no such procedures in the protocol, but programming
errors like a missing _args or _ret suffix on the structs in the .x files
can create such a situation by accident. Making the generator aware of
this avoids bogus errors from the generator such as:

  Use of uninitialized value in exists at ./rpc/gendispatch.pl line 967.

Reported by Michal Privoznik
---
 src/rpc/gendispatch.pl |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index e068b53..e6a4a1c 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -143,6 +143,20 @@ while (<PROTOCOL>) {
         $flags = $3;
         $ProcName = name_to_ProcName ($name);
 
+        if (!exists $calls{$name}) {
+            # that the argument and return value cases have not yet added
+            # this procedure to the calls hash means that it has no arguments
+            # and no return value. add it to the calls hash now because all
+            # procedures have to be listed in the calls hash
+            $calls{$name} = {
+                name => $name,
+                ProcName => $ProcName,
+                UC_NAME => uc $name,
+                args => "void",
+                ret => "void"
+            }
+        }
+
         if ($opt_b or $opt_k) {
             if (!($flags =~ m/^\s*\/\*\s*(\S+)\s+(\S+)\s*(.*)\*\/\s*$/)) {
                 die "invalid generator flags for ${procprefix}_PROC_${name}"
-- 
1.7.4.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]