> I would be also looking for an interface to store the text from the macro 
> definition
> into a corresponding data structure.
>
> * How do think about to look at another "story" like "Checking printk() calls 
> with SmPL"
>   once more?
>   https://github.com/coccinelle/coccinelle/issues/54#issuecomment-169988424
>
> * Which metavariable types would be appropriate for the discussed source code 
> transformation?
>
>
> I would like to point another detail out for further considerations according 
> to
> your initial request.
>
> 1. I guess that you should use the SmPL asterisk functionality if you are 
> interested
>    in only finding (or "matching") a bit of code.
>
> @macro_definition@
> @@
> *#define pr_fmt(fmt) "SVM: " fmt
>
>
> init_defs_builtins: /usr/local/lib64/coccinelle/standard.h
> minus: parse error:
>   File 
> "/home/elfring/Projekte/Coccinelle/Probe/show_macro_definition1.cocci", line 
> 3, column 29, charpos = 51
>   around = 'fmt',
>   whole content = *#define pr_fmt(fmt) "SVM: " fmt
>
>
> 2. Do you want to try another source code adjustment out?
>
> @statement_addition@
> @@
> +#undef  pr_fmt
>  #define pr_fmt(fmt) "SVM: " fmt
>
>
> elfring@Sonne:~/Projekte/Linux/next-patched> spatch.opt 
> ~/Projekte/Coccinelle/Probe/add_undef1.cocci arch/x86/kvm/svm.c
> init_defs_builtins: /usr/local/lib64/coccinelle/standard.h
> minus: parse error:
>   File "/home/elfring/Projekte/Coccinelle/Probe/add_undef1.cocci", line 4, 
> column 29, charpos = 69
>   around = 'fmt',
>   whole content =  #define pr_fmt(fmt) "SVM: " fmt
>
>
> How often would you like to use such search patterns for your source files?

I've already tried all above, but always I get parser error.
Apparently parsing #defines is not working as expected specially if
you use argument list.


/Waldek
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to