qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v14 13/15] qapi: Enforce (or whitelist) case con


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v14 13/15] qapi: Enforce (or whitelist) case conventions on qapi members
Date: Wed, 02 Dec 2015 12:51:51 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

This is the fixup I mentioned in the v13 thread.  The "Unreachable and
not implemented" hunk should probably be its own patch.

diff --git a/scripts/qapi.py b/scripts/qapi.py
index 6d38d7c..870e476 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -63,7 +63,6 @@ returns_whitelist = [
 case_whitelist = [
     # From QMP:
     'ACPISlotType',         # DIMM, visible through query-acpi-ospm-status
-    'CpuInfo',              # CPU, PC, visible through query-cpu
     'CpuInfoBase',          # CPU, visible through query-cpu
     'CpuInfoMIPS',          # PC, visible through query-cpu
     'CpuInfoTricore',       # PC, visible through query-cpu
@@ -1053,10 +1052,9 @@ class QAPISchemaMember(object):
 
     def check_clash(self, info, seen):
         cname = c_name(self.name)
-        if cname.lower() != cname and info['name'] not in case_whitelist:
+        if cname.lower() != cname and self.owner not in case_whitelist:
             raise QAPIExprError(info,
-                                "Member '%s' of '%s' should use lowercase"
-                                % (self.name, info['name']))
+                                "%s should not use uppercase" % 
self.describe())
         if cname in seen:
             raise QAPIExprError(info,
                                 "%s collides with %s"
@@ -1073,7 +1071,8 @@ class QAPISchemaMember(object):
                 return '(parameter of %s)' % owner[:-4]
             else:
                 assert owner.endswith('-wrapper')
-                return '(branch of %s)' % owner[:-8]
+                # Unreachable and not implemented
+                assert False
         if owner.endswith('Kind'):
             # See QAPISchema._make_implicit_enum_type()
             return '(branch of %s)' % owner[:-4]
diff --git a/tests/qapi-schema/args-member-case.err 
b/tests/qapi-schema/args-member-case.err
index 7bace48..44c31ea 100644
--- a/tests/qapi-schema/args-member-case.err
+++ b/tests/qapi-schema/args-member-case.err
@@ -1 +1 @@
-tests/qapi-schema/args-member-case.json:3: Member 'Arg' of 'Foo' should use 
lowercase
+tests/qapi-schema/args-member-case.json:3: 'Arg' (parameter of Foo) should not 
use uppercase
diff --git a/tests/qapi-schema/enum-member-case.err 
b/tests/qapi-schema/enum-member-case.err
index e50b12a..a1d67c6 100644
--- a/tests/qapi-schema/enum-member-case.err
+++ b/tests/qapi-schema/enum-member-case.err
@@ -1 +1 @@
-tests/qapi-schema/enum-member-case.json:3: Member 'Value' of 'Foo' should use 
lowercase
+tests/qapi-schema/enum-member-case.json:3: 'Value' (member of Foo) should not 
use uppercase
diff --git a/tests/qapi-schema/union-branch-case.err 
b/tests/qapi-schema/union-branch-case.err
index 6c6b740..0b4c1b5 100644
--- a/tests/qapi-schema/union-branch-case.err
+++ b/tests/qapi-schema/union-branch-case.err
@@ -1 +1 @@
-tests/qapi-schema/union-branch-case.json:3: Member 'Branch' of 'Foo' should 
use lowercase
+tests/qapi-schema/union-branch-case.json:3: 'Branch' (branch of Foo) should 
not use uppercase
-- 
2.4.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]