On Sun, 28 Mar 2021, Markus Elfring wrote: > >> @display@ > >> @@ > >> *#define > > > > Obviously this doesn't work. Just like > > > > @@ > > @@ > > *if > > > > doesnt' work. > > Can it become possible to find such key words in the source code > (by such SmPL search approaches)? No. As has been explained many times before, Coccinelle works on complete terms - expressions, statements, etc. If you want to find keywords, use grep. julia > > > >> Another SmPL script example: > >> > >> @display2@ > >> identifier i; > >> expression e; > >> @@ > >> *#define i e > >> > >> > >> elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch show_define_usage2.cocci /usr/include/pipewire-0.3/pipewire/client.h > >> … > >> -#define PW_CLIENT_EVENT_INFO 0 > >> … > > > > And what is the problem here? > > The challenge to determine reasonable group criteria. > > > >> I am looking again for the application of algorithms according to > >> longest common text (or prefixes) in used symbols. > > > > This may (or may not) give you the right grouping, but you will still have > > to ensure that the elements end up in the right order, > > Yes, of course. > > > > unless you want to provide all the values explicitly. > > Special identifier combinations can be converted to enumerations, can't they? > > > >>> Furthermore, if this is targeting C code, the benefits will be limited, > >>> because C considers enums to be the same as ints. > >> > >> * Will such a transformation help with software debugging? > > > > Not likely, because the compiler provides no support > > I got informed that some development tools can work better with enumeration identifiers > (instead of macro names). > > > > and the definitions are typically far from the uses. > > This is usual. > > Regards, > Markus >