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:
Kenneth Graunke 2018-05-07 11:14:42 -07:00
parent f83fd929b7
commit e6fb8196ce

View file

@ -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: