]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
scripts: kernel-doc: add support for typedef enum
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 1 Oct 2020 06:23:52 +0000 (08:23 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 15 Oct 2020 05:49:35 +0000 (07:49 +0200)
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>
scripts/kernel-doc

index 724528f4b7d63b25c09d971b86924be08af6bcd0..adc05406c68eb518812bb20b05ac42be9f7a90ba 100755 (executable)
@@ -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;
     }