On Sat, 29 Aug 2020, Markus Elfring wrote: > Hello, > > The following small script variant for the semantic patch language gets accepted > according to the software combination “Coccinelle 1.0.8-00159-g730dbb03”. > > @replacement@ > identifier array, instance, size; > type T; > @@ > ( > -sizeof(T) > | > -sizeof(*instance->array) > ) > * > +flex_array_size(instance, array, > instance->size > + ) This semantic patch will fail if the sizeof(T) option is matched, becuse then it won't be able to create the + code, since it won't know what array should be. > > > But I observe data processing difficulties if I would like to mark > the multiplication operator also for deletion (on a separate line). > > elfring@Sonne:~/Projekte/Coccinelle/Probe> spatch --parse-cocci flex_array_size-test2-20200829.cocci > init_defs_builtins: /usr/local/bin/../lib/coccinelle/standard.h > File "flex_array_size-test2-20200829.cocci", line 10, column 1, charpos = 103 > around = '*', > whole content = -* > > > Can such a transformation specification become supported? This doens't work because you have no space beterrn the - and the *. The characters - + * ? ( ) | and & are treated in a special way in column 0, and more generally when there is no whitespace before them in the line. julia