mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-05 11:10:10 +01:00
intel/genxml: Assert that genxml field start and ends are sane.
Chris recently fixed a bunch of genxml end < start bugs, as well as booleans that are wider than a bit. These are way too easy to write, so asserting that the fields are sane is a good plan. Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com> Acked-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
parent
f83fd929b7
commit
e6fb8196ce
1 changed files with 7 additions and 0 deletions
|
|
@ -235,6 +235,13 @@ class Field(object):
|
|||
self.end = int(attrs["end"])
|
||||
self.type = attrs["type"]
|
||||
|
||||
assert self.start <= self.end, \
|
||||
'field {} has end ({}) < start ({})'.format(self.name, self.end,
|
||||
self.start)
|
||||
if self.type == 'bool':
|
||||
assert self.end == self.start, \
|
||||
'bool field ({}) is too wide'.format(self.name)
|
||||
|
||||
if "prefix" in attrs:
|
||||
self.prefix = attrs["prefix"]
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue