[Cocci] RFC - simple scanners and matching macros

Julia Lawall julia.lawall at lip6.fr
Wed Dec 24 10:27:07 CET 2014


> will update to rc23 and retest - can this be a config/python version issue ?
> python version is 2.7.3 (Debian 7.6)

I have Python 2.7.5+

> > For the performance problem, could you send the current semantic patch
> > again, so I could be sure to be testing the right thing?
> >
> files where this situation exists in linux-next (3.18.0) and which should
> trigger are:
>
>  drivers/macintosh/ams/ams-pmu.c        line 52
>  drivers/misc/sgi-gru/grukservices.c    line 1044
>  drivers/scsi/aha152x.c                 line 1055
>  drivers/usb/gadget/udc/fsl_qe_udc.c    line 2630
>  drivers/usb/gadget/udc/fsl_udc_core.c  line 2529

I tried these files in their linux-next versions with the -D report option
and got an answer more or less immediately (2 seconds).  An example command
line is:

spatch --sp-file dc.cocci -D report /var/linuxes/linux-next/drivers/scsi/aha152x.c

Does this work for you?

julia

>
> the non-working semantic patch below:
>
> /* check for incorrect DECLARE_COMPLETION use within a function
>  *
>  * Options:  --no-includes --include-headers
>  */
> virtual context
> virtual patch
> virtual org
> virtual report
>
> /* flag incorrect initializer*/
> @e depends on patch && !(context || org || report)@
> expression cmp;
> identifier f;
> declarer name DECLARE_COMPLETION;
> position p;
> @@
>
> f(...) {
>   <...
> - DECLARE_COMPLETION at p(cmp);
> + DECLARE_COMPLETION_ONSTACK(cmp);
>   ...>
> }
>
> @ep depends on !patch && (context || org || report)@
> expression cmp;
> identifier f;
> position p;
> @@
>
> f(...) {
>   <...
> * DECLARE_COMPLETION at p(cmp);
>   ...>
> }
>
> @script:python depends on org@
> p << ep.p;
> @@
>
> msg="WARNING: possible incorrect use of DECLARE_COMPLETION"
> coccilib.org.print_todo(p[0], msg)
>
> @script:python depends on report@
> p << ep.p;
> @@
>
> msg="WARNING: possible incorrect use of DECLARE_COMPLETION"
> coccilib.report.print_report(p[0], msg)
>
> thx!
> hofrat
>


More information about the Cocci mailing list