Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp616682pxb; Wed, 18 Nov 2020 12:39:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJwyBoHCniieww91j7xEDYz8rjoQ8nz0m75lmkGm2hLB5Ubq2Irjuwq6I9/uEm086nDKRQ0c X-Received: by 2002:a50:da46:: with SMTP id a6mr23248933edk.272.1605731968676; Wed, 18 Nov 2020 12:39:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605731968; cv=none; d=google.com; s=arc-20160816; b=xhptsw4ik3Nh7EBM2UVeySzdIgMgNbfNkbeLd+X3bAKcXOVf+0REi8bOqR36UKUNCH Tv5UnT9BAAq45k+Ssz6rwH4G8qQKG+XUKiu8h0F0J7hltFMA1VOvSItWqTxdQaKamwE4 DDKZd/PCN2EJMcwFUv+lBRMEFuAmaguiZ0aOjRSee81VGMOlIz0So0B6/qFvyOqriRDc hxY/MmShvCwONVYzfSLrImoxEbDS+fCBj5cnlZLRy9BYxErrrq3zM3zY/ddRHzdeLKJj RgdxFKJ9naHMgrCpobi+42ri+Nc8BkE28nH51khjPWolpTh4+e5JkPR55BIPyLzyh+Vo LH6g== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=N4rh6qYeSLhbtywyxuUli1QgxfaNpyxfMnDpzDKmwzM=; b=aBLmFRDeR+yiI6ZC2ReXe5xTS7seK2d3xAVOu0u/a9EbMKg7IaGF3fg+FYCvdoXUGo aUrUfG4N5+QUbAj2h+B7rY2giNvLZJYdPLmdOI0gZSapBe5eG2v89EtIkcPpoBGJWpQq wOZkbdlU2nrAEOJzpSvH8ckkrd/FUKhg36SfHVNLop5DAUdLFOVDCKsdZjOeblyCwUrW 4bLpGrmmZh3nFwvX0XiP3E5GfqVMLQlx/7FeanKy5/aGzSB621/YrpVQhVwRQImQN0PT qjc14pjwjuT2uMbsw63AG2xUOJXnenOiBn4rDCNUnKU7QQn7l7PGHavsxDg6nLaQo4Ah k6EA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i3si10100177ejv.10.2020.11.18.12.39.03; Wed, 18 Nov 2020 12:39:28 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727092AbgKRUhG (ORCPT + 99 others); Wed, 18 Nov 2020 15:37:06 -0500 Received: from ms.lwn.net ([45.79.88.28]:46502 "EHLO ms.lwn.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725710AbgKRUhG (ORCPT ); Wed, 18 Nov 2020 15:37:06 -0500 Received: from lwn.net (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ms.lwn.net (Postfix) with ESMTPSA id D816B1F5B; Wed, 18 Nov 2020 20:37:05 +0000 (UTC) Date: Wed, 18 Nov 2020 13:37:04 -0700 From: Jonathan Corbet To: "=?UTF-8?B?TsOtY29sYXM=?= F. R. A. Prado" Cc: Mauro Carvalho Chehab , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, lkcamp@lists.libreplanetbr.org, andrealmeid@collabora.com Subject: Re: [PATCH v2] docs: automarkup.py: Allow automatic cross-reference inside C namespace Message-ID: <20201118133704.43977072@lwn.net> In-Reply-To: <20201117021107.214704-1-nfraprado@protonmail.com> References: <20201117021107.214704-1-nfraprado@protonmail.com> Organization: LWN.net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 17 Nov 2020 02:12:01 +0000 NĂ­colas F. R. A. Prado wrote: > Sphinx 3.1 introduced namespaces for C cross-references. With this, > each C domain type/function declaration is put inside the namespace that > was active at the time of its declaration. > > Add support for automatic cross-referencing inside C namespaces by > checking whether the corresponding source file had a C namespace Sphinx > directive, and if so, try cross-referencing inside of it before going to > the global scope. > > This assumes there's only one namespace (if any) per rst file. > > Signed-off-by: NĂ­colas F. R. A. Prado > --- > > To those following from v1: > > I ended up doing the simplest solution possible, which is to just directly read > the rst source corresponding to the doc page right before doing the automarkup. > It's not very efficient in the sense that the source is being read > twice (first by Sphinx, then by this), but it sidesteps the "data sharing > between processes" issue, so parallel_read_safe can be reenabled, and I didn't > notice any performance hit from this patch (as opposed to the big hit from v1). > Works with both Sphinx 2 and 3. The solution does lack elegance, but it is a solution, which is more than we had before :) That said, rather than re-opening and re-reading the file, why not just connect to the source-read event, which will happily hand you the document source that it has already read? Thanks, jon