On Sat, 14 May 2011, Jim Cromie wrote:

> On Sat, May 14, 2011 at 1:19 AM, Julia Lawall <[email protected]> wrote:
> >> @ for_pc8736x_gpio @
> >> expression CT, DEVNAME;
> >> expression MIN;
> >> dev_t devid;
> >> identfifier major, rc;
> >
> > identifier is spelled wrong.
> >
> > julia
> 
> oof.  that might have taken a while to find.

The emacs mode has colors that make this apparent.  There is also a vim 
mode, available at the bottom of the download page: 
http://coccinelle.lip6.fr/download.php.  I haven't tried it, so I don't 
know if it helps with this problem.

julia

> FWIW, testing w following suggests opportunity for better warnings
> 
>       1
>       2 @ md @
>       3 expression ct, name;
>       4 expression major, minor;
>       5 //expression MKDEV_expr;
>       6 position pdecl;
>       7 @@
>       8
>       9 {@pdecl
>      10 + dev_t devt = MKDEV(major,minor);
>      11   ...
>      12 - MKDEV(major,minor)
>      13 + devt
>      14   ...
>      15 }
>      16
>      17 @@
>      18 dev_t devt;
>      19 expression ct, name;
>      20 identifier foo;
>      21 idenftifier foob;
>      22 @@
>      23
>      24 - register_chrdev_region(devt, ct, name)
>      25 + register_chrdev_ids(&devt, ct, name)
> chrdev.cocci-expr (END)
> 
> 
> spatch -parse_cocci chrdev.cocci-expr
> init_defs_builtins: /usr/local/share/coccinelle/standard.h
> warning: iso braces2 does not match the code below on line 9
> {@pdecl
>   >>> dev_t devt = MKDEV(md:major, md:minor);
> 
>   ...
>   MKDEV(major, minor)
>     >>> devt
> 
>   ...
> }
> the following code matched is not uniformly minus or context,
> or contains a disjunction:
> Stm:
> {@pdecl
>   >>> dev_t devt = MKDEV(md:major, md:minor);
> 
>   ...
>   MKDEV(major, minor)
>     >>> devt
> 
>   ...
> }
> @@
> md
> @@
> 
> {@md:pdecl
>   >>> dev_t devt = MKDEV(md:major, md:minor);
> 
>   ...
> 
>   -MKDEV
>     >>> devt
>   -(-md:major-, -md:minor-)
>   ...
> 
> }
> @@
> rule starting on line 17
> @@
> 
> -register_chrdev_region
>   >>> register_chrdev_ids(&rule starting on line 17:devt,
>                           rule starting on line 17:ct,
>                           rule starting on line 17:name)
> -(-rule starting on line 17:devt-, -rule starting on line 17:ct-,
>   -rule starting on line 17:name-)
> 
> grep tokens
> MKDEV || register_chrdev_region
> warning: md: metavariable name not used in the - or context code
> warning: md: metavariable ct not used in the - or context code
> warning: rule starting on line 17: metavariable foo not used in the -
> or context code
> warning: rule starting on line 17: metavariable foob not used in the -
> or context code
> 
> 
> 1 - foob is declared with an unknown metavariable type (ie fat-fingered)
> not one of the usual ones, nor a type defined in the includes.
> 
> 2 - is this warning telling me how to fix problem ?
> is it telling me theres a real problem ?
> 
> warning: iso braces2 does not match the code below on line 9
> {
> 
> 3 - this is not a warning, but is it relevant to the rules'
> non-performance ?  I dont see the OR in there.
> 
> the following code matched is not uniformly minus or context,
> or contains a disjunction:
> Stm:
> {
> 
> 
> thanks again.
> -jimc
> 
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to