[Spice-commits] python_modules/ptypes.py

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Feb 21 09:05:29 UTC 2019


 python_modules/ptypes.py |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit 60883a03212b55031a7d7fd53f28a05505713c65
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Mon Feb 18 13:16:24 2019 +0000

    codegen: Add a test for attribute combination
    
    Does not make sense to specify the same field to have 2
    different C implementation at the same time.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/python_modules/ptypes.py b/python_modules/ptypes.py
index da148e8..7dca78d 100644
--- a/python_modules/ptypes.py
+++ b/python_modules/ptypes.py
@@ -96,6 +96,12 @@ def fix_attributes(attribute_list):
         elif len(lst) > 1:
             raise Exception("Attribute %s has more than 1 argument" % name)
         attrs[name] = lst
+
+    # these attributes specify output format, only one can be set
+    output_attrs = set(['end', 'to_ptr', 'as_ptr', 'ptr_array', 'zero'])
+    if len(output_attrs.intersection(attrs.keys())) > 1:
+        raise Exception("Multiple output type attributes specified %s" % output_attrs)
+
     return attrs
 
 class Type:


More information about the Spice-commits mailing list