> 1. How should update candidates be filtered from the current source file?
> - @function_name@(...)
> {
> ... /* Where is a return value not used as expected? */
> }

I don't understand the notation.  The return value of what?  Is 
@function_name@ the name of the function whose return value is ignored 
elsewhere, or is it the name of a function in whose body you want to find 
ignored return values.

The following finds a call whose result is never used until the end of the 
function or until reaching a reassignment.  (? marks something that is 
optional).

@@
identifier x;
expression fn,E;
@@

x = fn(...);
+ ???
... when != x
?x = E

You can put whatever you want in the ??? line.  But what you would want to 
put there depends on the return value of fn.  If you want to see how to 
collect information about certain kinds of return values, then that is 
presented in the "advanced SmPL" slides on this page: 
http://coccinelle.lip6.fr/papers.php and in demos/iteration.cocci.  
Otherwise, maybe the programmer should just think about it himself.  That 
would make sense if the software is big and there are expected to be few 
of these bugs.  In that case, you could just note the position of the 
assignment and print it in a subsequent python rule.

julia


> 2. Where should the corresponding source code adjustment be specified?
> + @context@ exit(errno);
> 
> I would like to insert an "after advice" only if some known preconditions are
> fulfilled.
> http://en.wikipedia.org/wiki/Aspect-oriented_programming#AspectJ.27s_join-point_model
> http://research.msrg.utoronto.ca/ACC/Tutorial#A_Reusable_Aspect_for_Memory_All
> 
> Regards,
> Markus
> 
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to