FREEDOM251

Freedom251 › Code Refactoring Tools

Coccinelle

Free plan LinuxMac

Visit Coccinelle Alternatives Pricing

Coccinelle's own site

What Coccinelle is

Coccinelle is a free desktop program matching and transformation engine for C and C++ code, available on Linux and macOS. It uses SmPL to describe code patterns and the transformations to apply when matches are found. A single semantic patch can make changes across hundreds of files and thousands of code sites while allowing for differences in spacing, variable names, irrelevant code and coding style. The project describes using it to automate collateral changes after library API evolution and to find and fix bugs in systems code. Coccinelle semantic patches and bug fixes have been integrated into the official Linux tree, and its semantic patches are available in the Linux scripts directory; coccicheck can apply multiple SmPL files to a project. The project says C++ support is being extended, including for high performance computing, and C++ mode is invoked with --c++. The download page lists version 1.3.3, dated September 2, 2026, with source code and precompiled spatch builds. Source builds require OCaml, with Python and Menhir needed in certain situations. Documentation includes spatch options, an annotated SmPL grammar, examples and an introductory lecture.

Who it suits

Coccinelle suits developers working on C code across repositories, particularly when applying broad code changes or addressing systems-code bugs. It may also interest C++ and high performance computing users following the project's extension of C++ support.

What it does well

  • Semantic patches can update many files and code sites.
  • Handles variation in spacing, names and coding style.
  • Semantic patches and bug fixes are integrated into Linux.
  • Free, with source and precompiled spatch builds available.
  • Documentation includes grammar, examples and an introductory lecture.

What to know first

  • Available for Linux and macOS only.
  • Building from source requires OCaml.
  • Python and Menhir are needed in certain build situations.

Plans

PlanBilled and limitsPrice
CoccinelleNo paid plan information stated on the official siteFree

As coccinelle.gitlabpages.inria.fr lists them, read 5 Oct 2026. The maker's own page has the final word.

Getting started

  1. Open the Coccinelle website.
  2. Choose Linux or macOS as the desktop platform.
  3. Download source code or a precompiled spatch build.
  4. For a source build, install OCaml; Python is optional, and Menhir is needed when modifying the SmPL grammar or after make distclean.
  5. Read the spatch options and SmPL grammar documentation, then review the examples.

Coccinelle is a program-matching and transformation engine for expressing C code changes as semantic patches. It suits developers maintaining large C repositories, particularly systems code; it is a focused choice for broad, style-tolerant edits, not a general-purpose refactoring suite.

Overview

Coccinelle uses SmPL to describe the code patterns to find and the transformations to make. A single patch can reach across hundreds of files and thousands of sites while abstracting away differences such as spacing, variable names, unrelated code, and coding style. That makes it useful when an API change or a recurring bug calls for a consistent repository-wide correction.

The Linux kernel provides a concrete sign of its role: the project cites semantic-patch changes and bug fixes integrated into the official tree. This is a specialized tool with a substantial learning surface, however; its value depends on being able to express the intended change in SmPL.

Key features

Semantic patches at repository scale

SmPL lets maintainers define a transformation in terms of code structure rather than exact text. The ability to account for irrelevant code and stylistic variation can make one patch useful across many call sites where search-and-replace would be brittle. The trade-off is that users need to understand the patch language and validate that its matching rules fit the change they intend.

Kernel workflows and learning resources

Semantic patches are available in the Linux scripts directory, and coccicheck scripts can apply multiple SmPL files to a project. Documentation includes spatch options, an annotated SmPL grammar, examples, and an introductory lecture. These resources are especially relevant to kernel and systems maintainers, though they do not turn Coccinelle into a turnkey editor workflow.

C++ support in progress

Coccinelle is being extended for C++ and can be invoked in C++ mode with --c++. The project also identifies high-performance computing as an application area. Because C++ support is still being extended, teams choosing a refactoring tool for established, broad C++ workflows should weigh that maturity against their needs.

Pricing

Coccinelle is free: the Coccinelle plan costs free. There is no free trial because the software is free. There are no paid tiers to compare, so the decision is less about subscription limits than whether a source-based, SmPL-driven tool suits the team's workflow.

Platforms

Coccinelle supports Linux and macOS and is categorized as desktop software. The download page offers source code and precompiled spatch builds. Building from source requires OCaml; Python 2.5–2.7 or Python 3 is optional. Menhir is needed when modifying the SmPL grammar or after make distclean. Those prerequisites matter most to teams that need to build or modify the tool rather than use a precompiled build.

Who it's for

Coccinelle is best suited to maintainers of C repositories who need repeatable, large-scale transformations or bug fixes that tolerate differences between code sites. Kernel contributors have a particularly direct fit with the semantic patches and coccicheck integration. Teams seeking a general editor extension, or those whose primary need is mature C++ refactoring, should consider alternatives aligned more closely with those workflows.

Pros and cons

Pros

  • Repository-wide reach: one semantic patch can transform thousands of sites across hundreds of files, reducing the need to handle each match as a separate edit.
  • Resilient matching: patches can abstract over formatting, names, coding style, and unrelated code, which helps when equivalent code is not textually identical.
  • Free distribution: the free plan avoids subscription costs for teams adopting it.
  • Relevant kernel integration: semantic patches and coccicheck scripts support workflows already used in Linux source trees.

Cons

  • SmPL is a specialized skill: expressing transformations in a semantic patch adds a language to learn and makes the tool less suited to users who want straightforward point-and-click refactoring.
  • Build prerequisites: source builds require OCaml, with additional requirements in some grammar-development and clean-build cases.
  • C++ is still being extended: C++ users may prefer a tool whose support better matches a mature C++-first workflow.
  • Limited platform scope: support is for Linux and macOS, so it is not a fit for teams requiring a Windows platform.

Alternatives

Code Refactoring Tools is the broader category to browse if Coccinelle's specialized semantic-patch approach is not the right fit.

  • ast-grep is another free option, with listed platforms spanning API, extension, Linux, macOS, web, and Windows; consider it when that platform range better suits your environment.
  • CodeRush has a free plan and is available on extension, Linux, macOS, and Windows; consider it if you want a different refactoring option with those platform choices.
  • ReSharper offers a free non-commercial plan with C# support in VS Code and compatible editors, as well as a paid plan at 389.00 USD per; consider it for that C# editor use case rather than Coccinelle's C-focused patching.
  • Roslynator is free and offers tools and extensions, making it an alternative for readers seeking that form of tooling.
  • CodART is MIT-licensed software available on API, Linux, self-hosted, and web platforms; SciTools Understand requires a separate professional license. Consider it if those deployment options and license terms suit your setup.
  • OpenRewrite provides a free core framework and Apache-licensed recipes, running one repository at a time; consider it if that repository-at-a-time model fits your work.
  • Sourcery has a free Open Source plan for public repositories with AI reviews, PR summaries and diagrams, one-click fixes, and custom review rules; consider it for that review-oriented workflow.
  • Spoon is a free and open-source alternative; consider it if you want another no-cost option.

Verdict

Choose Coccinelle if you maintain a substantial C codebase and need semantic, repeatable changes across many files without relying on exact textual matches. Its strongest case is repository-wide transformation grounded in SmPL, reinforced by Linux kernel workflows. Look elsewhere if you need Windows support, a conventional editor-centered refactoring experience, or established C++ coverage.

Verdict

Coccinelle focuses on repository-wide matching and transformations expressed as semantic patches. It is free, but source builds have prerequisites and C++ support is still being extended.

Questions

What does Coccinelle do?

It matches and transforms code using SmPL descriptions. The project describes using it for collateral changes after library API evolution and for finding and fixing bugs in systems code.

Which languages and platforms does it support?

The listed languages are C and C++. It is available as desktop software for Linux and macOS.

How much does it cost?

The listed Coccinelle plan is free.

What can I download?

The download page offers source code and precompiled spatch builds. It lists version 1.3.3, dated September 2, 2026.

What is needed to build it from source?

OCaml is required. Python 2.5–2.7 or Python 3 is optional, and Menhir is needed when modifying the SmPL grammar or after make distclean.

Where can I get help or contribute?

Questions can be sent to the [email protected] mailing list, which moderates messages from non-members. Contributions are preferred through the list and may also be submitted on GitHub.

Facts from Coccinelle's own pages

Build requirements
Building from source requires OCaml, optionally Python 2.5–2.7 or Python 3, and Menhir when modifying the SmPL grammar or after make distclean. · coccinelle.gitlabpages.inria.fr, 5 Oct 2026
C++ and HPC
The project says Coccinelle is being extended for C++ code, with high performance computing as an application area, and C++ mode is invoked with --c++. · coccinelle.gitlabpages.inria.fr, 5 Oct 2026
Documentation
The project provides spatch option documentation, an SmPL grammar document with annotated examples, additional examples, and an introductory lecture. · coccinelle.gitlabpages.inria.fr, 5 Oct 2026
Download
The official download page lists version 1.3.3, dated September 2, 2026, and provides source code and precompiled spatch builds. · coccinelle.gitlabpages.inria.fr, 5 Oct 2026
Linux integration
Coccinelle semantic patches are available in the Linux scripts directory, and coccicheck scripts can apply multiple SmPL files to one project. · coccinelle.gitlabpages.inria.fr, 5 Oct 2026
Linux kernel
The project lists semantic patch changes and bug fixes that have been integrated into the official Linux tree. · coccinelle.gitlabpages.inria.fr, 5 Oct 2026
Maintainers
The project lists Julia Lawall, Victor Gambier, Michele Martone, and Tathagata Roy as people currently working on Coccinelle. · coccinelle.gitlabpages.inria.fr, 5 Oct 2026
Platforms
The download page provides packages for several Linux distributions and says Coccinelle can be installed with brew on Linux and macOS. · coccinelle.gitlabpages.inria.fr, 5 Oct 2026
Purpose
Coccinelle is a program matching and transformation engine that uses SmPL to specify desired matches and transformations in C code. · coccinelle.gitlabpages.inria.fr, 5 Oct 2026
Security
The official pages opened for this research do not state security certifications, compliance claims, or a security program. · coccinelle.gitlabpages.inria.fr, 5 Oct 2026
Semantic patches
A single semantic patch can modify hundreds of files at thousands of code sites while abstracting over spacing, variable names, irrelevant code, and coding style. · coccinelle.gitlabpages.inria.fr, 5 Oct 2026
Support
Questions can be sent to the [email protected] mailing list, which is moderated for non-members; contributions are preferred via the list and may also be submitted on GitHub. · coccinelle.gitlabpages.inria.fr, 5 Oct 2026
Use cases
The project describes use for automating collateral code changes after library API evolution and for finding and fixing bugs in systems code. · coccinelle.gitlabpages.inria.fr, 5 Oct 2026

Where Coccinelle stands on Freedom251

Look at these too