> Am 16.06.2017 um 15:11 schrieb Johannes Berg <johan...@sipsolutions.net>: > > Hi Markus, > >> The parser part is same state machine as the the perl one … with same >> problems ;) > > :-) > >> 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 patch, the result missed the space between ‚foo' and >> 'bar':: >> >> struct something {struct foobar;}; >> >> Here is my fix for the Perl script: >> >> diff --git a/scripts/kernel-doc b/scripts/kernel-doc >> index a26a5f2..6aa52cc 100755 >> --- a/scripts/kernel-doc >> +++ b/scripts/kernel-doc >> @@ -2763,6 +2763,9 @@ sub process_proto_type($$) { >> >> while (1) { >> if ( $x =~ /([^{};]*)([{};])(.*)/ ) { >> + if( length $prototype ) { >> + $prototype .= " " >> + } >> $prototype .= $1 . $2; >> ($2 eq '{') && $brcount++; >> ($2 eq '}') && $brcount--; >> >> Can you test it? > > This has the same problem as all the other versions proposed here - if > you have > > enum foo { > X, > > Y, > }; > > (note the blank line) > > you'll get > > warning: Enum value ' ' not described in enum 'foo'
Aargh, sorry .. I need glasses. The LinuxDoc parser works with the patch, I guess the dump_enum is different in the Perl script (seems not stripping leading whitespaces from the concatenated string) ... the following works for me: modified scripts/kernel-doc @@ -2223,6 +2223,7 @@ sub dump_enum($$) { if ($x =~ /enum\s+(\w+)\s*{(.*)}/) { $declaration_name = $1; my $members = $2; + $members =~ s/\s+$//; foreach my $arg (split ',', $members) { $arg =~ s/^\s*(\w+).*/$1/; @@ -2763,6 +2764,9 @@ sub process_proto_type($$) { while (1) { if ( $x =~ /([^{};]*)([{};])(.*)/ ) { + if( length $prototype ) { + $prototype .= " " + } $prototype .= $1 . $2; ($2 eq '{') && $brcount++; ($2 eq '}') && $brcount--; Tested with: /** * enum foo - foo * @F1: f1 * @F2: f2 */ enum foo { F1, F2, }; /** * struct something - Lorem ipsum dolor sit amet. * @foofoo: lorem * @barbar: ipsum */ struct something { struct foo foofoo; struct bar barbar; }; Can you test it with some of your constructs? / Thanks! -- Markus -- -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html