From f20173a01f3eec286b2e2daac12834229cbfa3c8 Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Sun, 7 May 2023 16:15:46 +0200 Subject: 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 Reviewed-on: https://review.openocd.org/c/openocd/+/7679 Tested-by: jenkins --- HACKING | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'HACKING') diff --git a/HACKING b/HACKING index be56999..fbc0eae 100644 --- a/HACKING +++ b/HACKING @@ -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 -- cgit v1.1