Cocci seems to have problems with { } blocks inside #if statements.
For example, the following code:
void func1(U32 Notifier)
{
if (x == 0)
{
x = 1;
}
#ifndef MACRO
else if (x == 1)
{
x = 2;
}
#endif
else
{
return;
}
DBG_PRINTF((DBG_MODULE_PERFCTL, DBG_LEVEL_INFO, "hello\n"));
}
Gives me this error:
ERROR-RECOV: found sync '}' at line 19
parsing pass2: try again
ERROR-RECOV: found sync '}' at line 19
parsing pass2: try again
In this case, my nv_printf.cocci is still able to process the
DBG_PRINTF and convert it to NV_PRINTF, so technically it still works.
However, I have much more complex source files (which I cannot share)
that choke spatch. I typically get multiple "found sync }" messages
along with stuff like:
PB MAYBE: dangerous typedef inference, maybe not a typedef: NvU8
TYPEDEF CONFLICT:NvU8
FLOW: cant jump to done: because we can't find this label
In this last case, the label "done" does exist, but it's called only
from within macros.
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci