blob: 4cd69757d6ee4b5ed91a0d82b60f285aa340b7bc [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001#!/bin/bash
Anthony Barbier2fe7d1c2017-09-15 13:07:36 +01002#FIXME: Remove this file before the release
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003
4set -e
5
Moritz Pflanzera09de0c2017-09-01 20:41:12 +01006DIRECTORIES="./arm_compute ./src ./examples ./tests ./utils ./support"
Anthony Barbier6ff3b192017-09-04 18:44:23 +01007
Pablo Tello89519332017-11-17 11:52:36 +00008grep -HrnP --exclude-dir=assembly --exclude-dir=winograd "/\*\*$" $DIRECTORIES | tee bad_style.log
Anthony Barbier6ff3b192017-09-04 18:44:23 +01009if (( `cat bad_style.log | wc -l` > 0 ))
10then
11 echo ""
12 echo "ERROR: Doxygen comments should start on the first line: \"/** My comment\""
13 exit -1
14fi
15
Pablo Tello89519332017-11-17 11:52:36 +000016grep -Hnr --exclude-dir=assembly --exclude-dir=winograd --exclude=Doxyfile "@brief" $DIRECTORIES | tee bad_style.log
Anthony Barbier6ff3b192017-09-04 18:44:23 +010017if (( `cat bad_style.log | wc -l` > 0 ))
18then
19 echo ""
20 echo "ERROR: Doxygen comments shouldn't use '@brief'"
21 exit -1
22fi
23
Pablo Tello89519332017-11-17 11:52:36 +000024grep -HnRE --exclude-dir=assembly --exclude-dir=winograd "\buint " --exclude-dir=cl_kernels --exclude-dir=cs_shaders $DIRECTORIES | tee bad_style.log
Anthony Barbier6ff3b192017-09-04 18:44:23 +010025if [[ $(cat bad_style.log | wc -l) > 0 ]]
26then
27 echo ""
28 echo "ERROR: C/C++ don't define 'uint'. Use 'unsigned int' instead."
29 exit -1
30fi
31
Pablo Tello89519332017-11-17 11:52:36 +000032grep -HnR --exclude-dir=assembly --exclude-dir=winograd "float32_t" $DIRECTORIES | tee bad_style.log
Anthony Barbier6ff3b192017-09-04 18:44:23 +010033if [[ $(cat bad_style.log | wc -l) > 0 ]]
34then
35 echo ""
36 echo "ERROR: C/C++ don't define 'float32_t'. Use 'float' instead."
37 exit -1
38fi
39
Pablo Tello89519332017-11-17 11:52:36 +000040grep -Hnir --exclude-dir=assembly --exclude-dir=winograd "arm[_ ]\?cv" $DIRECTORIES | tee bad_style.log
Anthony Barbier6ff3b192017-09-04 18:44:23 +010041if [[ $(cat bad_style.log | wc -l) > 0 ]]
42then
43 echo ""
44 echo "ERROR: Reference to arm_cv detected in the files above (Replace with arm_compute)"
45 exit -1
46fi
47
Pablo Tello89519332017-11-17 11:52:36 +000048grep -Hnir --exclude-dir=assembly --exclude-dir=winograd "#.*if.*defined[^(]" $DIRECTORIES | tee bad_style.log
Anthony Barbierac69aa12017-07-03 17:39:37 +010049if [[ $(cat bad_style.log | wc -l) > 0 ]]
50then
51 echo ""
52 echo "ERROR: use parenthesis after #if defined(MY_PREPROCESSOR)"
53 exit -1
54fi
55
Pablo Tello89519332017-11-17 11:52:36 +000056grep -Hnir --exclude-dir=assembly --exclude-dir=winograd "#else$\|#endif$" $DIRECTORIES | tee bad_style.log
Anthony Barbierac69aa12017-07-03 17:39:37 +010057if [[ $(cat bad_style.log | wc -l) > 0 ]]
58then
59 echo ""
Ioan-Cristian Szabo33fd07b2017-10-26 15:42:24 +010060 echo "ERROR: #else and #endif should be followed by a comment of the guard they refer to (e.g /* ARM_COMPUTE_AARCH64_V8_2 */ )"
Anthony Barbierac69aa12017-07-03 17:39:37 +010061 exit -1
62fi
63
Pablo Tello89519332017-11-17 11:52:36 +000064grep -Hnir --exclude-dir=assembly --exclude-dir=winograd "ARM_COMPUTE_AARCH64_V8_2" ./tests/validation/CL | tee bad_style.log
Moritz Pflanzer4dfc2352017-08-02 14:51:36 +010065if [[ $(cat bad_style.log | wc -l) > 0 ]]
66then
67 echo ""
Ioan-Cristian Szabo33fd07b2017-10-26 15:42:24 +010068 echo "ERROR: Found ARM_COMPUTE_AARCH64_V8_2 in CL tests though armv8.2 features (FP16) are always supported for OpenCL"
Moritz Pflanzer4dfc2352017-08-02 14:51:36 +010069 exit -1
70fi
Anthony Barbierac69aa12017-07-03 17:39:37 +010071
Anthony Barbier6ff3b192017-09-04 18:44:23 +010072spdx_missing=0
73for f in $(find $DIRECTORIES -type f)
74do
75 if [[ $(grep SPDX $f | wc -l) == 0 ]]
76 then
77 # List of exceptions:
78 case `basename $f` in
79 "arm_compute_version.embed");;
80 ".clang-format");;
81 ".clang-tidy");;
82 #It's an error for other files to not contain the MIT header:
83 *)
84 spdx_missing=1
85 echo $f;
86 ;;
87 esac
88 fi;
89done
90
91if [[ $spdx_missing > 0 ]]
92then
93 echo ""
94 echo "ERROR: MIT Copyright header missing from the file(s) above."
95 exit -1
96fi