cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] How to match all conditions in if-else if blocks?
@ 2019-07-30 14:43 Chuhong Yuan
  2019-07-31 11:27 ` Julia Lawall
  0 siblings, 1 reply; 2+ messages in thread
From: Chuhong Yuan @ 2019-07-30 14:43 UTC (permalink / raw)
  To: cocci

Hi all,
I want to write a script to match a pattern of conditional statement.
However, I find that I can only match the first "if" in the block.
The script is like this:
fn(...) {
...
- f(arg1, arg2, arg3)
...
}
where f returns the condition check result.

But when I apply to source code like this:
if (f(a1, a2, a3)) {
...
} else if (f(a4, a5, a6)) {
...
}
I find it can only match f(a1, a2, a3).
So how to fix this problem?

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

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

end of thread, other threads:[~2019-07-31 11:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-30 14:43 [Cocci] How to match all conditions in if-else if blocks? Chuhong Yuan
2019-07-31 11:27 ` Julia Lawall

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).