Even though bash is commonly available as /bin/bash there are
exceptions (e.g NixOS). This commit allow the use of the scripts in my
environment and is generic.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Zephyr uses some defines to provide additional information about the
item being declared. When unrecognized these can confuse the
Coccinelle parser so that it does not apply semantic patches in
situations where they should be applied.
Add a macro file that extends the Coccinelle builtin macro file with
some identifiers that are specific to Zephyr.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Found a few annoying typos and figured I better run script and
fix anything it can find, here are the results...
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
SPFLAGS allows to pass additional flags supported by
spatch during transformation.
Both short notation `-f=` and `--sp-flag=` can be used
to pass the flag to the coccicheck.
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
The current implementation of continuous run operation using
command `./scripts/coccicheck` i.e., without specifying any options,
`coccicheck` default runs in `report` mode with all available
coccinelle scripts present at `scripts/coccinelle/`.
Not all scripts have report mode implemented in them, which
leads to failure of coccicheck.
With this new implementation we choose whatever available mode
is present in coccinelle script and pass it to MODE variable
without stopping continuous coverage.
And perhaps if there are plans to add `coccicheck` as a sanity
checker in future to the Zephyr automated CI, then certainly we
want the warnings/errors produced by scripts to be less verbose
to the users.
Therefore, in this new implementation we prioritise the modes as:
1. report
2. context
3. patch
and lastly falling to
4. org
Lastly, in order to differentiate between outputs of various
coccinelle scripts being run, `x------x` separator has been used
to make reports mode readable.
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
'coccicheck' target is used to initiate Coccinelle checker. It
can be called via four different modes that generate different
output corresponding the mode.
The four modes are:
* 'patch' proposes a fix, when possible.
* 'report' generates a list in the following format:
file:line:column-column: message
* 'context' highlights lines of interest and their context in
a diff-like style. Lines of interest are indicated with '-'.
* 'org' generates a report in the Org mode format of Emacs.
The 'coccicheck' front-end can be called with suitable arguments:
* --mode=<mode>: specify the mode for processsing.
* --cocci=<path/to/foo.cocci>: specify the SmPL file to use.
* --verbose=<1>: enable verbose output.
Run `./scripts/coccicheck --help` for more detailed info
on various options available.
With the above arguments the coccinelle transformation engine
runs on the entire/part of the source code tree depending on
various options supplied to the coccicheck sanity checker.
More detailed documentation can be found at:
doc/application/coccinelle.rst
Cc: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>