[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210305184322.GN2723601@casper.infradead.org>
Date: Fri, 5 Mar 2021 18:43:22 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Aditya Srivastava <yashsri421@...il.com>
Cc: corbet@....net, lukas.bulwahn@...il.com, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-kernel-mentees@...ts.linuxfoundation.org
Subject: Re: [RFC] scripts: kernel-doc: fix attribute capture in function
parsing
On Fri, Mar 05, 2021 at 11:50:00PM +0530, Aditya Srivastava wrote:
> Provide a simple fix by adding "__attribute_const__" in the corresponding
> regex expression.
>
> A quick evaluation by running 'kernel-doc -none' on kernel-tree reveals
> that no additional warning or error has been added or removed by the fix.
I'm no perlmonger, but why isn't this simply:
+++ b/scripts/kernel-doc
@@ -1753,6 +1753,7 @@ sub dump_function($$) {
$prototype =~ s/^__inline +//;
$prototype =~ s/^__always_inline +//;
$prototype =~ s/^noinline +//;
+ $prototype =~ s/__attribute_const__ +//;
$prototype =~ s/__init +//;
$prototype =~ s/__init_or_module +//;
$prototype =~ s/__meminit +//;
(completely untested)
> +++ b/scripts/kernel-doc
> @@ -1753,6 +1753,7 @@ sub dump_function($$) {
> my $prototype = shift;
> my $file = shift;
> my $noret = 0;
> + my $attribute_const = qr{__attribute_const__};
>
> print_lineno($new_start_line);
>
> @@ -1808,7 +1809,7 @@ sub dump_function($$) {
> $prototype =~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
> $prototype =~ m/^(\w+\s*\*+)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
> $prototype =~ m/^(\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
> - $prototype =~ m/^(\w+\s+\w+\s*\*+)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
> + $prototype =~ m/^(\w+\s+\w+\s*\*+$attribute_const?)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
> $prototype =~ m/^(\w+\s+\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
> $prototype =~ m/^(\w+\s+\w+\s+\w+\s*\*+)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
> $prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
Powered by blists - more mailing lists