summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-10-01 09:23:52 +0300
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-10-15 08:49:35 +0300
commitd38c8cfb057183f619dc8534030bb64b63f78043 (patch)
treed69ae3c1c6eed427c0423d126624935835f7c145 /scripts
parent3e4fb4346c781068610d03c12b16c0cfb0fd24a3 (diff)
downloadlinux-d38c8cfb057183f619dc8534030bb64b63f78043.tar.xz
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: 4069a572d423 ("net: phy: Document core PHY structures") Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/kernel-doc15
1 files changed, 11 insertions, 4 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 724528f4b7d6..adc05406c68e 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1265,14 +1265,22 @@ sub show_warnings($$) {
sub dump_enum($$) {
my $x = shift;
my $file = shift;
+ my $members;
+
$x =~ s@/\*.*?\*/@@gos; # strip comments.
# strip #define macros inside enums
$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;
- my $members = $2;
+ $members = $2;
+ }
+
+ if ($declaration_name) {
my %_members;
$members =~ s/\s+$//;
@@ -1307,8 +1315,7 @@ sub dump_enum($$) {
'sections' => \%sections,
'purpose' => $declaration_purpose
});
- }
- else {
+ } else {
print STDERR "${file}:$.: error: Cannot parse enum!\n";
++$errors;
}