summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2017-01-02 16:22:24 +0100
committerJonathan Corbet <corbet@lwn.net>2017-01-04 15:07:42 -0700
commitb1aaa546b52baf7cdc97961e9ba445a26948c1af (patch)
treee155e394d0c4698005ebf021a3d50311459ee64b /scripts
parent02a4f4fe522c29bcd4a61e094f7fe8d64f00ee06 (diff)
downloadlinux-stable-b1aaa546b52baf7cdc97961e9ba445a26948c1af.tar.gz
linux-stable-b1aaa546b52baf7cdc97961e9ba445a26948c1af.tar.bz2
linux-stable-b1aaa546b52baf7cdc97961e9ba445a26948c1af.zip
kernel-doc: strip attributes even if they have an argument
An inline function can have an attribute, as in include/linux/log2.h, and kernel-doc handles this already for simple cases. However, some attributes have arguments (e.g. the "target" attribute). Handle those too. Furthermore, attributes could be at the beginning of a function declaration, before the return type. To correctly handle this case, you need to strip spaces after the attributes; otherwise, dump_function is left confused. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/kernel-doc8
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index c1ea91c2e497..99b4847f9bb2 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -2506,7 +2506,13 @@ sub dump_function($$) {
$prototype =~ s/__must_check +//;
$prototype =~ s/__weak +//;
my $define = $prototype =~ s/^#\s*define\s+//; #ak added
- $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//;
+ $prototype =~ s/__attribute__\s*\(\(
+ (?:
+ [\w\s]++ # attribute name
+ (?:\([^)]*+\))? # attribute arguments
+ \s*+,? # optional comma at the end
+ )+
+ \)\)\s+//x;
# Yes, this truly is vile. We are looking for:
# 1. Return type (may be nothing if we're looking at a macro)