aboutsummaryrefslogtreecommitdiff
path: root/scripts/fix_code_formatting.sh
blob: f64bdfb62a3df8aeb4c032995e8dc117cb289bae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash

ASTYLE_PARAMETERS=" --style=ansi \
	--indent=spaces \
	--indent-switches \
	--indent-col1-comments \
	--min-conditional-indent=0 \
	--max-instatement-indent=120 \
	--pad-oper \
	--align-pointer=name \
	--align-reference=name \
	--break-closing-brackets \
	--keep-one-line-statements \
	--max-code-length=200 \
	--mode=c \
	--lineend=linux \
	--indent-preprocessor \
	"

DIRECTORIES="./arm_compute ./src ./examples ./tests ./utils ./support"

if [ $# -eq 0 ]
then
    files=$(find $DIRECTORIES -type f \( -name \*.cpp -o -iname \*.h -o -name \*.inl -o -name \*.cl \))
else
	files=$@
fi
for f in $files
do
	sed -i 's/\t/    /g' $f
	clang-format -i -style=file $f
	astyle -n -q $ASTYLE_PARAMETERS $f
done