[Cocci] "TODO: FunCall" in python match printing
Carl-Daniel Hailfinger
c-d.hailfinger.devel.2006 at gmx.net
Fri Mar 6 22:40:12 CET 2009
On 06.03.2009 22:23, Julia Lawall wrote:
> Attached is another attempt at sending the patch. I downloaded a fresh
> version of the sources from the web site, went into the coccinelle-0.1.5
> directory and applied the patch with no problem using patch -p1 < cpatch
>
Thanks, it works perfectly! I tested printing both complete function
calls and isolated arguments and it worked each time.
Complete function calls:
@r@
expression b;
typedef uint8_t;
volatile uint8_t a;
position p1;
@@
a at p1 = readb(b);
@script:python@
p1 << r.p1;
a << r.a;
b << r.b;
@@
print "* file: %s line %s has assignment to unnecessarily volatile
variable: %s = readb(%s);" % (p1[0].file, p1[0].line, a, b)
Only function arguments:
@r@
expression b;
typedef uint8_t;
volatile uint8_t a;
position p1;
@@
a at p1 = b;
@script:python@
p1 << r.p1;
a << r.a;
b << r.b;
@@
print "* file: %s line %s has assignment to unnecessarily volatile
variable: %s = %s;" % (p1[0].file, p1[0].line, a, b)
The output was identical for both (excluding whitespace):
* file: sst28sf040.c line 44 has assignment to unnecessarily volatile
variable: tmp = readb ( bios + 0x040A );
* file: sst28sf040.c line 43 has assignment to unnecessarily volatile
variable: tmp = readb ( bios + 0x0419 );
* file: sst28sf040.c line 42 has assignment to unnecessarily volatile
variable: tmp = readb ( bios + 0x041B );
* file: sst28sf040.c line 41 has assignment to unnecessarily volatile
variable: tmp = readb ( bios + 0x0418 );
* file: sst28sf040.c line 40 has assignment to unnecessarily volatile
variable: tmp = readb ( bios + 0x1822 );
* file: sst28sf040.c line 39 has assignment to unnecessarily volatile
variable: tmp = readb ( bios + 0x1820 );
* file: sst28sf040.c line 38 has assignment to unnecessarily volatile
variable: tmp = readb ( bios + 0x1823 );
* file: sst28sf040.c line 58 has assignment to unnecessarily volatile
variable: tmp = readb ( bios + 0x041A );
* file: sst28sf040.c line 57 has assignment to unnecessarily volatile
variable: tmp = readb ( bios + 0x0419 );
* file: sst28sf040.c line 56 has assignment to unnecessarily volatile
variable: tmp = readb ( bios + 0x041B );
* file: sst28sf040.c line 55 has assignment to unnecessarily volatile
variable: tmp = readb ( bios + 0x0418 );
* file: sst28sf040.c line 54 has assignment to unnecessarily volatile
variable: tmp = readb ( bios + 0x1822 );
* file: sst28sf040.c line 53 has assignment to unnecessarily volatile
variable: tmp = readb ( bios + 0x1820 );
* file: sst28sf040.c line 52 has assignment to unnecessarily volatile
variable: tmp = readb ( bios + 0x1823 );
You have a pretty impressive turnaround time for feature requests. Thanks!
Now I need to prepare more shiny stuff with Coccinelle. There are a few
extremely big and complex sed scripts written by me to manage struct
member reorganization in flashrom and I hope to replace them with a
single and readable semantic patch. More about that in a few days.
Regards,
Carl-Daniel
More information about the Cocci
mailing list