> No i want to add some code to _all_ function that have a specific
> structure as one of their argument. Thus i match on the function
> parameter list for the struct i am interested in
This source code search approach is generally fine.
> and then after all the declaration i add a code
On Wed, 17 Apr 2019, Jerome Glisse wrote:
> On Wed, Apr 17, 2019 at 07:14:29AM +0200, Julia Lawall wrote:
> >
> >
> > On Tue, 16 Apr 2019, Jerome Glisse wrote:
> >
> > > I would like to add code after local variable declaration but there
> > > is nothing particular to match there for me.
On Wed, Apr 17, 2019 at 07:14:29AM +0200, Julia Lawall wrote:
>
>
> On Tue, 16 Apr 2019, Jerome Glisse wrote:
>
> > I would like to add code after local variable declaration but there
> > is nothing particular to match there for me. Roughly i want to do:
> >
> > void FooFun(..., struct
>> Would you like to add any source code only after a variable declaration
>
> Coccinelle doesn't allow this. It has no way of knowing whether other
> declarations come afterwards,
I suggest to reconsider this quick response.
Are there approximations supported for such a source code search
>> Would you like to add any source code only after a variable declaration
>
> Coccinelle doesn't allow this. It has no way of knowing whether other
> declarations come afterwards,
I suggest to reconsider this quick response.
Are there approximations supported for such a source code search
> @@
> statement S,S1;
> @@
>
> foo(...) {
> ... when != S
> + added code
> S1
> ...
> }
>
> A declaration doesn't match S.
Can this information trigger additional considerations for the handling
of variable definitions?
Would you like to add any source code only after a variable
> A metavariable is always bound to the same value within a given
> control-flow path.
Thanks for this information.
> I have no idea what you are trying to get at with this example.
Some goals can match to my use case description.
* Is another nice refactoring application demonstrated for
On Wed, 17 Apr 2019, Markus Elfring wrote:
> Hello,
>
> I have tried another small SmPL script out.
>
>
> @replacement@
> expression ex;
> identifier var;
> @@
> var
> - = var +
> + +=
> ex
>
>
> elfring@Sonne:~/Projekte/Coccinelle/Probe> spatch simplify_addition1.cocci
>
Hello,
I have tried another small SmPL script out.
@replacement@
expression ex;
identifier var;
@@
var
- = var +
+ +=
ex
elfring@Sonne:~/Projekte/Coccinelle/Probe> spatch simplify_addition1.cocci
Test_increment1.c
…
@@ -1,6 +1,6 @@
int main(void)
{
int counter = 3;