Coccinelle is a project on which I am working as part of my Outreachy internship. Yes, my internship has started. 🙂 I started working on it before a week from official internship date as I want to cover more deprecated functions during my internship. So, here as stated in my last blog I am giving a short introduction of Coccinelle. I am not going to write more detailed documentation or tutorial kind of blog here. [But someday I will] Instead I am giving links to resources so that one can go for learning about Coccinelle from there.
What is Coccinelle?
Basically Coccinelle is a program matching and transformation engine which provides the language SmPL (Semantic Patch Language) for specifying desired matches and transformations in C code. Coccinelle knows C and thus it is intelligent enough to go over C formatting and manage the things better than human. Coccinelle was initially targeted towards performing collateral evolutions in Linux. Such evolutions comprise the changes that are needed in client code in response to evolutions in library APIs, and may include modifications such as renaming a function, adding a function argument whose value is somehow context-dependent, and reorganizing a data structure. Beyond collateral evolutions, Coccinelle is successfully used for finding and fixing bugs in systems code.
What is SmPL [Semantic Patch Language]?
The input to the Coccinelle is the files to be changed and a semantic patch written in a Semantic patch language. As Linux programmers are accustomed to manipulating program modifications in terms of patch files, developers of Coccinelle base their transformation language on the patch syntax, extending patches to semantic patches. But as opposed to a traditional patch, a single small semantic patch can modify hundreds of files, at thousands of code sites. This is because the features of semantic patch language (SmPL).
Where can I get detailed explanation of Coccinelle and learn about it?
Here is a list of some resources:
- Papers Videos And Slides on LIP6
- Some recent videos of Julia Lawall’s talk on Coccinelle Link 1 Link 2
- Documentation [This link provides documentation and details about recent version of Coccinelle]