Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp373016pxu; Wed, 14 Oct 2020 03:44:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyf71S0nbBXHXYm7dXsBNSzk6Q4CxDaEzP1/4uVebQ3Bam0/KtDIEYJMkLehNyF0+m7hEeT X-Received: by 2002:a05:6402:17e4:: with SMTP id t4mr4530865edy.118.1602672248941; Wed, 14 Oct 2020 03:44:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602672248; cv=none; d=google.com; s=arc-20160816; b=Lj8XM8gYY+On1vxiV5kxPTnPLPCG+oJGe4v29JUZbFgG1qgN9LfLn/JwXATMCT2W+8 kziFn7SVaNFoPMUIp4FDgdZqAavmQn/o84s2vv5Dk5HzG8imq/FXn9s4J/+rT0kOyE+B GY90SgH2jv5U/SQHt94OsJhR/ATG5twn1uoL8bAibcv/dkObbh0C1EV88h/5xmVd+8Ya XbQDQ+c/GT/r0U1eKTMqcTxDKdn6JzFZ6Xuw0e+eybrije1aIjnYPpbjOl959iB0Djex lFVKocrtstZd3t7J5GbRWkWD8hTryEsasC05E6mrCk20rStF3qc9GmI5Ci2w1q9DvXIl Pg0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:reply-to:cc:from:to :dkim-signature:date; bh=l5mfTT+ZDsjWcxt5ntRYnJlT/3bmT/nmNIU8VUnpYFM=; b=wHkNLxgSMntHPWfvwIMrieJeTB0/k9Z6i0JnMzHQaCGwipiKq8R9ZAwfyB+xJBWOV8 JxJ/6nvjTmvmHcn2XbW2WezWJwv8rpOttjVGPVlJBBFXCdCTEuFUjQ7eblo+V9EjzNIZ xKDCLaGbijW+fU1bw6XsQDFLz7NVSmVKl0L/GXQ04JDfw4/CPztdZeKqoHcdN/5xQYw2 q39bBPee3ycrDPWGUKXvTazr9yPOE/nME2ONRF9wIvhmgXKN81h54oKg8nYtQT4ANOTq PrcB7HMCrvNekUhQwhGmu04bUD0Rm0AMS+at+nQRE4300ytPQ6XGIDUPl8s2byP4V17j mjSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail header.b=mEQOr06p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m8si1957421ejo.140.2020.10.14.03.43.46; Wed, 14 Oct 2020 03:44:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail header.b=mEQOr06p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388275AbgJMXNb (ORCPT + 99 others); Tue, 13 Oct 2020 19:13:31 -0400 Received: from mail1.protonmail.ch ([185.70.40.18]:11037 "EHLO mail1.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729677AbgJMXNa (ORCPT ); Tue, 13 Oct 2020 19:13:30 -0400 Date: Tue, 13 Oct 2020 23:13:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1602630808; bh=l5mfTT+ZDsjWcxt5ntRYnJlT/3bmT/nmNIU8VUnpYFM=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=mEQOr06pbG6qeU7IGStY1NEPyGfAJLWpX4cv4zaQS1HpP7SjxrsdUFS2grzJgoO00 J1CZKhsp4X+2gtYf+XbZI2ZRyp14nJOC4gTbYO8KP06dUEWHiRMe1R4YESEXOdz/0+ KrdX2v1LQNlUD2J5WMBh+uzfy+oGGF2Gu/1jTXbY= To: Jonathan Corbet , Mauro Carvalho Chehab From: =?utf-8?Q?N=C3=ADcolas_F=2E_R=2E_A=2E_Prado?= Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, lkcamp@lists.libreplanetbr.org, andrealmeid@collabora.com Reply-To: =?utf-8?Q?N=C3=ADcolas_F=2E_R=2E_A=2E_Prado?= Subject: [PATCH v2 3/5] docs: automarkup.py: Skip C reserved words when cross-referencing Message-ID: <20201013231218.2750109-4-nfraprado@protonmail.com> In-Reply-To: <20201013231218.2750109-1-nfraprado@protonmail.com> References: <20201013231218.2750109-1-nfraprado@protonmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With the transition to Sphinx 3, new warnings were caused by automarkup, exposing bugs in the name matching. When automarkup parsed a text like "struct struct" in the documentation, it tried to cross-reference to a "struct" symbol, which is recognized as a C reserved word by Sphinx 3, generating a warning. Add some C reserved words (only the ones that were causing warnings) to a list and skip them while trying to cross-reference. Signed-off-by: N=C3=ADcolas F. R. A. Prado --- Documentation/sphinx/automarkup.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Documentation/sphinx/automarkup.py b/Documentation/sphinx/auto= markup.py index 43dd9025fc77..1cc3a2cf2a88 100644 --- a/Documentation/sphinx/automarkup.py +++ b/Documentation/sphinx/automarkup.py @@ -45,6 +45,12 @@ RE_typedef =3D re.compile(r'\b(typedef)\s+([a-zA-Z_]\w+)= ', flags=3Dre.ASCII) # RE_doc =3D re.compile(r'\bDocumentation(/[\w\-_/]+)(\.\w+)*') =20 +# +# Reserved C words that we should skip when cross-referencing +# +Skipnames =3D [ 'for', 'if', 'register', 'sizeof', 'struct', 'unsigned' ] + + # # Many places in the docs refer to common system calls. It is # pointless to try to cross-reference them and, as has been known @@ -133,7 +139,8 @@ def markup_c_ref(docname, app, match): target =3D match.group(2) target_text =3D nodes.Text(match.group(0)) xref =3D None - if not (match.re =3D=3D RE_function and target in Skipfuncs): + if not ((match.re =3D=3D RE_function and target in Skipfuncs) + or (target in Skipnames)): lit_text =3D nodes.literal(classes=3D['xref', 'c', class_str[match= .re]]) lit_text +=3D target_text pxref =3D addnodes.pending_xref('', refdomain =3D 'c', --=20 2.28.0