Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp586473ybd; Sat, 22 Jun 2019 09:59:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGgrVWGHJoPlB3T+0XsooovF9EeUNdEIBpUHh/V85KUpaRSJgqIwLxGGSzIAmk4AM3ZhKK X-Received: by 2002:a63:1a03:: with SMTP id a3mr23053410pga.397.1561222778447; Sat, 22 Jun 2019 09:59:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561222778; cv=none; d=google.com; s=arc-20160816; b=AINjDjotqsC7ZauYvPw32/tiZFrd07DZPjKFSrTD09Mq/IKuGBm6kqlRg+JFO8njhg zPjocBVnrEr+kjd/uKs6ucMl4dXz8zZeBxCsskDVZvL236NkmGW4fGFy07o/8XiN+LD6 ShjHZs4PKyy8ZmbuGZXMNOyn/k9Xx+VsaWX//Nd/+66JU4zjLVjBJpfb1j6TNUc0n2Hn 9qbaP2MzB1ARMasvj2+qBo3eo+xQAaGYPfoxOk/1U0h1nN9cvqK1/CopP82tdgi76lWb lc6WzYbdbjuqHzx6MylX4d2N/SAySldyO0GO2ubWj5dZmyG5ekbuYXUrVj6/cTQXC1+d XYCg== 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=nwm0MuWiU+CZGPXfeq9z6A2WqAr7Jlbvc3SpX02xbaE=; b=ogK2srweDuXkjeWXS16KGatYPQI0c9kn5ChrlvImuaFcuswMEZICka1UUXzpdjaT7U F+DMbkyMUoC+0bTXwg/q47iv2tQtoH0DtujN5GjR3f5Wa82sWQ0kvHR2UtiyVin3SfKu GVMexMrK3HE+JIN4a9RJalr6tA9l76x1yTnIQF9rEiZouCPILNWy1u6bK5Kkl7jJFbMB HLaRqdcBCcBCRan42BK6839eeeKpcPdF57OlrlFbFwdm3ihcApV7ED7bnXvILSgqPsK+ mjwSN5T2eZUMIdhnhFcs54wsQnfFIFBYpguaSShyyoXtp8eHbabWBOK7RtcrzQ9rlSZk quTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="mt+wLPE/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z191si3524750pgd.446.2019.06.22.09.59.23; Sat, 22 Jun 2019 09:59:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="mt+wLPE/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726584AbfFVQ7K (ORCPT + 99 others); Sat, 22 Jun 2019 12:59:10 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:42790 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726333AbfFVQ67 (ORCPT ); Sat, 22 Jun 2019 12:58:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=nwm0MuWiU+CZGPXfeq9z6A2WqAr7Jlbvc3SpX02xbaE=; b=mt+wLPE/Lm93/twaJPuBpSoBpg QEkWtEzGEy+SkmD28j/POVyfDygA78mdyWAp+XlU1YvKrF3EyWcxm/zKoQOkWsADS/Ncb06o2yDBI /qH+/M8Tq++j6IQ8SWhhqz/tXAv9yjpzE6W/GcsGKIAucqJYage4Zu/pTku0VC+4nRdnlf7kp6xaa 4BLMi0srfPoRv4YBi+dbK1ASCdfns9kUE4qVqi1jNt4aKkoJj7EKGMd6HiZCV0uUr3LrqdfLfo7tG TPKN+KynCQ9HdYMCX1JT/MfisHvYTnldYiJhOTb6MqvANdJ+eSwmT+tkYlJLpqWN2LG00Q3m3zG3K EwvGy2oQ==; Received: from [179.95.45.115] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hejLu-00054t-FV; Sat, 22 Jun 2019 16:58:58 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.92) (envelope-from ) id 1hejLs-0000vk-1m; Sat, 22 Jun 2019 13:58:56 -0300 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , gregkh@linuxfoundation.org, Jonathan Corbet Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org Subject: [PATCH 10/12] docs: kernel_abi.py: use --enable-lineno for get_abi.pl Date: Sat, 22 Jun 2019 13:58:51 -0300 Message-Id: <959b98c5ff9f2f0889e57e330246d5ac7a61b45d.1561221403.git.mchehab+samsung@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 5d43cac73d0a..efa338e18764 100644 --- a/Documentation/sphinx/kernel_abi.py +++ b/Documentation/sphinx/kernel_abi.py @@ -35,6 +35,7 @@ import codecs import os import subprocess import sys +import re from os import path @@ -92,7 +93,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"]) @@ -136,7 +137,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() @@ -146,8 +147,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.21.0