> Just wrapping the assignment into the macro call turned out to be easy.
I am curious how your transformation approaches will evolve further. > But I haven't found a way to remove the now #ifdef :( The support for preprocessor functionality is limited by the semantic patch language so far. Would you like to try another SmPL script variant out? @replacement@ constant text; expression value; identifier my_name; type driver_type; @@ static driver_type my_name = { .driver = { - .name = text, - .of_match_table = value, - }, + .name = text, + .of_match_table = of_match_ptr(value), + }, ... }; Do you find the following test result acceptable finally? elfring@Sonne:~/Projekte/Linux/next-patched> spatch ~/Projekte/Coccinelle/Probe/Weigelt8.cocci sound/soc/codecs/pcm3060-i2c.c init_defs_builtins: /usr/local/bin/../lib/coccinelle/standard.h … @@ -45,9 +45,7 @@ MODULE_DEVICE_TABLE(of, pcm3060_of_match static struct i2c_driver pcm3060_i2c_driver = { .driver = { .name = "pcm3060", -#ifdef CONFIG_OF - .of_match_table = pcm3060_of_match, -#endif /* CONFIG_OF */ + .of_match_table = of_match_ptr(pcm3060_of_match), }, .id_table = pcm3060_i2c_id, .probe = pcm3060_i2c_probe, Regards, Markus _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci