On Wed, 9 Mar 2011, Nicolas Kaiser wrote:

> * Julia Lawall <[email protected]>:
> > Are you sure that your function is being parsed successfully?  I get a 
> > reasonable answer for:
> > 
> > int main ()
> > {
> >   for (i = 0; i != 10; ++i) {
> >       switch (q) {
> >         case FOO:
> >           for (i = 0; i != 20; ++i) {
> >               return 12;
> >             }
> >         case XXX:
> >       return 12;
> >         }
> >     }
> > }
> 
> You're right. I extracted the loops, and it works:
> 
> @@ -1,5 +1,4 @@
>  int main() {
> -     for (i = 0; i < nr_secflavs; ++i) {
>               READ_BUF(4);
>               READ32(dummy);
>               switch (dummy) {
> @@ -25,7 +24,6 @@ int main() {
>                       READ_BUF(4);
>                       READ32(dummy);
>                       READ_BUF(dummy * 4);
> -                     for (i = 0; i < dummy; ++i)
>                               READ32(dummy);
>                       break;
>               case RPC_AUTH_GSS:
> 
> 
> But for some reason, this doesn't work in the original file:
> 
> HANDLING: /usr/src/linux/fs/nfsd/nfs4xdr.c
> Note: processing took    12.4s: /usr/src/linux/fs/nfsd/nfs4xdr.c

Try running spatch -parse_c file.c

Then you should be able to get some information about any parsing problems 
that it encounters.  Perhaps there is a problem with macros or typedefs, 
where it is finding information in one part of the file that is causing a 
later part of the file to be parsed badly.

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

Reply via email to