Hi,

I'd like to know how to deal with "already tagged token" errors. I've
tried several methods to accomplish the following, but either way,
sometimes I get this error.

What I want to do is to fully parenthesize conditional expressions, so:

"if (a && b && !c->test)" becomes "if ((a) && (b) && (!c->test))"

With the patch attached I almost succeeded (running twice), but
depending on the number of expressions, it fails with the error I
said. See the patch and test file attached.


regards,

Lucas De Marchi

Attachment: paren3.cocci
Description: Binary data


int main()
{
    int a, b, c;

    if (a)
        return 0;

    if (a && b)
        return 2;

    if (!a && !b)
        return 2;

    if (a && (!b))
        return 1;

    if ((a) && (b))
        return 0;

    if ((!a) && (!b))
        return 0;

    if ((a) && !b)
        return 1;

    if ((a) && (!b) && c)
        return 2;

    if (a && (b) && (!c))
        return 1;

    if (a && b && !c)
        return 3;

// should be:
//  if ((a) && (f->test) && (!g.test2) && (test5))
    if (a && f->test && !g.test2 && test5)
        return 2;
//should be:
//  if ((a) && (b) && (!c) && (d) && (e) && (f) && (i))
    if (a && b && !c && d && e && f && i)
        return 3;

}
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to