mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-23 18:10:36 +02:00
gallium/trace: Collect enums from multiple files
We're going to do some code motions out of p_state.h so the one file assumption will fail. relax it. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Italo Nicola <italonicola@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24076>
This commit is contained in:
parent
cef578c5fc
commit
b0313d9f09
1 changed files with 17 additions and 14 deletions
|
|
@ -90,10 +90,11 @@ def pkk_get_argparser():
|
|||
"example: %(prog)s ../../include/pipe/p_defines.h -C tr_util.c -H tr_util.h"
|
||||
)
|
||||
|
||||
optparser.add_argument("in_file",
|
||||
optparser.add_argument("in_files",
|
||||
type=str,
|
||||
metavar="infile",
|
||||
help="path to input header file p_defines.h (or '-' for stdin)")
|
||||
metavar="infiles",
|
||||
nargs="+",
|
||||
help="path to input header files (or '-' for stdin)")
|
||||
|
||||
optparser.add_argument("-C",
|
||||
type=str,
|
||||
|
|
@ -260,18 +261,20 @@ if __name__ == "__main__":
|
|||
optparser = pkk_get_argparser()
|
||||
pkk_cfg = optparser.parse_args()
|
||||
|
||||
### Parse input
|
||||
hdrparser = PKKHeaderParser(pkk_cfg.in_file)
|
||||
### Parse input files
|
||||
enums = {}
|
||||
for file in pkk_cfg.in_files:
|
||||
hdrparser = PKKHeaderParser(file)
|
||||
|
||||
try:
|
||||
if pkk_cfg.in_file != "-":
|
||||
with open(pkk_cfg.in_file, "r", encoding="UTF-8") as fh:
|
||||
enums = hdrparser.parse_file(fh)
|
||||
else:
|
||||
enums = hdrparser.parse_file(sys.stdin)
|
||||
|
||||
except OSError as e:
|
||||
pkk_fatal(str(e))
|
||||
try:
|
||||
if file != "-":
|
||||
with open(file, "r", encoding="UTF-8") as fh:
|
||||
enums.update(hdrparser.parse_file(fh))
|
||||
else:
|
||||
enums.update(hdrparser.parse_file(sys.stdin))
|
||||
break
|
||||
except OSError as e:
|
||||
pkk_fatal(str(e))
|
||||
|
||||
### Check if any of the required enums are missing
|
||||
errors = False
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue