History

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.

Aditya Srivastava committed 5 years ago

Commit 084aa001 parent 6dbc9751 file · +2 −0Browse files

Showing the changes to scripts/kernel-doc (1 of 1 file). Show all

Unified · Split

scripts/kernel-doc+2−0
@@ -1766,12 +1766,14 @@ sub dump_function($$) { · 1765 unmodified lines
1766 $prototype =~ s/^noinline +//;1766 $prototype =~ s/^noinline +//;
1767 $prototype =~ s/__init +//;1767 $prototype =~ s/__init +//;
1768 $prototype =~ s/__init_or_module +//;1768 $prototype =~ s/__init_or_module +//;
1769 $prototype =~ s/__flatten +//;
1769 $prototype =~ s/__meminit +//;1770 $prototype =~ s/__meminit +//;
1770 $prototype =~ s/__must_check +//;1771 $prototype =~ s/__must_check +//;
1771 $prototype =~ s/__weak +//;1772 $prototype =~ s/__weak +//;
1772 $prototype =~ s/__sched +//;1773 $prototype =~ s/__sched +//;
1773 $prototype =~ s/__printf\s*\(\s*\d*\s*,\s*\d*\s*\) +//;1774 $prototype =~ s/__printf\s*\(\s*\d*\s*,\s*\d*\s*\) +//;
1774 my $define = $prototype =~ s/^#\s*define\s+//; #ak added1775 my $define = $prototype =~ s/^#\s*define\s+//; #ak added
1776 $prototype =~ s/__attribute_const__ +//;
1775 $prototype =~ s/__attribute__\s*\(\(1777 $prototype =~ s/__attribute__\s*\(\(
1776 (?:1778 (?:
1777 [\w\s]++ # attribute name1779 [\w\s]++ # attribute name