Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp297117pxx; Thu, 29 Oct 2020 02:56:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWhgDOUTHlTQEg3YH58nqz6yqv1Ed9rCRM6l7t8oCs/TpCQwv119BrnGpXnHPLWCVaELSJ X-Received: by 2002:a17:906:25cc:: with SMTP id n12mr3080520ejb.488.1603965396162; Thu, 29 Oct 2020 02:56:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603965396; cv=none; d=google.com; s=arc-20160816; b=aTmmMhMwKAVamZEb6agHT/pn7UcTLMAh4oymUIjqzTZJRjNd9O1zlLu8F+rmMzvZ2F 1aZHHuz7zIdah36sKpRH5w6GQHDjRydWJNYoOj/El5J9RF3bCsfZRvPsD/IglyvRY0bA 0m0P9BGOq22KdmXwEr0C9ld/AqSVWJzVzTGP2l1sIEqPdUhG7zrlSsDvg8hEobuCiTpV 5/ESAhr1ZZ1SBH+ag9gerVjCysbtm4rZOySpvRPPxNPj0YY0AgUqBTDaODJsqnY9TsS4 MLeJKEAFMnMAP5IWP5v+Bx3b5sjdp3OxMtwmJhZqnLXjzSX7GG8EhHlAgT9+zynT8eSr M5OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iLfe59KAmPg1XF7f/kg0L59jZAFiLBbyWmstWLvETVE=; b=LTx1Mm4lqFbJQkjwSMGA6T6kSbKA1XXslZ86i31iPFvTqcA6a5+G5JfZH9pxfdWBJh arvwr7iZqrr74OFujBYVZBkKi0akjwalgmZmRfh124MirUT51YuvZdxUNB8/YCM8mG1m EdBwUNe7YHJL3SnNp7z9mtrSnZif4B/xFnRJhPl0wzXQZVLZ1tT7LXA0mNKtCQxnenTa eWPpCDMkrq5bushK6m22GHNP9lXeIVHwcHkJKFopdL4Q1yH7GJNhcDKZfcLm0QiyAYee gtwRXZXRtKd1IyKW2GNveCmmZcR01eoK5HkvvJo7VR+BE9Qd4olY+lefQ0joazfhJXWa VA8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kTNF5Pqj; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t13si1674920edj.45.2020.10.29.02.56.14; Thu, 29 Oct 2020 02:56:36 -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=@kernel.org header.s=default header.b=kTNF5Pqj; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732391AbgJ1WU4 (ORCPT + 99 others); Wed, 28 Oct 2020 18:20:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:60522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731696AbgJ1WRl (ORCPT ); Wed, 28 Oct 2020 18:17:41 -0400 Received: from mail.kernel.org (ip5f5ad5b2.dynamic.kabel-deutschland.de [95.90.213.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B23DB2476E; Wed, 28 Oct 2020 14:23:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603895014; bh=RbVYiyu/rnWFPmPj9R4bvXieqOVYpclyWM2vnETsDtk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kTNF5Pqjd1M4SY1bzV51A86oc9KUrFY736pMM1/DVy3MTp/dGcJf0MYBTmbhqw7zS a+jCuxZJgdr4Qb7aPUFKeGMWoA1w2EssdpleQJ2EdNYC58dwDKja4JKyT3kdRAhWrQ RTnicPpRM+JELSNJml6ExltnvUR0o8oL43wEo6HM= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kXmMO-003hlP-OH; Wed, 28 Oct 2020 15:23:32 +0100 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Greg Kroah-Hartman Cc: Mauro Carvalho Chehab , "Jonathan Corbet" , "Mauro Carvalho Chehab" , linux-kernel@vger.kernel.org Subject: [PATCH 15/33] docs: kernel_abi.py: use --enable-lineno for get_abi.pl Date: Wed, 28 Oct 2020 15:23:13 +0100 Message-Id: <7ae62dc8a05ece0b1c04a57dde0ad25d62d13742.1603893146.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Mauro Carvalho Chehab Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mauro Carvalho Chehab Just like kernel-doc extension, we need to be able to identify what part of an imported document has issues, as reporting them as: get_abi.pl rest --dir $srctree/Documentation/ABI/obsolete --rst-source:1689: ERROR: Unexpected indentation. Makes a lot harder for someone to fix. It should be noticed that it the line which will be reported is the line where the "What:" definition is, and not the line with actually has an error. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- Documentation/sphinx/kernel_abi.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Documentation/sphinx/kernel_abi.py b/Documentation/sphinx/kernel_abi.py index 8601a3b75a28..096dec482e96 100644 --- a/Documentation/sphinx/kernel_abi.py +++ b/Documentation/sphinx/kernel_abi.py @@ -36,6 +36,7 @@ import codecs import os import subprocess import sys +import re from os import path @@ -93,7 +94,7 @@ class KernelCmd(Directive): env = doc.settings.env cwd = path.dirname(doc.current_source) - cmd = "get_abi.pl rest --dir " + cmd = "get_abi.pl rest --enable-lineno --dir " cmd += self.arguments[0] srctree = path.abspath(os.environ["srctree"]) @@ -137,7 +138,7 @@ class KernelCmd(Directive): % (self.name, ErrorString(exc))) return out - def nestedParse(self, lines, fname): + def nestedParse(self, lines, f): content = ViewList() node = nodes.section() @@ -147,8 +148,17 @@ class KernelCmd(Directive): code_block += "\n " + l lines = code_block + "\n\n" - for c, l in enumerate(lines.split("\n")): - content.append(l, fname, c) + line_regex = re.compile("^#define LINENO (\S+)\#([0-9]+)$") + ln = 0 + + for line in lines.split("\n"): + match = line_regex.search(line) + if match: + f = match.group(1) + # sphinx counts lines from 0 + ln = int(match.group(2)) - 1 + else: + content.append(line, f, ln) buf = self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter -- 2.26.2