Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 1 | #!/bin/bash |
Anthony Barbier | 2fe7d1c | 2017-09-15 13:07:36 +0100 | [diff] [blame] | 2 | #FIXME: Remove this file before the release |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 3 | |
| 4 | set -e |
| 5 | |
Moritz Pflanzer | a09de0c | 2017-09-01 20:41:12 +0100 | [diff] [blame] | 6 | DIRECTORIES="./arm_compute ./src ./examples ./tests ./utils ./support" |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 7 | |
Pablo Tello | 8951933 | 2017-11-17 11:52:36 +0000 | [diff] [blame^] | 8 | grep -HrnP --exclude-dir=assembly --exclude-dir=winograd "/\*\*$" $DIRECTORIES | tee bad_style.log |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 9 | if (( `cat bad_style.log | wc -l` > 0 )) |
| 10 | then |
| 11 | echo "" |
| 12 | echo "ERROR: Doxygen comments should start on the first line: \"/** My comment\"" |
| 13 | exit -1 |
| 14 | fi |
| 15 | |
Pablo Tello | 8951933 | 2017-11-17 11:52:36 +0000 | [diff] [blame^] | 16 | grep -Hnr --exclude-dir=assembly --exclude-dir=winograd --exclude=Doxyfile "@brief" $DIRECTORIES | tee bad_style.log |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 17 | if (( `cat bad_style.log | wc -l` > 0 )) |
| 18 | then |
| 19 | echo "" |
| 20 | echo "ERROR: Doxygen comments shouldn't use '@brief'" |
| 21 | exit -1 |
| 22 | fi |
| 23 | |
Pablo Tello | 8951933 | 2017-11-17 11:52:36 +0000 | [diff] [blame^] | 24 | grep -HnRE --exclude-dir=assembly --exclude-dir=winograd "\buint " --exclude-dir=cl_kernels --exclude-dir=cs_shaders $DIRECTORIES | tee bad_style.log |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 25 | if [[ $(cat bad_style.log | wc -l) > 0 ]] |
| 26 | then |
| 27 | echo "" |
| 28 | echo "ERROR: C/C++ don't define 'uint'. Use 'unsigned int' instead." |
| 29 | exit -1 |
| 30 | fi |
| 31 | |
Pablo Tello | 8951933 | 2017-11-17 11:52:36 +0000 | [diff] [blame^] | 32 | grep -HnR --exclude-dir=assembly --exclude-dir=winograd "float32_t" $DIRECTORIES | tee bad_style.log |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 33 | if [[ $(cat bad_style.log | wc -l) > 0 ]] |
| 34 | then |
| 35 | echo "" |
| 36 | echo "ERROR: C/C++ don't define 'float32_t'. Use 'float' instead." |
| 37 | exit -1 |
| 38 | fi |
| 39 | |
Pablo Tello | 8951933 | 2017-11-17 11:52:36 +0000 | [diff] [blame^] | 40 | grep -Hnir --exclude-dir=assembly --exclude-dir=winograd "arm[_ ]\?cv" $DIRECTORIES | tee bad_style.log |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 41 | if [[ $(cat bad_style.log | wc -l) > 0 ]] |
| 42 | then |
| 43 | echo "" |
| 44 | echo "ERROR: Reference to arm_cv detected in the files above (Replace with arm_compute)" |
| 45 | exit -1 |
| 46 | fi |
| 47 | |
Pablo Tello | 8951933 | 2017-11-17 11:52:36 +0000 | [diff] [blame^] | 48 | grep -Hnir --exclude-dir=assembly --exclude-dir=winograd "#.*if.*defined[^(]" $DIRECTORIES | tee bad_style.log |
Anthony Barbier | ac69aa1 | 2017-07-03 17:39:37 +0100 | [diff] [blame] | 49 | if [[ $(cat bad_style.log | wc -l) > 0 ]] |
| 50 | then |
| 51 | echo "" |
| 52 | echo "ERROR: use parenthesis after #if defined(MY_PREPROCESSOR)" |
| 53 | exit -1 |
| 54 | fi |
| 55 | |
Pablo Tello | 8951933 | 2017-11-17 11:52:36 +0000 | [diff] [blame^] | 56 | grep -Hnir --exclude-dir=assembly --exclude-dir=winograd "#else$\|#endif$" $DIRECTORIES | tee bad_style.log |
Anthony Barbier | ac69aa1 | 2017-07-03 17:39:37 +0100 | [diff] [blame] | 57 | if [[ $(cat bad_style.log | wc -l) > 0 ]] |
| 58 | then |
| 59 | echo "" |
Ioan-Cristian Szabo | 33fd07b | 2017-10-26 15:42:24 +0100 | [diff] [blame] | 60 | 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 Barbier | ac69aa1 | 2017-07-03 17:39:37 +0100 | [diff] [blame] | 61 | exit -1 |
| 62 | fi |
| 63 | |
Pablo Tello | 8951933 | 2017-11-17 11:52:36 +0000 | [diff] [blame^] | 64 | grep -Hnir --exclude-dir=assembly --exclude-dir=winograd "ARM_COMPUTE_AARCH64_V8_2" ./tests/validation/CL | tee bad_style.log |
Moritz Pflanzer | 4dfc235 | 2017-08-02 14:51:36 +0100 | [diff] [blame] | 65 | if [[ $(cat bad_style.log | wc -l) > 0 ]] |
| 66 | then |
| 67 | echo "" |
Ioan-Cristian Szabo | 33fd07b | 2017-10-26 15:42:24 +0100 | [diff] [blame] | 68 | echo "ERROR: Found ARM_COMPUTE_AARCH64_V8_2 in CL tests though armv8.2 features (FP16) are always supported for OpenCL" |
Moritz Pflanzer | 4dfc235 | 2017-08-02 14:51:36 +0100 | [diff] [blame] | 69 | exit -1 |
| 70 | fi |
Anthony Barbier | ac69aa1 | 2017-07-03 17:39:37 +0100 | [diff] [blame] | 71 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 72 | spdx_missing=0 |
| 73 | for f in $(find $DIRECTORIES -type f) |
| 74 | do |
| 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; |
| 89 | done |
| 90 | |
| 91 | if [[ $spdx_missing > 0 ]] |
| 92 | then |
| 93 | echo "" |
| 94 | echo "ERROR: MIT Copyright header missing from the file(s) above." |
| 95 | exit -1 |
| 96 | fi |