HACKING: add info on usage of sparse

Add short example on how to run the static analyser 'sparse' on
OpenOCD code.

Change-Id: Ieba8ae926d0e02ca9e6ac619b13b0832136f82cb
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7679
Tested-by: jenkins
This commit is contained in:
Antonio Borneo 2023-05-07 16:15:46 +02:00
parent 17f86fdedf
commit f20173a01f
1 changed files with 15 additions and 0 deletions

15
HACKING
View File

@ -77,6 +77,21 @@ patch:
src/openocd -s ../tcl -f /path/to/openocd.cfg
@endcode
- Sparse Static Analyzer
Using this tool allows identifying some bug in C code.
In the future, OpenOCD would use the sparse attribute 'bitwise' to
detect incorrect endianness assignments.
Example usage:
@code
mkdir build-sparse; cd build-sparse
../configure CC=cgcc CFLAGS="-Wsparse-all -Wno-declaration-after-statement \
-Wno-unknown-attribute -Wno-transparent-union -Wno-tautological-compare \
-Wno-vla -Wno-flexible-array-array -D__FLT_EVAL_METHOD__=0"
make
@endcode
Please consider performing these additional checks where appropriate
(especially Clang Static Analyzer for big portions of new code) and
mention the results (e.g. "Valgrind-clean, no new Clang analyzer