This tool incorporates a series of Coccinelle semantic patches designed to detect 14 out of the 15 Atoms of Confusion as identified and empirically validated in our prior work. These atoms are common syntactic features in C code that can lead to misunderstanding and errors. It's important to note that the "Preprocessor in Statement" atom cannot be detected using Coccinelle.
- Coccinelle Patches: Targets 14 different atoms of confusion.
- CLI Wrapper: Simplifies the process of applying these patches to a C codebase.
Before installing this tool, you must install Coccinelle. Please be aware that Coccinelle is designed to run on Linux and cannot be installed natively on Windows (but can be installed on MacOS).
The supported version of Coccinelle is specified in config.json (currently version 1.3). To install Coccinelle,
follow the instructions from the official installation guide.
Once Coccinelle is installed, you can install this tool. To install it in an editable mode, which is useful for development, run the following command from the root of the project:
pip install -e .To run the patches, use the command aoc-cocci. By default, all patches will be applied, but you can also specify a
particular patch to run:
aoc-cocci dir-with-c-files --patch reversed_subscript --output-dir outputThis command specifies that only the reversed subscript patch should be applied and the results should be saved to the output directory.
To run the linux fixes tool use the command aoc-linux-fixes. This tool is used to examine bug fix commits to the linux kernel.
aoc-linux-fixes dir-with-linux-repo --output-dir output_dir --history_length "1 year" --cpus 4This command specifies to run atoms patches on linux kernel commits going back 1 year from now using 4 worker processes. If history length is not specified, all commits going back to the introduction of specific commit messages for bug fixes. If cpus is set to 0, it will use the system's cpu count, default is 4.