tracetool: report error on foo() instead of foo(void)
authorStefan Hajnoczi <stefanha@redhat.com>
Wed, 10 Jan 2018 20:25:53 +0000 (20:25 +0000)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 29 Jan 2018 10:34:55 +0000 (10:34 +0000)
C functions with no arguments must be declared foo(void) instead of
foo().  The tracetool argument list parser has never accepted an empty
argument list.  This patch adds a clear error message for this error
case.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20180110202553.31889-4-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
scripts/tracetool/__init__.py

index e3685bd0ca5ebc1547086f2aae6819d57d2f40a6..1a9733da9a17a796630e215e6a245ab74698ac11 100644 (file)
@@ -75,6 +75,8 @@ class Arguments:
         res = []
         for arg in arg_str.split(","):
             arg = arg.strip()
+            if not arg:
+                raise ValueError("Empty argument (did you forget to use 'void'?)")
             if arg == 'void':
                 continue