On Sun, 28 Mar 2021, Markus Elfring wrote:
> > If you find that something does not work satisfactorily, propose a
> > semantic patch and show what doesn't work.
Obviously this doesn't work. Just like
> > I'm not going to try to solve a problem when I don't know what the problem
> > is.
> Another SmPL script example:
> identifier i;
> expression e;
> *#define i e
> elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch show_define_usage2.cocci
> -#define PW_CLIENT_EVENT_INFO 0
And what is the problem here?
> > I think that this tranformation would be diffficult to make using
> > Coccinelle,
> * I imagine also that it can be challenging to determine which preprocessor
> can really be converted to enumerations.
> * My programmer eyes were trained for some pattern recognition.
> > due to the need to ensure that the enum values are end up in the
> > right order, if you want to rely on the implicit values of enums.
> 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, unless you want to
provide all the values explicitly.
> > 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 and the definitions
are typically far from the uses.
> * Would you like to reuse another named data type?
Cocci mailing list