I don't know how to properly describe what I'm trying to do, so I'll just show an example.
The code I'm working on has dozens of annoying macros that concatenate parameters into strings. For example, #define DRF_DEF(d,r,f,c) \ (((NvU32)(NV ## d ## r ## f ## c))<<DRF_SHIFT(NV ## d ## r ## f)) So given DRF_DEF(one, two, three, four), it will generated: (((NvU32)(NV_one_two_three_four))<<DRF_SHIFT(NV_one_two_three)) I'm trying to create a cocci rule that will replace all of these macros with their expanded equivalents, but I don't know how to handle the ## feature of macros. So far I have this: @@ expression d, r, f, n, v; @@ -FLD_SET_DRF_NUM(d, r, f, n, v) +((v) & ~DRF_SHIFTMASK(NV d r f)) | DRF_NUM(d, r, f, n) But this gives an error because "NV d r f" is not valid C. _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci