On 21 January 2011 23:38, Philipp Kutin <[email protected]> wrote:
> Hi,
>
> I'm trying to do my first steps with Coccinelle but can't get the following
> to work: basically, for debugging, I want to implement a poor man's array
> bound check by doing something like
>
> @@
> expression E;
> @@
>
> - sprite[E]
> + sprite[{( int tmp=E; (tmp<0 ? (*(int*)123=234) : tmp) )}]

Could you not wrap that construct inside a pre-processor macro? I.e.

- sprite[E]
+ sprite[ARRAY_BOUND_CHECK(E)]

As a bonus, I think that also would improve readability.

BR Håkon Løvdal
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to