[Mesa-dev] [PATCH 3/3] intel/genxml: Assert that genxml field start and ends are sane.
Jason Ekstrand
jason at jlekstrand.net
Mon May 7 21:16:01 UTC 2018
Acked-by: Jason Ekstrand <jason at jlekstrand.net>
On Mon, May 7, 2018 at 1:40 PM, Kenneth Graunke <kenneth at whitecape.org>
wrote:
> 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.
> ---
> 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.17.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180507/ea1f48e3/attachment.html>
More information about the mesa-dev
mailing list