All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] scripts: kernel-doc: fix nexted handling
@ 2017-09-24 10:23 Mauro Carvalho Chehab
  2017-09-24 15:13 ` Markus Heiser
  2017-09-27  3:06 ` kbuild test robot
  0 siblings, 2 replies; 8+ messages in thread
From: Mauro Carvalho Chehab @ 2017-09-24 10:23 UTC (permalink / raw)
  To: Linux Media Mailing List, Jonathan Corbet
  Cc: Mauro Carvalho Chehab, Mauro Carvalho Chehab, linux-doc

At DVB, we have, at some structs, things like (see
struct dvb_demux_feed, at dvb_demux.h):

	union {
		struct dmx_ts_feed ts;
		struct dmx_section_feed sec;
	} feed;

	union {
		dmx_ts_cb ts;
		dmx_section_cb sec;
	} cb;

Fix the nested parser to avoid it to eat the first union.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
---

v2:  handle embedded structs/unions from inner to outer

When we have multiple levels of embedded structs, like
(see v4l2-async.h):

struct v4l2_async_subdev {
	enum v4l2_async_match_type match_type;
	union {
		struct {
			struct fwnode_handle *fwnode;
		} fwnode;
		struct {
			const char *name;
		} device_name;
		struct {
			int adapter_id;
			unsigned short address;
		} i2c;
		struct {
			bool (*match)(struct device *,
				      struct v4l2_async_subdev *);
			void *priv;
		} custom;
	} match;
...
}

we need a smarter rule that will be removing nested structs
from the inner to the outer ones. So, changed the parsing rule to
remove nested structs/unions from the inner ones to the outer
ones, while it matches.

 scripts/kernel-doc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 9d3eafea58f0..443e1bcc78db 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -2173,7 +2173,7 @@ sub dump_struct($$) {
 	my $members = $3;
 
 	# ignore embedded structs or unions
-	$members =~ s/({.*})//g;
+	while ($members =~ s/({[^\{\}]*})//g) {};
 	$nested = $1;
 
 	# ignore members marked private:
-- 
2.13.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-09-27  3:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-24 10:23 [PATCH v2] scripts: kernel-doc: fix nexted handling Mauro Carvalho Chehab
2017-09-24 15:13 ` Markus Heiser
2017-09-24 17:38   ` Mauro Carvalho Chehab
2017-09-25 16:58     ` Markus Heiser
2017-09-25 18:41       ` Mauro Carvalho Chehab
2017-09-26 12:45         ` Markus Heiser
2017-09-26 18:58           ` Mauro Carvalho Chehab
2017-09-27  3:06 ` kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.