I've made some additional tests, printing where the function is called
and where it's defined.
----------------------------------------------------------------------
@r1@
identifier fn;
identifier virtual.id;
identifier ret;
position p1;
@@
(
id(..., fn, ...)@p1;
|
ret = id(..., fn, ...)@p1;
)

@r2@
identifier r1.fn;
position p2;
@@
fn(...)@p2
{
        ...
}

@script:python@
p1 << r1.p1;
@@

print "* calling:    %s:%s" % (p1[0].file,p1[0].line)


@script:python@
p2 << r2.p2;
@@

print "* definition: %s:%s" % (p2[0].file,p2[0].line)
----------------------------------------------------------------------

There are 6 calls (p1) but only 3 definitions.  Even if I change the
calls after line 177 and putting one of the first callbacks, they're
not printed. The output is:
----------------------------------------------------------------------
$ spatch -sp_file /tmp/a.spatch -D id=ecore_timer_add
ecore_test_ecore.c -all_includes -I /home/lucas/dev/e/include/ -I
/home/lucas/dev/e/include/eina-0/ -I /usr/include/ -I ../../
init_defs_builtins: /usr/share/coccinelle/standard.h
HANDLING: ecore_test_ecore.c
* calling:    ecore_test_ecore.c:51
* calling:    ecore_test_ecore.c:116
* calling:    ecore_test_ecore.c:141
* calling:    ecore_test_ecore.c:177
* calling:    ecore_test_ecore.c:178
* calling:    ecore_test_ecore.c:300
* definition: ecore_test_ecore.c:16
* definition: ecore_test_ecore.c:25
* definition: ecore_test_ecore.c:164
----------------------------------------------------------------------


I hope this can help.

Lucas De Marchi
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to