xref: /btstack/tool/misc/fix-misra-10.4a.sh (revision 4ea43905e81e6bfa244dfdbd768b1d4e9664a403)
1#!/bin/sh
2
3BTSTACK_REL=`dirname $0`'/../..'
4BTSTACK_ROOT=`realpath $BTSTACK_REL`
5
6# check coccinelle
7command -v spatch >/dev/null 2>&1 || { echo >&2 "spatch from cocinelle required but not installed. Aborting."; exit 1; }
8
9# append u to all literals
10spatch --sp-file $BTSTACK_ROOT/tool/misc/append_u_to_constants.cocci --out-place --max-width 300 --dir $BTSTACK_ROOT/src/
11spatch --sp-file $BTSTACK_ROOT/tool/misc/append_u_to_constants.cocci --out-place --max-width 300 --dir $BTSTACK_ROOT/3rd-party/micro-ecc
12spatch --sp-file $BTSTACK_ROOT/tool/misc/append_u_to_constants.cocci --out-place --max-width 300 --dir $BTSTACK_ROOT/3rd-party/rijndael
13
14# update only lines that are listed in cstat report
15$BTSTACK_ROOT/tool/misc/fix-misra-10.4a.py
16
17# delete cocci output files
18# find $BTSTACK_ROOT/ -name "*.cocci_res" -delete
19