Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp586418ybd; Sat, 22 Jun 2019 09:59:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZNuz3MWPir6cBXBTyDxG2nWZLqwhT5xIF1eP3JRelSzid+MlGt/zbSktaUdJahPYFTjmI X-Received: by 2002:a63:f817:: with SMTP id n23mr24428938pgh.35.1561222774348; Sat, 22 Jun 2019 09:59:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561222774; cv=none; d=google.com; s=arc-20160816; b=eGIM8yw+pDXo8yU7G45jsGWeXRZJMhFDhRBOicREBnV0JG3tRzhMVDLPiNM8bEnoNi 4zmjEup/OFBaT9t0kP0yhWBH+8M7c0EubEuY1TReeIKQt2klaf5TKAbPoNHXJThpDg8n DkwCFlm03zrY2vLOv9071GsrWb6bkKSg906XKtWmypcSjaRFV36aepQ5TsoLqTC6enqY lXiOCYhomyIbOvLAhF4W5GhJKVZycOYZiUINjHDCrPrIuaK0XK67oTGjrG3Qx/RlS8iD s7VIynYmR0IbL1qwufgCrNBVZiKvmcWbYpmVLmUJL96hnVLLpRmZ7scGzE9YroX+Rj1J 5McA== 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=wUOTS3HryG6x00ef7iH2jAuPJMzHPQ4G3RtuWtIiYCg=; b=WXlHZH9CkZIie6NvEIQkm8FVu+tNmLjIgxyk/u9nDoL6o51ZV0GdD8VBQ/6Mw/r3xV oUrvMcjeMQm53ZRMPavRbcsqLVdrZh77d8B+cx/BVaQ6Q39WuGzzTI4LaKdkVCXlBqrO 9xukPZerpRVg+14yIehoGpWbVtdX1SHF8PRF2OvoRwjwmvoUi8dafRpBKae5PdrR4Mje Bi0YWxDXuxt9MT27qyy3oj07OunvgkFnti5jBU0S4713v6vgUl/8LgFYgu0oAXnsIRNF LA1AXgXZx/S1jDWQTGMSRYbF2R28uYhMKWiMQJQF03DXE8f+wPOKxnVZdUthwSZmbeXB xQ4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="K/xujI0h"; 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 e123si5301819pgc.479.2019.06.22.09.59.13; Sat, 22 Jun 2019 09:59:34 -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="K/xujI0h"; 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 S1726350AbfFVQ7F (ORCPT + 99 others); Sat, 22 Jun 2019 12:59:05 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:42782 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726304AbfFVQ67 (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=wUOTS3HryG6x00ef7iH2jAuPJMzHPQ4G3RtuWtIiYCg=; b=K/xujI0hmZp0FjlKtLwZmemMjS 1yNsp3HVxn0T5YhiyzjMZnyXmmRz7pm8EppALXyRjC0yWg7ZOh8DozbQjoakoK4kNEGipP1+3u/b/ dQNHr8M0J1wBzz3f7ECrW1EYD8r57ub+kAsxggl7jlBuxck/r7TaQYi2xx8aZmiIP474TzNGcWLCu f+Ns0Vt+8RohGjUOj66Z/Ws/CoXgNeklqSycdItTN5lsrmnWAXZAV4m/BSOZPGIxRctnE2jUi5IaU ZWU0Lb6/QqOog1BtIXz2gUniZVk0uwqbBkQdlJ83lt7W2L6D522Zt7JmCth6p9XwK/nRYCmJ+4g4Z xAdaqJvw==; 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-00054r-HC; Sat, 22 Jun 2019 16:58:58 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.92) (envelope-from ) id 1hejLr-0000vH-SE; Sat, 22 Jun 2019 13:58:55 -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 03/12] scripts/get_abi.pl: Allow optionally record from where a line came from Date: Sat, 22 Jun 2019 13:58:44 -0300 Message-Id: <911c5307e1aea9a2a65f313497671b600efa834c.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 The get_abi.pl reads a lot of files and can join them on a single output file. Store where each "What:" output came from, in order to be able to optionally display it. This is useful for the Sphinx extension, with can now be able to blame what ABI file has issues, and on what line the What: description with problems begin. Signed-off-by: Mauro Carvalho Chehab --- scripts/get_abi.pl | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/scripts/get_abi.pl b/scripts/get_abi.pl index 0c403af86fd5..6a4d387ebf3b 100755 --- a/scripts/get_abi.pl +++ b/scripts/get_abi.pl @@ -10,6 +10,7 @@ use Fcntl ':mode'; my $help; my $man; my $debug; +my $enable_lineno; my $prefix="Documentation/ABI"; # @@ -19,6 +20,7 @@ my $description_is_rst = 0; GetOptions( "debug|d+" => \$debug, + "enable-lineno" => \$enable_lineno, "rst-source!" => \$description_is_rst, "dir=s" => \$prefix, 'help|?' => \$help, @@ -67,6 +69,7 @@ sub parse_abi { $data{$nametag}->{file} = $name; $data{$nametag}->{filepath} = $file; $data{$nametag}->{is_file} = 1; + $data{$nametag}->{line_no} = 1; my $type = $file; $type =~ s,.*/(.*)/.*,$1,; @@ -126,6 +129,8 @@ sub parse_abi { if ($tag ne "" && $new_tag) { $tag = $new_tag; + $data{$what}->{line_no} = $ln; + if ($new_what) { @{$data{$what}->{label}} = @labels if ($data{$nametag}->{what}); @labels = (); @@ -221,6 +226,12 @@ sub output_rest { my $file = $data{$what}->{file}; my $filepath = $data{$what}->{filepath}; + if ($enable_lineno) { + printf "#define LINENO %s%s#%s\n\n", + $prefix, $data{$what}->{file}, + $data{$what}->{line_no}; + } + my $w = $what; $w =~ s/([\(\)\_\-\*\=\^\~\\])/\\$1/g; @@ -369,6 +380,10 @@ sub search_symbols { } } +# Ensure that the prefix will always end with a slash +# While this is not needed for find, it makes the patch nicer +# with --enable-lineno +$prefix =~ s,/?$,/,; # # Parses all ABI files located at $prefix dir @@ -395,7 +410,8 @@ abi_book.pl - parse the Linux ABI files and produce a ReST book. =head1 SYNOPSIS -B [--debug] [--man] [--help] --[(no-)rst-source] [--dir=] [] +B [--debug] [--enable-lineno] [--man] [--help] + [--(no-)rst-source] [--dir=] [] Where can be: @@ -425,6 +441,10 @@ selecting between a rst-compliant source ABI (--rst-source), or a plain text that may be violating ReST spec, so it requres some escaping logic (--no-rst-source). +=item B<--enable-lineno> + +Enable output of #define LINENO lines. + =item B<--debug> Put the script in verbose mode, useful for debugging. Can be called multiple -- 2.21.0