blob: ead2513a93d91240e0f567f1e7ca01b74cc037fc [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001#!/usr/bin/env python3
2
3import sys
4
5if __name__ == "__main__":
6 if len(sys.argv) != 2:
7 print("usage: {} CLANG-TIDY_OUTPUT_FILE".format(sys.argv[0]))
8 sys.exit(1)
9
10 failed = False
11
12 with open(sys.argv[1], mode="r") as clang_tidy_file:
13 lines = clang_tidy_file.readlines()
14
15 for i in range(0, len(lines)):
16 line = lines[i]
17
18 if "error:" in line:
19 if (("Utils.cpp" in line and "'arm_compute_version.embed' file not found" in line) or
20 ("cl2.hpp" in line and "cast from pointer to smaller type 'cl_context_properties' (aka 'int') loses information" in line) or
21 ("memory" in line and "cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information" in line) or
22 "3rdparty" in line):
23 continue
24
25 failed = True
26 print(line)
27 elif "warning:" in line:
28 if ("uninitialized record type: '__ret'" in line or
29 "local variable '__bound_functor' is still referred to by the global variable '__once_callable'" in line or
30 ("Error.cpp" in line and "thrown exception type is not nothrow copy constructible" in line) or
31 ("Error.cpp" in line and "uninitialized record type: 'args'" in line) or
32 ("Error.cpp" in line and "do not call c-style vararg functions" in line) or
33 ("Error.cpp" in line and "do not define a C-style variadic function" in line) or
34 ("NEMinMaxLocationKernel.cpp" in line and "move constructors should be marked noexcept" in line) or
35 ("NEMinMaxLocationKernel.cpp" in line and "move assignment operators should be marked noexcept" in line) or
36 ("PMUCounter.cpp" in line and "consider replacing 'long long' with 'int64'" in line) or
37 "3rdparty" in line):
38 continue
39
40 if "do not use C-style cast to convert between unrelated types" in line:
41 if i + 1 < len(lines) and "vgetq_lane_f16" in lines[i + 1]:
42 continue
43
44 if "use 'using' instead of 'typedef'" in line:
45 if i + 1 < len(lines) and "BOOST_FIXTURE_TEST_SUITE" in lines[i + 1]:
46 continue
47
48 if "do not call c-style vararg functions" in line:
49 if (i + 1 < len(lines) and
50 ("BOOST_TEST" in lines[i + 1] or
51 "BOOST_FAIL" in lines[i + 1] or
52 "BOOST_CHECK_THROW" in lines[i + 1] or
53 "syscall" in lines[i + 1])):
54 continue
55
56 failed = True
57 print(line)
58
59 sys.exit(0 if not failed else 1)