diff options
| author | Markus Heiser <markus.heiser@darmarit.de> | 2017-06-16 15:27:48 -0400 |
|---|---|---|
| committer | Jonathan Corbet <corbet@lwn.net> | 2017-08-30 18:18:16 -0400 |
| commit | 463a0fdc3e800c04ec62b31627909baf4611716a (patch) | |
| tree | 8468d43c66b814ad07df16400b779edc1da36c77 /scripts | |
| parent | 33c2f4ec984d8a78f15b9d989968733606512bb2 (diff) | |
kernel-doc parser mishandles declarations split into lines
Reported by Johannes Berg [1]. Problem here: function
process_proto_type() concatenates the striped lines of declaration
without any whitespace. A one-liner of::
struct something {
struct foo
bar;
};
has to be::
struct something {struct foo bar;};
Without the patching process_proto_type(), the result missed the space
between 'foo' and 'bar'::
struct something {struct foobar;};
Bugfix of process_proto_type() brings next error when blank lines
between enum declaration::
warning: Enum value ' ' not described in enum 'foo'
Problem here: dump_enum() does not strip leading whitespaces from
the concatenated string (with the new additional space from
process_proto_type).
[1] https://www.mail-archive.com/linux-doc@vger.kernel.org/msg12410.html
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/kernel-doc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 6e36b7889001..9d3eafea58f0 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
| @@ -2226,6 +2226,7 @@ sub dump_enum($$) { | |||
| 2226 | if ($x =~ /enum\s+(\w+)\s*{(.*)}/) { | 2226 | if ($x =~ /enum\s+(\w+)\s*{(.*)}/) { |
| 2227 | $declaration_name = $1; | 2227 | $declaration_name = $1; |
| 2228 | my $members = $2; | 2228 | my $members = $2; |
| 2229 | $members =~ s/\s+$//; | ||
| 2229 | 2230 | ||
| 2230 | foreach my $arg (split ',', $members) { | 2231 | foreach my $arg (split ',', $members) { |
| 2231 | $arg =~ s/^\s*(\w+).*/$1/; | 2232 | $arg =~ s/^\s*(\w+).*/$1/; |
| @@ -2766,6 +2767,9 @@ sub process_proto_type($$) { | |||
| 2766 | 2767 | ||
| 2767 | while (1) { | 2768 | while (1) { |
| 2768 | if ( $x =~ /([^{};]*)([{};])(.*)/ ) { | 2769 | if ( $x =~ /([^{};]*)([{};])(.*)/ ) { |
| 2770 | if( length $prototype ) { | ||
| 2771 | $prototype .= " " | ||
| 2772 | } | ||
| 2769 | $prototype .= $1 . $2; | 2773 | $prototype .= $1 . $2; |
| 2770 | ($2 eq '{') && $brcount++; | 2774 | ($2 eq '{') && $brcount++; |
| 2771 | ($2 eq '}') && $brcount--; | 2775 | ($2 eq '}') && $brcount--; |
