diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2023-05-25 18:50:58 -0700 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2023-05-30 10:55:39 -0700 |
commit | f26044717679331ba31ba9bb911e059a13a49599 (patch) | |
tree | aee4744571b80e6fff4b856f6bee10fd9a7d9957 | |
parent | 2fd2eb5a247e641adc36a67318a791b417afea46 (diff) | |
download | qemu-f26044717679331ba31ba9bb911e059a13a49599.zip qemu-f26044717679331ba31ba9bb911e059a13a49599.tar.gz qemu-f26044717679331ba31ba9bb911e059a13a49599.tar.bz2 |
decodetree: Diagnose empty pattern group
Test err_pattern_group_empty.decode failed with exception:
Traceback (most recent call last):
File "./scripts/decodetree.py", line 1424, in <module> main()
File "./scripts/decodetree.py", line 1342, in main toppat.build_tree()
File "./scripts/decodetree.py", line 627, in build_tree
self.tree = self.__build_tree(self.pats, self.fixedbits,
File "./scripts/decodetree.py", line 607, in __build_tree
fb = i.fixedbits & innermask
TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r-- | scripts/decodetree.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/decodetree.py b/scripts/decodetree.py index e2640cc..e4ef0a0 100644 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -506,6 +506,12 @@ class IncMultiPattern(MultiPattern): output(ind, '}\n') else: p.output_code(i, extracted, p.fixedbits, p.fixedmask) + + def build_tree(self): + if not self.pats: + error_with_file(self.file, self.lineno, 'empty pattern group') + super().build_tree() + #end IncMultiPattern |