From e6fb8196cea78f56dc554eb226b97570ef90355d Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 7 May 2018 11:14:42 -0700 Subject: [PATCH] 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 Acked-by: Jason Ekstrand --- src/intel/genxml/gen_pack_header.py | 7 +++++++ 1 file changed, 7 insertions(+) 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: -- 2.30.2