From: Markus Heiser <markus.heiser@darmarit.de>
To: Aditya Srivastava <yashsri421@gmail.com>, corbet@lwn.net
Cc: linux-kernel-mentees@lists.linuxfoundation.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [RFC] scripts: kernel-doc: avoid warnings due to initial commented lines in file
Date: Tue, 9 Mar 2021 14:30:48 +0100 [thread overview]
Message-ID: <8959bf29-9ee1-6a1d-da18-f440232864f3@darmarit.de> (raw)
In-Reply-To: <20210309125324.4456-1-yashsri421@gmail.com>
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 <lukas.bulwahn@gmail.com>
> Signed-off-by: Aditya Srivastava <yashsri421@gmail.com>
> ---
> 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 (<IN_FILE>) {
> + $lineno++;
> while (s/\\\s*$//) {
> $_ .= <IN_FILE>;
> + $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, $_);
>
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
next prev parent reply other threads:[~2021-03-09 13:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-09 12:53 [RFC] scripts: kernel-doc: avoid warnings due to initial commented lines in file Aditya Srivastava
2021-03-09 13:30 ` Markus Heiser [this message]
2021-03-09 21:24 ` Aditya
2021-03-10 6:19 ` Lukas Bulwahn
2021-03-11 21:03 ` Aditya
2021-03-12 7:00 ` Lukas Bulwahn
2021-03-15 19:25 ` Jonathan Corbet
2021-03-18 10:55 ` Lukas Bulwahn
2021-03-18 16:37 ` Jonathan Corbet
2021-03-18 17:52 ` Lukas Bulwahn
2021-03-18 18:18 ` Jonathan Corbet
2021-03-20 6:53 ` Aditya
2021-03-20 12:45 ` Aditya Srivastava
2021-03-20 13:21 ` Lukas Bulwahn
2021-03-20 13:33 ` Aditya Srivastava
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8959bf29-9ee1-6a1d-da18-f440232864f3@darmarit.de \
--to=markus.heiser@darmarit.de \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yashsri421@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).