blob: 30bfca133d6a6dcac23852eab2c6076ab6c76edc [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001#!/usr/bin/env python3
2
Isabella Gottardib797fa22017-06-23 15:02:11 +01003import re
Anthony Barbier6ff3b192017-09-04 18:44:23 +01004import sys
5
6if __name__ == "__main__":
7 if len(sys.argv) != 2:
8 print("usage: {} CLANG-TIDY_OUTPUT_FILE".format(sys.argv[0]))
9 sys.exit(1)
10
11 failed = False
12
13 with open(sys.argv[1], mode="r") as clang_tidy_file:
14 lines = clang_tidy_file.readlines()
15
16 for i in range(0, len(lines)):
17 line = lines[i]
18
19 if "error:" in line:
20 if (("Utils.cpp" in line and "'arm_compute_version.embed' file not found" in line) or
21 ("cl2.hpp" in line and "cast from pointer to smaller type 'cl_context_properties' (aka 'int') loses information" in line) or
Pablo Tello383deec2017-06-23 10:40:05 +010022 ("arm_fp16.h" in line) or
Anthony Barbier6ff3b192017-09-04 18:44:23 +010023 ("memory" in line and "cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information" in line) or
Pablo Tellodf246182017-07-03 16:25:09 +010024 ("NEMath.inl" in line and "statement expression not allowed at file scope" in line) or
Anthony Barbier6ff3b192017-09-04 18:44:23 +010025 "3rdparty" in line):
26 continue
27
28 failed = True
29 print(line)
30 elif "warning:" in line:
31 if ("uninitialized record type: '__ret'" in line or
32 "local variable '__bound_functor' is still referred to by the global variable '__once_callable'" in line or
33 ("Error.cpp" in line and "thrown exception type is not nothrow copy constructible" in line) or
34 ("Error.cpp" in line and "uninitialized record type: 'args'" in line) or
35 ("Error.cpp" in line and "do not call c-style vararg functions" in line) or
36 ("Error.cpp" in line and "do not define a C-style variadic function" in line) or
37 ("NEMinMaxLocationKernel.cpp" in line and "move constructors should be marked noexcept" in line) or
38 ("NEMinMaxLocationKernel.cpp" in line and "move assignment operators should be marked noexcept" in line) or
39 ("PMUCounter.cpp" in line and "consider replacing 'long long' with 'int64'" in line) or
Pablo Tello383deec2017-06-23 10:40:05 +010040 ("Validation.cpp" in line and "parameter 'classified_labels' is unused" in line) or
41 ("Validation.cpp" in line and "parameter 'expected_labels' is unused" in line) or
Georgios Pinitas7b7858d2017-06-21 16:44:24 +010042 ("Reference.cpp" in line and "parameter 'rois' is unused" in line) or
Georgios Pinitasac4e8732017-07-05 17:02:25 +010043 ("Reference.cpp" in line and "parameter 'shapes' is unused" in line) or
Isabella Gottardib797fa22017-06-23 15:02:11 +010044 ("Reference.cpp" in line and re.search(r"parameter '[^']+' is unused", line)) or
Georgios Pinitas7b7858d2017-06-21 16:44:24 +010045 ("ReferenceCPP.cpp" in line and "parameter 'rois' is unused" in line) or
Georgios Pinitasac4e8732017-07-05 17:02:25 +010046 ("ReferenceCPP.cpp" in line and "parameter 'srcs' is unused" in line) or
Isabella Gottardib797fa22017-06-23 15:02:11 +010047 ("ReferenceCPP.cpp" in line and re.search(r"parameter '[^']+' is unused", line)) or
Pablo Tello221f3812017-06-28 17:27:56 +010048 ("NEGEMMMatrixMultiplyKernel.cpp" in line and "do not use C-style cast to convert between unrelated types" in line) or
Pablo Tello0c34fe22017-06-26 17:17:42 +010049 ("NEPoolingLayerKernel.cpp" in line and "do not use C-style cast to convert between unrelated types" in line) or
Pablo Tellob49a7152017-07-11 16:31:35 +010050 ("NESoftmaxLayerKernel.cpp" in line and "do not use C-style cast to convert between unrelated types" in line) or
Anthony Barbier6ff3b192017-09-04 18:44:23 +010051 "3rdparty" in line):
52 continue
53
54 if "do not use C-style cast to convert between unrelated types" in line:
55 if i + 1 < len(lines) and "vgetq_lane_f16" in lines[i + 1]:
56 continue
57
58 if "use 'using' instead of 'typedef'" in line:
59 if i + 1 < len(lines) and "BOOST_FIXTURE_TEST_SUITE" in lines[i + 1]:
60 continue
61
62 if "do not call c-style vararg functions" in line:
63 if (i + 1 < len(lines) and
64 ("BOOST_TEST" in lines[i + 1] or
65 "BOOST_FAIL" in lines[i + 1] or
66 "BOOST_CHECK_THROW" in lines[i + 1] or
67 "syscall" in lines[i + 1])):
68 continue
69
Moritz Pflanzer94450f12017-06-30 12:48:43 +010070 if "use '= default' to define a trivial default constructor" in line:
71 if i + 1 < len(lines) and "BENCHMARK" in lines[i + 1]:
72 continue
73
Anthony Barbier6ff3b192017-09-04 18:44:23 +010074 failed = True
75 print(line)
76
77 sys.exit(0 if not failed else 1)