cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Sumera Priyadarsini <sylphrenadin@gmail.com>,
	Coccinelle <cocci@systeme.lip6.fr>
Cc: Michal Marek <michal.lkml@markovi.net>,
	Gilles Muller <Gilles.Muller@lip6.fr>,
	Nicolas Palix <nicolas.palix@imag.fr>,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	Julia Lawall <Julia.Lawall@lip6.fr>
Subject: Re: [Cocci] [PATCH] coccinelle: iterators: Add for_each_child.cocci script
Date: Thu, 24 Sep 2020 14:45:25 +0200	[thread overview]
Message-ID: <5a74b3c5-c0e9-1426-c477-72bb86bcf5ed@web.de> (raw)

> +// Confidence: High

Will an addition like the following be helpful?

+// Options: --no-includes --include-headers


> +@r@
> +local idexpression n;
> +expression e1,e2;
> +iterator name for_each_node_by_name, for_each_node_by_type,
> +for_each_compatible_node, for_each_matching_node,
> +for_each_matching_node_and_match, for_each_child_of_node,
> +for_each_available_child_of_node, for_each_node_with_property;
> +iterator i;
> +statement S;
> +expression list [n1] es;
> +@@
> +
> +(
> +(
> +for_each_node_by_name(n,e1) S
> +|
> +for_each_node_by_type(n,e1) S
> +|
> +for_each_compatible_node(n,e1,e2) S
> +|
> +for_each_matching_node(n,e1) S
> +|
> +for_each_matching_node_and_match(n,e1,e2) S
> +|
> +for_each_child_of_node(e1,n) S
> +|
> +for_each_available_child_of_node(e1,n) S
> +|
> +for_each_node_with_property(n,e1) S
> +)
> +&
> +i(es,n,...) S
> +)

How do you think about to use the following SmPL code variant?

@r@
local idexpression n;
expression e1, e2;
expression list [n1] es;
iterator name for_each_node_by_name,
              for_each_node_by_type,
              for_each_node_with_property,
              for_each_matching_node,
              for_each_matching_node_and_match,
              for_each_compatible_node,
              for_each_child_of_node,
              for_each_available_child_of_node;
iterator i;
statement S;
@@
(
(for_each_node_by_name(n,e1) S
|for_each_node_by_type(n,e1) S
|for_each_matching_node(n,e1) S
|for_each_node_with_property(n,e1) S
|for_each_compatible_node(n,e1,e2) S
|for_each_matching_node_and_match(n,e1,e2) S
|for_each_child_of_node(e1,n) S
|for_each_available_child_of_node(e1,n) S
)
&i(es,n,...) S
)


Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

             reply	other threads:[~2020-09-24 12:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-24 12:45 Markus Elfring [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-09-24 14:10 [Cocci] [PATCH] coccinelle: iterators: Add for_each_child.cocci script Markus Elfring
2020-09-24 14:32 ` Julia Lawall
2020-09-24 10:35 Sumera Priyadarsini
2020-10-12  9:27 ` Julia Lawall

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=5a74b3c5-c0e9-1426-c477-72bb86bcf5ed@web.de \
    --to=markus.elfring@web.de \
    --cc=Gilles.Muller@lip6.fr \
    --cc=Julia.Lawall@lip6.fr \
    --cc=cocci@systeme.lip6.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=nicolas.palix@imag.fr \
    --cc=sylphrenadin@gmail.com \
    /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).