Martijn Coenen
2018-01-12 16:19:16 UTC
Hello,
I can't find a clear-cut answer on whether macro expansion is supported in
Coccinelle. There's a "--preprocess" option which says it runs the C
preprocessor before doing the match, but it didn't appear to do anything
when I tried it.
Background: I'm trying to do a semantic patch that is only applied when a
certain function is called or assigned. Unfortunately in some cases, the
function call is embedded in a macro, and so Coccinelle will not find it.
I'm aware I can manually define a macros file and have it expanded this
way, but I want to make this as generic as possible and have it work for
any function in the linux kernel - which means I'd have to put *lots* of
macros in there :)
Any suggestions?
Thanks,
Martijn
I can't find a clear-cut answer on whether macro expansion is supported in
Coccinelle. There's a "--preprocess" option which says it runs the C
preprocessor before doing the match, but it didn't appear to do anything
when I tried it.
Background: I'm trying to do a semantic patch that is only applied when a
certain function is called or assigned. Unfortunately in some cases, the
function call is embedded in a macro, and so Coccinelle will not find it.
I'm aware I can manually define a macros file and have it expanded this
way, but I want to make this as generic as possible and have it work for
any function in the linux kernel - which means I'd have to put *lots* of
macros in there :)
Any suggestions?
Thanks,
Martijn