On Fri, 20 May 2011, Francis Galiegue wrote: > Hello, > > We need to verify whether after a call to one specific function, > amfree(), errno is checked within the enclosing block (since amfree() > saves and restores errno, but we want to get rid of amfree() because > of that). > > Here is the smpl file I came up with: > > ---- > @r@ > identifier x; > position p1, p2; > @@ > > amfree(x@p1); > ... > errno@p2 > > @script:python@ > x << r.x; > p1 << r.p1; > p2 << r.p2; > ident; > @@ > > ident = "%s" % x > print "File %s: %s amfree()d line %s, errno checked line %s" % > (p1[0].file, ident, p1[0].line, p2[0].line) > ---- > > While it works, from time to time, for some files but not all, I see > this output from spatch: > > warning: line 8: should errno be a metavariable? > > Why only for some files?
It depends on how you are running spatch. If you use the -dir option, then you should see the error only once, because it parses the semantic patch only once. > What triggers spatch to warn about this? Most of the time, and identifier that is not in function position is intended to be a metavariable. That is not your case, so you can just ignore the warning. julia _______________________________________________ Cocci mailing list [email protected] http://lists.diku.dk/mailman/listinfo/cocci (Web access from inside DIKUs LAN only)
