Skip to contentSkip to conversation

Question: Removing a function argument

Cocci Lennart Glauer 2 participants 2 messages May 27, 2019

lore
Share & tools
lore
#0 lore raw

Hello all,

I’m interested in using Coccinelle.
Currently I’m playing with the example „Removing a function argument":
http://coccinelle.lip6.fr/docs/main_grammar016.html#sec24 <http://coccinelle.lip6.fr/docs/main_grammar016.html#sec24>

It works well with drivers/atm/firestream.c,
but if the definition of the function and the call are in two different files it doesn’t work anymore. It seems that the reference „rule1.fn“ doesn’t work across files?
I created a minimal testcase (see attachment).
Is there any way to make this work?

best regards
Lennart Glauer

_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

#1 lore raw
Quoted 11 lines · Lennart Glauer

Hello all,

I’m interested in using Coccinelle.
Currently I’m playing with the example „Removing a function argument":
http://coccinelle.lip6.fr/docs/main_grammar016.html#sec24 <http://coccinelle.lip6.fr/docs/main_grammar016.html#sec24>

It works well with drivers/atm/firestream.c,
but if the definition of the function and the call are in two different files it doesn’t work anymore. It seems that the reference „rule1.fn“ doesn’t work across files?
I created a minimal testcase (see attachment).
Is there any way to make this work?

Coccinelle normally works on one file at a time. If you put more file names on the command line they will all be precessed at once, so both the definition and use will be seen. However, it is not advisable to put the names of all of the files of the Linux kernel on the command line. You will run out fo memory having the representations of all of the files in memory at the same time.

Afterwards, the choices are to use iteration (demos/iteration.cocci) to find the definition and then find the calls.

Alternatively, if you know of some groups of files that should be treated at once, you can put then in a file with one file per line, with the groups separated by newlines, eg

file1
file2

file3
file4
file5

and then pass the name of this file to Coccinelle with the name --file-groups.

julia

_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci