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

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



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


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