Hello,

I would like to check the implementation of exception handling in various
source files. The following script for the semantic patch language tries to
express a few possibilities for such a source code search pattern.


@show_special_reactions@
expression error_code, var;
identifier action =~ "^(?:malloc|strdup)$",
           no_return =~ "[Aa]bort",
           label;
statement es;
@@
 var = action(...);
 if (failed(var))
 {
(
*   return error_code;
|
*   goto label;
|
*   no_return();
)
 }
 else
 es


I find this approach too simple and therefore incomplete. Three well-known
reactions are shown. But there can be more source code before these statements
like further function calls and variable assignments.
We do eventually not know the extra code there and it can also be
generally optional.

How can the Coccinelle software help any more in such an use case?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to