Skip to content

Commit

Permalink
documentation: coccinelle: Improve command example for make C={1,2}
Browse files Browse the repository at this point in the history
Modify coccinelle documentation to further clarify
the usage of the makefile C variable by coccicheck.

Signed-off-by: Sumera Priyadarsini <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jonathan Corbet <[email protected]>
  • Loading branch information
Sylfrena authored and Jonathan Corbet committed Aug 11, 2020
1 parent ec8213f commit a5019c7
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Documentation/dev-tools/coccinelle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,20 @@ For example, to check drivers/net/wireless/ one may write::
make coccicheck M=drivers/net/wireless/

To apply Coccinelle on a file basis, instead of a directory basis, the
following command may be used::
C variable is used by the makefile to select which files to work with.
This variable can be used to run scripts for the entire kernel, a
specific directory, or for a single file.

make C=1 CHECK="scripts/coccicheck"
For example, to check drivers/bluetooth/bfusb.c, the value 1 is
passed to the C variable to check files that make considers
need to be compiled.::

To check only newly edited code, use the value 2 for the C flag, i.e.::
make C=1 CHECK=scripts/coccicheck drivers/bluetooth/bfusb.o

make C=2 CHECK="scripts/coccicheck"
The value 2 is passed to the C variable to check files regardless of
whether they need to be compiled or not.::

make C=2 CHECK=scripts/coccicheck drivers/bluetooth/bfusb.o

In these modes, which work on a file basis, there is no information
about semantic patches displayed, and no commit message proposed.
Expand Down

0 comments on commit a5019c7

Please sign in to comment.