aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kernel-doc
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2017-01-02 10:22:24 -0500
committerJonathan Corbet <corbet@lwn.net>2017-01-04 17:07:42 -0500
commitb1aaa546b52baf7cdc97961e9ba445a26948c1af (patch)
treee155e394d0c4698005ebf021a3d50311459ee64b /scripts/kernel-doc
parent02a4f4fe522c29bcd4a61e094f7fe8d64f00ee06 (diff)
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/kernel-doc')
-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($$) {
2506 $prototype =~ s/__must_check +//; 2506 $prototype =~ s/__must_check +//;
2507 $prototype =~ s/__weak +//; 2507 $prototype =~ s/__weak +//;
2508 my $define = $prototype =~ s/^#\s*define\s+//; #ak added 2508 my $define = $prototype =~ s/^#\s*define\s+//; #ak added
2509 $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//; 2509 $prototype =~ s/__attribute__\s*\(\(
2510 (?:
2511 [\w\s]++ # attribute name
2512 (?:\([^)]*+\))? # attribute arguments
2513 \s*+,? # optional comma at the end
2514 )+
2515 \)\)\s+//x;
2510 2516
2511 # Yes, this truly is vile. We are looking for: 2517 # Yes, this truly is vile. We are looking for:
2512 # 1. Return type (may be nothing if we're looking at a macro) 2518 # 1. Return type (may be nothing if we're looking at a macro)