mirror of
https://github.com/gcc-mirror/gcc.git
synced 2024-11-21 13:40:47 +00:00
contrib/check-params-in-docs.py: Ignore target-specific params
contrib/check-params-in-docs.py is a script that checks that all options reported with gcc --help=params are in gcc/doc/invoke.texi and vice versa. gcc/doc/invoke.texi lists target-specific params but gcc --help=params doesn't. This meant that the script would mistakenly complain about parms missing from --help=params. Previously, the script was just set to ignore aarch64 and gcn params which solved this issue only for x86. This patch sets the script to ignore all target-specific params. contrib/ChangeLog: * check-params-in-docs.py: Ignore target specific params. Signed-off-by: Filip Kastl <fkastl@suse.cz>
This commit is contained in:
parent
b6c8259076
commit
e30e760b51
@ -38,6 +38,9 @@ def get_param_tuple(line):
|
||||
description = line[i:].strip()
|
||||
return (name, description)
|
||||
|
||||
def target_specific(param):
|
||||
return param.split('-')[0] in ('aarch64', 'gcn', 'x86')
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('texi_file')
|
||||
@ -45,13 +48,16 @@ parser.add_argument('params_output')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
ignored = {'logical-op-non-short-circuit', 'gcn-preferred-vectorization-factor'}
|
||||
params = {}
|
||||
ignored = {'logical-op-non-short-circuit'}
|
||||
help_params = {}
|
||||
|
||||
for line in open(args.params_output).readlines():
|
||||
if line.startswith(' ' * 2) and not line.startswith(' ' * 8):
|
||||
r = get_param_tuple(line)
|
||||
params[r[0]] = r[1]
|
||||
help_params[r[0]] = r[1]
|
||||
|
||||
# Skip target-specific params
|
||||
help_params = [x for x in help_params.keys() if not target_specific(x)]
|
||||
|
||||
# Find section in .texi manual with parameters
|
||||
texi = ([x.strip() for x in open(args.texi_file).readlines()])
|
||||
@ -66,14 +72,13 @@ for line in texi:
|
||||
texi_params.append(line[len(token):])
|
||||
break
|
||||
|
||||
# skip digits
|
||||
# Skip digits
|
||||
texi_params = [x for x in texi_params if not x[0].isdigit()]
|
||||
# skip aarch64 params
|
||||
texi_params = [x for x in texi_params if not x.startswith('aarch64')]
|
||||
sorted_params = sorted(texi_params)
|
||||
# Skip target-specific params
|
||||
texi_params = [x for x in texi_params if not target_specific(x)]
|
||||
|
||||
texi_set = set(texi_params) - ignored
|
||||
params_set = set(params.keys()) - ignored
|
||||
params_set = set(help_params) - ignored
|
||||
|
||||
success = True
|
||||
extra = texi_set - params_set
|
||||
|
Loading…
Reference in New Issue
Block a user