|
@@ -4,6 +4,8 @@
|
|
|
|
|
|
.. highlight:: none
|
|
|
|
|
|
+.. _devtools_coccinelle:
|
|
|
+
|
|
|
Coccinelle
|
|
|
==========
|
|
|
|
|
@@ -12,7 +14,7 @@ many uses in kernel development, including the application of complex,
|
|
|
tree-wide patches and detection of problematic programming patterns.
|
|
|
|
|
|
Getting Coccinelle
|
|
|
--------------------
|
|
|
+------------------
|
|
|
|
|
|
The semantic patches included in the kernel use features and options
|
|
|
which are provided by Coccinelle version 1.0.0-rc11 and above.
|
|
@@ -30,23 +32,31 @@ of many distributions, e.g. :
|
|
|
- NetBSD
|
|
|
- FreeBSD
|
|
|
|
|
|
-You can get the latest version released from the Coccinelle homepage at
|
|
|
+Some distribution packages are obsolete and it is recommended
|
|
|
+to use the latest version released from the Coccinelle homepage at
|
|
|
http://coccinelle.lip6.fr/
|
|
|
|
|
|
-Information and tips about Coccinelle are also provided on the wiki
|
|
|
-pages at http://cocci.ekstranet.diku.dk/wiki/doku.php
|
|
|
+Or from Github at:
|
|
|
+
|
|
|
+https://github.com/coccinelle/coccinelle
|
|
|
|
|
|
-Once you have it, run the following command::
|
|
|
+Once you have it, run the following commands::
|
|
|
|
|
|
- ./configure
|
|
|
+ ./autogen
|
|
|
+ ./configure
|
|
|
make
|
|
|
|
|
|
as a regular user, and install it with::
|
|
|
|
|
|
sudo make install
|
|
|
|
|
|
+More detailed installation instructions to build from source can be
|
|
|
+found at:
|
|
|
+
|
|
|
+https://github.com/coccinelle/coccinelle/blob/master/install.txt
|
|
|
+
|
|
|
Supplemental documentation
|
|
|
----------------------------
|
|
|
+--------------------------
|
|
|
|
|
|
For supplemental documentation refer to the wiki:
|
|
|
|
|
@@ -54,6 +64,10 @@ https://bottest.wiki.kernel.org/coccicheck
|
|
|
|
|
|
The wiki documentation always refers to the linux-next version of the script.
|
|
|
|
|
|
+For Semantic Patch Language(SmPL) grammar documentation refer to:
|
|
|
+
|
|
|
+http://coccinelle.lip6.fr/documentation.php
|
|
|
+
|
|
|
Using Coccinelle on the Linux kernel
|
|
|
------------------------------------
|
|
|
|
|
@@ -114,7 +128,7 @@ To enable verbose messages set the V= variable, for example::
|
|
|
make coccicheck MODE=report V=1
|
|
|
|
|
|
Coccinelle parallelization
|
|
|
----------------------------
|
|
|
+--------------------------
|
|
|
|
|
|
By default, coccicheck tries to run as parallel as possible. To change
|
|
|
the parallelism, set the J= variable. For example, to run across 4 CPUs::
|
|
@@ -209,7 +223,7 @@ err.log will now have the profiling information, while stdout will
|
|
|
provide some progress information as Coccinelle moves forward with
|
|
|
work.
|
|
|
|
|
|
-DEBUG_FILE support is only supported when using coccinelle >= 1.2.
|
|
|
+DEBUG_FILE support is only supported when using coccinelle >= 1.0.2.
|
|
|
|
|
|
.cocciconfig support
|
|
|
--------------------
|
|
@@ -226,7 +240,7 @@ Since coccicheck runs through make, it naturally runs from the kernel
|
|
|
proper dir, as such the second rule above would be implied for picking up a
|
|
|
.cocciconfig when using ``make coccicheck``.
|
|
|
|
|
|
-``make coccicheck`` also supports using M= targets.If you do not supply
|
|
|
+``make coccicheck`` also supports using M= targets. If you do not supply
|
|
|
any M= target, it is assumed you want to target the entire kernel.
|
|
|
The kernel coccicheck script has::
|
|
|
|
|
@@ -319,7 +333,7 @@ as an example if requiring at least Coccinelle >= 1.0.5::
|
|
|
// Requires: 1.0.5
|
|
|
|
|
|
Proposing new semantic patches
|
|
|
--------------------------------
|
|
|
+------------------------------
|
|
|
|
|
|
New semantic patches can be proposed and submitted by kernel
|
|
|
developers. For sake of clarity, they should be organized in the
|