Discussion:
[Cocci] Code wrapped in macros ignored by script
Timur Tabi
2018-08-02 20:26:15 UTC
Permalink
My cocci script (attached) ignores lines that are embedded inside other
macros.  Example:

#define DB(x)   x

void func()
{
    DB(if (DEBUG_IO_TRACE())
                DBG_PRINTF((DBG_MODULE_GLOBAL, DBG_LEVEL_INFO, "inb
%#04x \n", addr));)
}

Is there a way to get coccinelle to ignore the DB( and )?


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
Julia Lawall
2018-08-02 20:33:25 UTC
Permalink
Post by Timur Tabi
My cocci script (attached) ignores lines that are embedded inside other
#define DB(x)   x
void func()
{
    DB(if (DEBUG_IO_TRACE())
                DBG_PRINTF((DBG_MODULE_GLOBAL, DBG_LEVEL_INFO, "inb %#04x \n",
addr));)
}
Is there a way to get coccinelle to ignore the DB( and )?
No. Either Coccinelle can parse the macro use as is, which is not
possible here, because an if can't be an argument to a function call, or
it expands the macro, in which case no transformation is possible.

julia

Loading...