From: Paolo Bonzini <pbonzini@redhat.com>
To: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Cc: corbet@lwn.net
Subject: [PATCH 2/5] kernel-doc: strip attributes even if they have an argument
Date: Mon, 2 Jan 2017 16:22:24 +0100 [thread overview]
Message-ID: <20170102152227.9446-3-pbonzini@redhat.com> (raw)
In-Reply-To: <20170102152227.9446-1-pbonzini@redhat.com>
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>
---
scripts/kernel-doc | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index c1ea91c2e497..265ea16cbe22 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)
--
2.9.3
next prev parent reply other threads:[~2017-01-02 15:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-02 15:22 [PATCH 0/5] kernel-doc tweaks and cleanup of rST vs. non-rST backends Paolo Bonzini
2017-01-02 15:22 ` [PATCH 1/5] kernel-doc: cleanup parameter type in function-typed arguments Paolo Bonzini
2017-01-02 15:22 ` Paolo Bonzini [this message]
2017-01-02 15:22 ` [PATCH 3/5] kernel-doc: include parameter type in docbook output Paolo Bonzini
2017-01-02 15:22 ` [PATCH 4/5] kernel-doc: make member highlighting available in all backends Paolo Bonzini
2017-01-02 15:22 ` [PATCH 5/5] kernel-doc: make highlights more homogenous for the various backends Paolo Bonzini
2017-01-03 9:57 ` [PATCH 0/5] kernel-doc tweaks and cleanup of rST vs. non-rST backends Jani Nikula
2017-01-04 15:13 ` Paolo Bonzini
2017-01-04 15:40 ` Jani Nikula
2017-01-04 22:06 ` Jonathan Corbet
2017-01-23 13:42 ` Markus Heiser
2017-01-23 13:58 ` Paolo Bonzini
2017-01-23 14:38 ` Markus Heiser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170102152227.9446-3-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome