summaryrefslogtreecommitdiff
path: root/python_modules
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2019-02-18 13:16:24 +0000
committerFrediano Ziglio <fziglio@redhat.com>2019-02-21 09:05:03 +0000
commit60883a03212b55031a7d7fd53f28a05505713c65 (patch)
tree0b48c88678f100215d45b657115cdce18de6283a /python_modules
parenta5de31bc8af4923b9f2a5bbd1c766ebd1066b4b0 (diff)
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@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Diffstat (limited to 'python_modules')
-rw-r--r--python_modules/ptypes.py6
1 files changed, 6 insertions, 0 deletions
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: