linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Linux Doc Mailing List <linux-doc@vger.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	"Jonathan Corbet" <corbet@lwn.net>, Andrew Lunn <andrew@lunn.ch>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 5/6] scripts: kernel-doc: add support for typedef enum
Date: Fri,  2 Oct 2020 07:49:49 +0200	[thread overview]
Message-ID: <f381c13667d8794a941457f5ef771fe34788e831.1601616399.git.mchehab+huawei@kernel.org> (raw)
In-Reply-To: <cover.1601616399.git.mchehab+huawei@kernel.org>

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 | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index d94e28fcead0..5ac3749905e5 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1339,14 +1339,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+$//;
@@ -1381,8 +1389,7 @@ sub dump_enum($$) {
 			    'sections' => \%sections,
 			    'purpose' => $declaration_purpose
 			   });
-    }
-    else {
+    } else {
 	print STDERR "${file}:$.: error: Cannot parse enum!\n";
 	++$errors;
     }
-- 
2.26.2


  parent reply	other threads:[~2020-10-02  5:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-02  5:49 [PATCH 0/6] Fix new html build warnings from next-20201001 Mauro Carvalho Chehab
2020-10-02  5:49 ` [PATCH 1/6] net: core: document two new elements of struct net_device Mauro Carvalho Chehab
2020-10-02 22:16   ` David Miller
2020-10-02  5:49 ` [PATCH 2/6] docs: vcpu.rst: fix some build warnings Mauro Carvalho Chehab
2020-10-02  7:58   ` Paolo Bonzini
2020-10-02  5:49 ` [PATCH 3/6] docs: virt: user_mode_linux_howto_v2.rst: fix a literal block markup Mauro Carvalho Chehab
2020-10-02  7:38   ` Anton Ivanov
2020-10-02  5:49 ` [PATCH 4/6] docs: i2c: index.rst: add slave-testunit-backend.rst Mauro Carvalho Chehab
2020-10-02  7:54   ` Wolfram Sang
2020-10-02  9:02     ` Mauro Carvalho Chehab
2020-10-02  5:49 ` Mauro Carvalho Chehab [this message]
2020-10-02 12:07   ` [PATCH 5/6] scripts: kernel-doc: add support for typedef enum Andrew Lunn
2020-10-03  7:24     ` Mauro Carvalho Chehab
2020-10-02  5:49 ` [PATCH 6/6] docs: gpio: add a new document to its index.rst Mauro Carvalho Chehab
2020-10-02 15:28   ` Bartosz Golaszewski
2020-10-03  0:02   ` Kent Gibson
2020-10-07  8:41   ` Linus Walleij
2020-10-02  8:19 ` [PATCH 0/6] Fix new html build warnings from next-20201001 Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f381c13667d8794a941457f5ef771fe34788e831.1601616399.git.mchehab+huawei@kernel.org \
    --to=mchehab+huawei@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).