c - Coccinelle: Change ordered struct declaration to unordered -


i'm trying find resources/tutorials me create coccinelle script find structure declarations , change them ordered unordered.

in our code base use several structs hundreds of times. added member in middle of definition , need update hundreds of declarations. default value of 0 if switch declarations order unordered, good, , more future proof next change.

ex:

struct some_struct {    int blah;    int blah2; }  // code now. struct some_struct ex1 = {    0,    1, };  // need script change struct some_struct ex2 = {    .blah1 = 0,    .blah2 = 1 } 

can point me in right direction?

coccinelle tutorials: http://coccinelle.lip6.fr/papers.php

you can try mailing list asking questions. may work:

@@ constant c1, c2; identifier i; @@ struct some_struct = { +       .blah1 =         c1, +       .blah2 =         c2, }; 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -