Skip to content

Commit 084aa00

Browse files
AdityaSrivastJonathan Corbet
authored andcommitted
scripts: kernel-doc: fix attribute capture in function parsing
Currently, kernel-doc warns for function prototype parsing on the presence of attributes "__attribute_const__" and "__flatten" in the definition. There are 166 occurrences in ~70 files in the kernel tree for "__attribute_const__" and 5 occurrences in 4 files for "__flatten". Out of 166, there are 3 occurrences in three different files with "__attribute_const__" and a preceding kernel-doc; and, 1 occurrence in ./mm/percpu.c for "__flatten" with a preceding kernel-doc. All other occurrences have no preceding kernel-doc. Add support for "__attribute_const__" and "__flatten" attributes. 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. Suggested-by: Lukas Bulwahn <lukas.bulwahn@gmail.com> Signed-off-by: Aditya Srivastava <yashsri421@gmail.com> Link: https://lore.kernel.org/r/20210306113510.31023-1-yashsri421@gmail.com Signed-off-by: Jonathan Corbet <corbet@lwn.net>
1 parent 6dbc975 commit 084aa00

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎scripts/kernel-doc‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,12 +1766,14 @@ sub dump_function($$) {
17661766
$prototype =~ s/^noinline +//;
17671767
$prototype =~ s/__init +//;
17681768
$prototype =~ s/__init_or_module +//;
1769+
$prototype =~ s/__flatten +//;
17691770
$prototype =~ s/__meminit +//;
17701771
$prototype =~ s/__must_check +//;
17711772
$prototype =~ s/__weak +//;
17721773
$prototype =~ s/__sched +//;
17731774
$prototype =~ s/__printf\s*\(\s*\d*\s*,\s*\d*\s*\) +//;
17741775
my $define = $prototype =~ s/^#\s*define\s+//; #ak added
1776+
$prototype =~ s/__attribute_const__ +//;
17751777
$prototype =~ s/__attribute__\s*\(\(
17761778
(?:
17771779
[\w\s]++ # attribute name

0 commit comments

Comments
 (0)