Could you give some more context (or just resend the email
that this is referring to)?

I hope that you do not mind the following repetition. Would you like to reply to any more requests from the previous weekend?


-------- Original Message --------
Date: Sat, 03 Dec 2011 15:15:41 +0100

> Anyway, you may also want to consider cases where the result of the function is assigned to a variable that is unused.

I would like to extend the suggested example. But I see the next challenges
besides variable assignment chains.

How can the following use cases be efficiently specified for the semantic patch
language?
A function return value or a corresponding variable is not used in ...
1. ... a conditional expression.
2. ... a function call parameter.

Would it be needed to filter the source code with positive checks and apply a
negation in the last analysis step like in the following approach?

@is_assigned@
identifier x, y;
@@
 y = x(...)

@is_checked1@
identifier is_assigned.y;
@@
(
 if (<+... y ...+>)
|
 (<+... y ...+>) ? ... : ...
)

@is_checked2@
identifier f;
@@
(
 if (<+... f(...) ...+>)
|
 (<+... f(...) ...+>) ? ... : ...
)

@is_forwarded@
identifier c, f, assign.y;
@@
(
 c(..., y, ...)
|
 f(...)
 {<+...
 c(..., y, ...);
 ...+>}
)

@depends on !is_void && !(is_checked1 && is_checked2 && is_forwarded)@
identifier r.f, g;
@@
 g(...)
 {<+...
* f(...);
 ...+>}


Will it also be needed here to distinguish the used identifiers between names
for function and preprocessor macro calls?

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