public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-5461] contrib: Support itemx in check-params-in-docs.py.
Date: Tue, 23 Nov 2021 07:28:15 +0000 (GMT)	[thread overview]
Message-ID: <20211123072815.85D41385801F@sourceware.org> (raw)

https://gcc.gnu.org/g:cab8f69857d0c551ef760079a027323dda6b2694

commit r12-5461-gcab8f69857d0c551ef760079a027323dda6b2694
Author: Martin Liska <mliska@suse.cz>
Date:   Tue Nov 23 08:26:51 2021 +0100

    contrib: Support itemx in check-params-in-docs.py.
    
    contrib/ChangeLog:
    
            * check-params-in-docs.py: Support @itemx in param documentation
            and support multi-line documentation for parameters.

Diff:
---
 contrib/check-params-in-docs.py | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/contrib/check-params-in-docs.py b/contrib/check-params-in-docs.py
index 440549f5fd8..d57055088b7 100755
--- a/contrib/check-params-in-docs.py
+++ b/contrib/check-params-in-docs.py
@@ -47,7 +47,7 @@ ignored = {'logical-op-non-short-circuit'}
 params = {}
 
 for line in open(args.params_output).readlines():
-    if line.startswith('  '):
+    if line.startswith(' ' * 2) and not line.startswith(' ' * 8):
         r = get_param_tuple(line)
         params[r[0]] = r[1]
 
@@ -57,15 +57,20 @@ texi = dropwhile(lambda x: 'item --param' not in x, texi)
 texi = takewhile(lambda x: '@node Instrumentation Options' not in x, texi)
 texi = list(texi)[1:]
 
-token = '@item '
-texi = [x[len(token):] for x in texi if x.startswith(token)]
+texi_params = []
+for line in texi:
+    for token in ('@item ', '@itemx '):
+        if line.startswith(token):
+            texi_params.append(line[len(token):])
+            break
+
 # skip digits
-texi = [x for x in texi if not x[0].isdigit()]
+texi_params = [x for x in texi_params if not x[0].isdigit()]
 # skip aarch64 params
-texi = [x for x in texi if not x.startswith('aarch64')]
-sorted_texi = sorted(texi)
+texi_params = [x for x in texi_params if not x.startswith('aarch64')]
+sorted_params = sorted(texi_params)
 
-texi_set = set(texi) - ignored
+texi_set = set(texi_params) - ignored
 params_set = set(params.keys()) - ignored
 
 success = True
@@ -84,7 +89,4 @@ if len(missing):
         print()
     success = False
 
-if texi != sorted_texi:
-    print('WARNING: not sorted alphabetically!')
-
 sys.exit(0 if success else 1)


                 reply	other threads:[~2021-11-23  7:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211123072815.85D41385801F@sourceware.org \
    --to=marxin@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).