Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp806976ybi; Fri, 21 Jun 2019 08:28:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqwm113nteBMPObXtgbBzkMz89bpWLzVJEXvKQoBdjrSnX+pzHj7I4rbrbbpPuuQc0MGdG6G X-Received: by 2002:a63:3c14:: with SMTP id j20mr7378332pga.169.1561130931666; Fri, 21 Jun 2019 08:28:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561130931; cv=none; d=google.com; s=arc-20160816; b=aiWUopNqXHG5NoBCzRlF4KIaFZSHuth35KC/1rfbJmkbuQGx2v3ngxg3tpNOY8u/MS 5FfnOa8OYunh9jmW9lGz6Vmj9FhmagGloIYOzFj49RyKO1YuuafmxYMvf0UBKX4rHFFa b81PlDU5IXvMfYBRPq2LmMc2S2/bCaPCdjcfuwJCQlDrTIDZJHZpbpT+uG8Mvh18eEvX AzVABtFBMt/yK5ytx3nZFHoWwRSC18RXbx9lbkHLF9QvL4cRoyJplJ6l7w5IQlDl4mMa UnMZHH23BCRIqiNSYvTA25RiEKp78tuXu+qqOuK07tuibSt+Rw+N9TnZfr5f3s7uFqPW IPWQ== 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=OxYHxuhO2A3jKgWH7QzxkO6AYqKVbir/TdN17HPdksE=; b=KPzMX8iLk51zJIo71PegqcZkymLIMJhqstkJVZjPEPE588MRiPxQjh6GcwnVckF21k g0Dh+nkrtfmAjj4K9chYGj7RKFQbV87wV8blVtcnsywSkIcKFJ8wr3YHEaly1o4D6++U Q6OZJ4sw/E4p/lD+EWa925eYJZcC4AEUQFqfD0cjC5Ft+x8+cwhw7PQNN6B4BM1Y+Wsz usbAgzcior4enOVyjm9z+fVrnT/bbTjSWelpiDxK+gfVEC5wqwIz+m4RFSs+mIyeT5qm Og54+Mm1XYkodqMsz1mBF4QHitJ8akIGm+nxuc0syGaR88z8bWPbMObVMFbu7bEASkeU I/Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Vv006MlN; 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 i10si2641163pgs.231.2019.06.21.08.28.35; Fri, 21 Jun 2019 08:28:51 -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=Vv006MlN; 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 S1726451AbfFUP2L (ORCPT + 99 others); Fri, 21 Jun 2019 11:28:11 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:53300 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726067AbfFUP2I (ORCPT ); Fri, 21 Jun 2019 11:28:08 -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=OxYHxuhO2A3jKgWH7QzxkO6AYqKVbir/TdN17HPdksE=; b=Vv006MlNVoSUf9KgGWQStu1nZw /T9uCiyMM059iy8zwxh/6DZ67a9kwa5ZlKGL1kGYAbXRxILQRaWsxYXUGSsNMY4r6f2b6DtJE1qPj TayUoi8+6dO9x2A5j8g8vdSyzQHyAi6G6y0EV0b8lrD8IORh5zMOcfMdqP4HKlrOihy6enxCHjMaU OhMiWG3Z0EWozb71BnNyo8xK3XO0tBdnD4FiRR3ERo5IEzb57BeTJabGcoobaXzwDecHkGSSa56eE +b/oqWdJorVRtoSe+5jD125dF3BCiFV2UIIJ0QoR7smOgt2db0szOwaFPDejZKwPspQJ6xA4rGuRX QD5CbvfA==; Received: from [177.97.20.138] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1heLSR-0006As-KA; Fri, 21 Jun 2019 15:28:07 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.92) (envelope-from ) id 1heLSO-0005iF-Ja; Fri, 21 Jun 2019 12:28:04 -0300 From: Mauro Carvalho Chehab To: Linux Doc Mailing List Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Jonathan Corbet , gregkh@linuxfoundation.org Subject: [PATCH 2/2] docs: kernel_abi.py: use --enable-lineno for get_abi.pl Date: Fri, 21 Jun 2019 12:28:02 -0300 Message-Id: <3d64e957b8fb9bd17d4d7f7dbc4d77d76091d44d.1561130657.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 88dddb8f4152..7f00f9d04a53 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 @@ -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] @@ -141,7 +142,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() @@ -151,8 +152,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