* [Cocci] Making conjunctions smaller
@ 2016-06-10 22:51 Luis R. Rodriguez
2016-06-11 5:12 ` Julia Lawall
2016-06-11 6:38 ` SF Markus Elfring
0 siblings, 2 replies; 5+ messages in thread
From: Luis R. Rodriguez @ 2016-06-10 22:51 UTC (permalink / raw)
To: cocci
I have a series of changes, and I want to only make a subsequent
change if and only if at least one of a series of previous declared
rules were matched. I can do this by depends on foo1 || foo2 || foo3
|| foo4, etc however since I have a lot of rules I was hoping I could
condense these into one. What would be the best way to do that?
This is just to reduce a long list of conjunctions to a much simpler set.
Luis
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Cocci] Making conjunctions smaller
2016-06-10 22:51 [Cocci] Making conjunctions smaller Luis R. Rodriguez
@ 2016-06-11 5:12 ` Julia Lawall
2016-06-11 6:44 ` Luis R. Rodriguez
2016-06-11 6:38 ` SF Markus Elfring
1 sibling, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2016-06-11 5:12 UTC (permalink / raw)
To: cocci
On Fri, 10 Jun 2016, Luis R. Rodriguez wrote:
> I have a series of changes, and I want to only make a subsequent
> change if and only if at least one of a series of previous declared
> rules were matched. I can do this by depends on foo1 || foo2 || foo3
> || foo4, etc however since I have a lot of rules I was hoping I could
> condense these into one. What would be the best way to do that?
>
> This is just to reduce a long list of conjunctions to a much simpler set.
Disjunctions, I guess?
I guess you could make a rule that is guaranteed to match for some
reason and put
@combined depends on a || b || c || d || e@
identifier f;
@@
f(...)
Here I match any function call, because any file of interest probably
contains at least one. But if possible it would be better to put a
pattern that matches less often, because Coccinelle really will be doing
the work of making these matches.
I think that the long list of ||s would be better.
julia
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Cocci] Making conjunctions smaller
2016-06-10 22:51 [Cocci] Making conjunctions smaller Luis R. Rodriguez
2016-06-11 5:12 ` Julia Lawall
@ 2016-06-11 6:38 ` SF Markus Elfring
1 sibling, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2016-06-11 6:38 UTC (permalink / raw)
To: cocci
> I can do this by depends on foo1 || foo2 || foo3|| foo4,
> etc however since I have a lot of rules
How many condition elements have you got in mind for your use case?
Does the mentioned SmPL dependency specification become inconvenient (or
challenging) occasionally?
> I was hoping I could condense these into one.
Would you like to construct dependencies by special scripts?
> This is just to reduce a long list of conjunctions to a much simpler set.
Are you eventually looking for the support of another metavariable type
in the semantic patch language?
Regards,
Markus
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Cocci] Making conjunctions smaller
2016-06-11 5:12 ` Julia Lawall
@ 2016-06-11 6:44 ` Luis R. Rodriguez
2016-06-11 6:52 ` Julia Lawall
0 siblings, 1 reply; 5+ messages in thread
From: Luis R. Rodriguez @ 2016-06-11 6:44 UTC (permalink / raw)
To: cocci
On Fri, Jun 10, 2016 at 10:12 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>
>
> On Fri, 10 Jun 2016, Luis R. Rodriguez wrote:
>
>> I have a series of changes, and I want to only make a subsequent
>> change if and only if at least one of a series of previous declared
>> rules were matched. I can do this by depends on foo1 || foo2 || foo3
>> || foo4, etc however since I have a lot of rules I was hoping I could
>> condense these into one. What would be the best way to do that?
>>
>> This is just to reduce a long list of conjunctions to a much simpler set.
>
> Disjunctions, I guess?
Heh yes sorry.
> I guess you could make a rule that is guaranteed to match for some
> reason and put
>
> @combined depends on a || b || c || d || e@
> identifier f;
> @@
>
> f(...)
>
> Here I match any function call, because any file of interest probably
> contains at least one. But if possible it would be better to put a
> pattern that matches less often, because Coccinelle really will be doing
> the work of making these matches.
I suspected this, I had used
#include ...
as I think most files has this but I was concerned over the impact as
you noted. A python way to add a virtual rule would have been another
option but it seems only iteration supports that.
> I think that the long list of ||s would be better.
OK, I'll do that.
Luis
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Cocci] Making conjunctions smaller
2016-06-11 6:44 ` Luis R. Rodriguez
@ 2016-06-11 6:52 ` Julia Lawall
0 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2016-06-11 6:52 UTC (permalink / raw)
To: cocci
On Fri, 10 Jun 2016, Luis R. Rodriguez wrote:
> On Fri, Jun 10, 2016 at 10:12 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> >
> >
> > On Fri, 10 Jun 2016, Luis R. Rodriguez wrote:
> >
> >> I have a series of changes, and I want to only make a subsequent
> >> change if and only if at least one of a series of previous declared
> >> rules were matched. I can do this by depends on foo1 || foo2 || foo3
> >> || foo4, etc however since I have a lot of rules I was hoping I could
> >> condense these into one. What would be the best way to do that?
> >>
> >> This is just to reduce a long list of conjunctions to a much simpler set.
> >
> > Disjunctions, I guess?
>
> Heh yes sorry.
>
> > I guess you could make a rule that is guaranteed to match for some
> > reason and put
> >
> > @combined depends on a || b || c || d || e@
> > identifier f;
> > @@
> >
> > f(...)
> >
> > Here I match any function call, because any file of interest probably
> > contains at least one. But if possible it would be better to put a
> > pattern that matches less often, because Coccinelle really will be doing
> > the work of making these matches.
>
> I suspected this, I had used
>
> #include ...
>
> as I think most files has this but I was concerned over the impact as
> you noted. A python way to add a virtual rule would have been another
> option but it seems only iteration supports that.
I don't think this would work. You can't add virtual rules on the fly.
julia
> > I think that the long list of ||s would be better.
>
> OK, I'll do that.
>
> Luis
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-06-11 6:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-10 22:51 [Cocci] Making conjunctions smaller Luis R. Rodriguez
2016-06-11 5:12 ` Julia Lawall
2016-06-11 6:44 ` Luis R. Rodriguez
2016-06-11 6:52 ` Julia Lawall
2016-06-11 6:38 ` SF Markus Elfring
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.