From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by sourceware.org (Postfix) with ESMTPS id 79CDC3858417 for ; Fri, 12 Apr 2024 07:40:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 79CDC3858417 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=baylibre.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 79CDC3858417 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::633 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712907617; cv=none; b=O7yZEZMr9kYbcUW/m9GDZNNJnOx12SzmkFj+fleaMiLwsh9nbTjpalDG5uLcLjYoEI74KEaY2Z+tDkBqCy0iALrpFD++TMHFz0cROHz6yxVS5yFQjtCqQbIBNh7dFJSXPh5+BR58eYUMjdSgy7U/hkcU6CRY4/lTPK+Sd5VeQdo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712907617; c=relaxed/simple; bh=30zADiMZbHlJIuf6urW3ZvFpGsne/arQlsaMnfT+seU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Mp742vDksT+mkqQofvCayD5wc2tWShwvYPg0NlSpDdD50iuWxVuewD/W/JlJmXS6dUzGC5v9KPExmasJCYI3eWIVzXixu+dTRZUN7FZESwTVQZmBfM5C9q45xEGk/wdbAdLrVWMZ5iv4myjihr+jVIpfmLReKP3sf06+sfFEmgk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a450bedffdfso69503966b.3 for ; Fri, 12 Apr 2024 00:40:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1712907614; x=1713512414; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JJahoaw+S36VkohVFTcRs4h/SEwrLadC7NQa9iFfM8Y=; b=omi1roxONJUOgLmIM8U1y8dqaOFMHAEhtwd0aZDbDj8opj2OEkR5ykoR9WP8hdDdK8 eSRS7pGs33BsoXKlBtd1k+99wneiLPmfNkAkqAxaXQBrJsCF1jAE88PPCBFwLrOHNDEd O6JjrSKWIuS5nVTYpYxePXA4H7ErI8y18pWsXsQkdgMmCtjU69zVTgZ1MBRCfyolLhpD KC5T1XO0lUs9s0+UmLUOXsv6BrdYKif1xocJ3WBKmvHPFyYjeAUhg1w4X9+NrwICnwF3 UUsvUTg51XGRaJVZgOmGMeM2ba2nwcCuY3iTXAa25yNmeJ0cY8WZwdXXAUmc1+UL+Xkf OS/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712907614; x=1713512414; h=content-transfer-encoding:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=JJahoaw+S36VkohVFTcRs4h/SEwrLadC7NQa9iFfM8Y=; b=C2Y7y0othCTYGMt6+DfwHiN+rUZz6NvckDE52227yHlDlxFwPfW0Dc8MQbopZYq7AG bVJ3NuaRU3bR1/q8ejDhlFp2LsIddP/MDHdTwz7NV33f9lGgrQyqNOmglnfsJXj7uoYh kMI8v7VNvP7/hJ5jRcZuN2Zy2ZwU9y9Ng4sO7DGoqBQ8VjE2NhKEaj34nNb58REW0N/+ XLxotP6CgZovw4oEYgmVLEU2OYoU/oNXuVHKgzmiP0rXvEv+OSYMy545lbaJFNJ72IFu ZbS3k3DWiC1Q0uwCPPXgf+vRvLCcv6BZuG8Ml0YrZIaAZOaFKcqO63QR+RYvpnTKLQLv bGWw== X-Gm-Message-State: AOJu0YxPet2veIiwbK+LpaLKKkECZt5ywLdcvCTLBXAtDOz45fwd6Rva MYVC+tM0gRo4K95AvQ6t7fwQGTqAFnpq1PFs1kZHoaJNhm5ZLBC8LL3EvOmWcWs= X-Google-Smtp-Source: AGHT+IHcDKlBxTD3m6rFFfRQZtpz7xSSN1fo2krHX+OpcVTZh8QQEuSdmzRQXe9i7XVPwkLt0BmhDw== X-Received: by 2002:a17:906:d296:b0:a52:182c:cb6b with SMTP id ay22-20020a170906d29600b00a52182ccb6bmr1011263ejb.57.1712907613887; Fri, 12 Apr 2024 00:40:13 -0700 (PDT) Received: from euler.schwinge.homeip.net (p200300c8b70ce600fbf8323f8abe0da4.dip0.t-ipconnect.de. [2003:c8:b70c:e600:fbf8:323f:8abe:da4]) by smtp.gmail.com with ESMTPSA id qk11-20020a1709077f8b00b00a51d88e6164sm1514694ejc.203.2024.04.12.00.40.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 00:40:13 -0700 (PDT) From: Thomas Schwinge To: Filip Kastl , Martin Jambor Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] contrib/check-params-in-docs.py: Ignore target-specific params In-Reply-To: References: <87ttkbmwx1.fsf@euler.schwinge.ddns.net> <87le5jenqs.fsf@euler.schwinge.ddns.net> User-Agent: Notmuch/0.30+8~g47a4bad (https://notmuchmail.org) Emacs/29.2 (x86_64-pc-linux-gnu) Date: Fri, 12 Apr 2024 09:40:11 +0200 Message-ID: <87cyqvm3l0.fsf@euler.schwinge.ddns.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi! On 2024-04-12T09:08:13+0200, Filip Kastl wrote: > On Thu 2024-04-11 20:51:55, Thomas Schwinge wrote: >> On 2024-04-11T19:52:51+0200, Martin Jambor wrote: >> > contrib/check-params-in-docs.py is a script that checks that all >> > options reported with ./gcc/xgcc -Bgcc --help=3Dparam are in >> > gcc/doc/invoke.texi and vice versa. >>=20 >> Eh, first time I'm hearing about this one! >>=20 >> (a) Shouldn't this be running as part of the GCC build process? >>=20 >> > gcn-preferred-vectorization-factor is in the manual but normally not >> > reported by --help, probably because I do not have gcn offload >> > configured. >>=20 >> No, because you've not been building GCC for GCN target. ;-P >>=20 >> > This patch makes the script silently about this particular >> > fact. >>=20 >> (b) Shouldn't we instead ignore any '--param's with "gcn" prefix, similar >> to how that's done for "skip aarch64 params"? >>=20 >> (c) ..., and shouldn't we likewise skip any "x86" ones? >>=20 >> (d) ..., or in fact any target specific ones, following after the generic >> section? (Easily achieved with a special marker in >> 'gcc/doc/invoke.texi', just before: >>=20 >> The following choices of @var{name} are available on AArch64 targets: >>=20 >> ..., and adjusting the 'takewhile' in 'contrib/check-params-in-docs.py' >> accordingly? > I've made a patch to address (b), (c), (d). I didn't adjust takewhile. I > chose to do it differently since target-specific params in both invoke.te= xi and > --help=3Dparams have to be ignored. Right, I realized that after I had sent my email... > The downside of this patch is that the script won't complain if someone a= dds a > target-specific param and doesn't document it. Yes, but that's a pre-existing problem -- unless you happened to be targeting some x86 variant. The target-specific '--param's will have to be handled differently. > What do you think? Looks like a good incremental improvement to me, thanks! Gr=C3=BC=C3=9Fe Thomas > contrib/check-params-in-docs.py is a script that checks that all options > reported with gcc --help=3Dparams are in gcc/doc/invoke.texi and vice > versa. > gcc/doc/invoke.texi lists target-specific params but gcc --help=3Dparams > doesn't. This meant that the script would mistakenly complain about > parms missing from --help=3Dparams. 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 > --- > contrib/check-params-in-docs.py | 21 +++++++++++++-------- > 1 file changed, 13 insertions(+), 8 deletions(-) > > diff --git a/contrib/check-params-in-docs.py b/contrib/check-params-in-do= cs.py > index f7879dd8e08..ccdb8d72169 100755 > --- a/contrib/check-params-in-docs.py > +++ b/contrib/check-params-in-docs.py > @@ -38,6 +38,9 @@ def get_param_tuple(line): > description =3D line[i:].strip() > return (name, description) >=20=20 > +def target_specific(param): > + return param.split('-')[0] in ('aarch64', 'gcn', 'x86') > + >=20=20 > parser =3D argparse.ArgumentParser() > parser.add_argument('texi_file') > @@ -45,13 +48,16 @@ parser.add_argument('params_output') >=20=20 > args =3D parser.parse_args() >=20=20 > -ignored =3D {'logical-op-non-short-circuit', 'gcn-preferred-vectorizatio= n-factor'} > -params =3D {} > +ignored =3D {'logical-op-non-short-circuit'} > +help_params =3D {} >=20=20 > for line in open(args.params_output).readlines(): > if line.startswith(' ' * 2) and not line.startswith(' ' * 8): > r =3D get_param_tuple(line) > - params[r[0]] =3D r[1] > + help_params[r[0]] =3D r[1] > + > +# Skip target-specific params > +help_params =3D [x for x in help_params.keys() if not target_specific(x)] >=20=20 > # Find section in .texi manual with parameters > texi =3D ([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 >=20=20 > -# skip digits > +# Skip digits > texi_params =3D [x for x in texi_params if not x[0].isdigit()] > -# skip aarch64 params > -texi_params =3D [x for x in texi_params if not x.startswith('aarch64')] > -sorted_params =3D sorted(texi_params) > +# Skip target-specific params > +texi_params =3D [x for x in texi_params if not target_specific(x)] >=20=20 > texi_set =3D set(texi_params) - ignored > -params_set =3D set(params.keys()) - ignored > +params_set =3D set(help_params) - ignored >=20=20 > success =3D True > extra =3D texi_set - params_set > --=20 > 2.43.1