From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53E42C433E0 for ; Tue, 9 Mar 2021 13:39:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 17702651C7 for ; Tue, 9 Mar 2021 13:39:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230489AbhCINij (ORCPT ); Tue, 9 Mar 2021 08:38:39 -0500 Received: from smtp1.goneo.de ([85.220.129.30]:55954 "EHLO smtp1.goneo.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231175AbhCINiU (ORCPT ); Tue, 9 Mar 2021 08:38:20 -0500 X-Greylist: delayed 449 seconds by postgrey-1.27 at vger.kernel.org; Tue, 09 Mar 2021 08:38:19 EST Received: from [192.168.1.127] (dyndsl-085-016-044-246.ewe-ip-backbone.de [85.16.44.246]) by smtp1.goneo.de (Postfix) with ESMTPSA id 5F1452038178; Tue, 9 Mar 2021 14:30:48 +0100 (CET) Subject: Re: [RFC] scripts: kernel-doc: avoid warnings due to initial commented lines in file To: Aditya Srivastava , corbet@lwn.net Cc: lukas.bulwahn@gmail.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org References: <20210309125324.4456-1-yashsri421@gmail.com> From: Markus Heiser Message-ID: <8959bf29-9ee1-6a1d-da18-f440232864f3@darmarit.de> Date: Tue, 9 Mar 2021 14:30:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210309125324.4456-1-yashsri421@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-DE Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 09.03.21 um 13:53 schrieb Aditya Srivastava: > Starting commented lines in a file mostly contains comments describing > license, copyright or general information about the file. > > E.g., in sound/pci/ctxfi/ctresource.c, initial comment lines describe > its copyright and other related file informations. The opening comment mark /** is used for kernel-doc comments [1] [1] https://www.kernel.org/doc/html/latest/doc-guide/kernel-doc.html#how-to-format-kernel-doc-comments -- Markus -- > > But as kernel-doc reads these lines, it results in ineffective warnings by > kernel-doc, related to these. > > Provide a simple fix by skipping first three lines in a file for checking > kernel-doc comments. > > Suggested-by: Lukas Bulwahn > Signed-off-by: Aditya Srivastava > --- > scripts/kernel-doc | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/scripts/kernel-doc b/scripts/kernel-doc > index e1e562b2e2e7..431add05248e 100755 > --- a/scripts/kernel-doc > +++ b/scripts/kernel-doc > @@ -2375,6 +2375,7 @@ sub process_file($) { > my $file; > my $initial_section_counter = $section_counter; > my ($orig_file) = @_; > + my $lineno = 0; # to maintain the count of line number in a file > > $file = map_filename($orig_file); > > @@ -2388,13 +2389,16 @@ sub process_file($) { > > $section_counter = 0; > while () { > + $lineno++; > while (s/\\\s*$//) { > $_ .= ; > + $lineno++; > } > # Replace tabs by spaces > while ($_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}; > # Hand this line to the appropriate state handler > - if ($state == STATE_NORMAL) { > + if ($state == STATE_NORMAL > + && $lineno > 3) { # to avoid starting comment lines describing the file > process_normal(); > } elsif ($state == STATE_NAME) { > process_name($file, $_); >