From mboxrd@z Thu Jan 1 00:00:00 1970 From: julia.lawall@lip6.fr (Julia Lawall) Date: Thu, 15 Sep 2016 08:03:56 +0200 (CEST) Subject: [Cocci] Match #define in cocci In-Reply-To: References: Message-ID: To: cocci@systeme.lip6.fr List-Id: cocci@systeme.lip6.fr On Thu, 15 Sep 2016, Waldemar Rymarkiewicz wrote: > > > > Could you send the exact semantic patch that you tried? Coccinelle should > > allos parsing #defines. > > Simply > > @@ > @@ > -#define pr_fmt(fmt) KBUILD_MODNAME > > works, but > > @@ > @@ > -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > > fails with > > Fatal error: exception Failure("minus: parse error: \n = File > \"patches/1021-pr_fmt_undef.cocci\", line 4, column 38, charpos = > 59\n around = '\"', whole content = #define pr_fmt(fmt) > KBUILD_MODNAME \": \" fmt\n") > > but even if I want to match just > > @@ > @@ > -#define pr_fmt(fmt) KBUILD_MODNAME fmt > > it also fails with > > Fatal error: exception Failure("minus: parse error: \n = File > \"patches/1021-pr_fmt_undef.cocci\", line 4, column 0, charpos = 21\n > around = '#define pr_fmt(', whole content = #define pr_fmt(fmt) > KBUILD_MODNAME fmt\n") OK, thanks I will look into it. At least in the last case, that is not the intended behavior. julia