mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-25 17:53:34 -05:00
scripts: kernel-doc: add support for typedef enum
The PHY kernel-doc markup has gained support for documenting
a typedef enum.
However, right now the parser was not prepared for it.
So, add support for parsing it.
Fixes: 4069a572d4
("net: phy: Document core PHY structures")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
3e4fb4346c
commit
d38c8cfb05
1 changed files with 11 additions and 4 deletions
|
@ -1265,14 +1265,22 @@ sub show_warnings($$) {
|
||||||
sub dump_enum($$) {
|
sub dump_enum($$) {
|
||||||
my $x = shift;
|
my $x = shift;
|
||||||
my $file = shift;
|
my $file = shift;
|
||||||
|
my $members;
|
||||||
|
|
||||||
|
|
||||||
$x =~ s@/\*.*?\*/@@gos; # strip comments.
|
$x =~ s@/\*.*?\*/@@gos; # strip comments.
|
||||||
# strip #define macros inside enums
|
# strip #define macros inside enums
|
||||||
$x =~ s@#\s*((define|ifdef)\s+|endif)[^;]*;@@gos;
|
$x =~ s@#\s*((define|ifdef)\s+|endif)[^;]*;@@gos;
|
||||||
|
|
||||||
if ($x =~ /enum\s+(\w*)\s*\{(.*)\}/) {
|
if ($x =~ /typedef\s+enum\s*\{(.*)\}\s*(\w*)\s*;/) {
|
||||||
|
$declaration_name = $2;
|
||||||
|
$members = $1;
|
||||||
|
} elsif ($x =~ /enum\s+(\w*)\s*\{(.*)\}/) {
|
||||||
$declaration_name = $1;
|
$declaration_name = $1;
|
||||||
my $members = $2;
|
$members = $2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($declaration_name) {
|
||||||
my %_members;
|
my %_members;
|
||||||
|
|
||||||
$members =~ s/\s+$//;
|
$members =~ s/\s+$//;
|
||||||
|
@ -1307,8 +1315,7 @@ sub dump_enum($$) {
|
||||||
'sections' => \%sections,
|
'sections' => \%sections,
|
||||||
'purpose' => $declaration_purpose
|
'purpose' => $declaration_purpose
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
print STDERR "${file}:$.: error: Cannot parse enum!\n";
|
print STDERR "${file}:$.: error: Cannot parse enum!\n";
|
||||||
++$errors;
|
++$errors;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue