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? What triggers spatch to warn about this?

-- 
Francis Galiegue, [email protected]
"It seems obvious [...] that at least some 'business intelligence'
tools invest so much intelligence on the business side that they have
nothing left for generating SQL queries" (Stéphane Faroult, in "The
Art of SQL", ISBN 0-596-00894-5)
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to