diff options
author | Frediano Ziglio <freddy77@gmail.com> | 2020-09-25 16:33:46 +0100 |
---|---|---|
committer | Frediano Ziglio <freddy77@gmail.com> | 2021-02-22 09:11:22 +0000 |
commit | e49301ebd157057864dbd98dae558a3e7c6c4e9b (patch) | |
tree | 0e4be8b81dea38d991546df66eddbc76ee131fac | |
parent | d8fe0cbb842e19aeeb8894fa59161dfd9e182cec (diff) |
codegen: Make "output_attrs" variable global
Allows to reuse it.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Victor Toso <victortoso@redhat.com>
-rw-r--r-- | python_modules/ptypes.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/python_modules/ptypes.py b/python_modules/ptypes.py index eba26a6..91bd0cd 100644 --- a/python_modules/ptypes.py +++ b/python_modules/ptypes.py @@ -86,6 +86,16 @@ attributes_with_arguments=set([ 'virtual', ]) +# these attributes specify output format, only one can be set +output_attributes = set([ + 'end', + 'to_ptr', + 'as_ptr', + 'ptr_array', + 'zero', + 'chunk', +]) + def fix_attributes(attribute_list, valid_attributes=valid_attributes_generic): attrs = {} for attr in attribute_list: @@ -100,9 +110,8 @@ def fix_attributes(attribute_list, valid_attributes=valid_attributes_generic): 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', 'chunk']) - if len(output_attrs.intersection(attrs.keys())) > 1: + # only one output attribute can be set + if len(output_attributes.intersection(attrs.keys())) > 1: raise Exception("Multiple output type attributes specified %s" % output_attrs) return attrs |