diff options
author | Kenneth Graunke <[email protected]> | 2018-05-07 11:14:42 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2018-05-07 23:06:52 -0700 |
commit | e6fb8196cea78f56dc554eb226b97570ef90355d (patch) | |
tree | 1af4d9006bac3264f416782e96b7a4dd605e7d8c | |
parent | f83fd929b71660067c53e98219d2e9c04d5d98db (diff) |
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 <[email protected]>
Acked-by: Jason Ekstrand <[email protected]>
-rw-r--r-- | src/intel/genxml/gen_pack_header.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/intel/genxml/gen_pack_header.py b/src/intel/genxml/gen_pack_header.py index 4bce425d12e..c3d712c7a86 100644 --- a/src/intel/genxml/gen_pack_header.py +++ b/src/intel/genxml/gen_pack_header.py @@ -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: |