process the iwyu output on a set of files
(args)
| 66 | |
| 67 | |
| 68 | def process(args): |
| 69 | "process the iwyu output on a set of files" |
| 70 | filepath = None |
| 71 | build_dir = abspath(args.build_dir) |
| 72 | directory = args.sub_dir |
| 73 | |
| 74 | print("Warning: The results of this script may include false positives which are required for different systems", |
| 75 | file=sys.stderr) |
| 76 | |
| 77 | keep_str_fns = uses_libbsd(build_dir) # check for libbsd |
| 78 | if keep_str_fns: |
| 79 | print("Warning: libbsd is present, build will fail to detect incorrect removal of rte_string_fns.h", |
| 80 | file=sys.stderr) |
| 81 | # turn on werror |
| 82 | run_meson(['configure', build_dir, '-Dwerror=true']) |
| 83 | # Use stdin if no iwyu_tool out file given |
| 84 | for line in fileinput.input(args.file): |
| 85 | if 'should remove' in line: |
| 86 | # If the file path in the iwyu_tool output is an absolute path it |
| 87 | # means the file is outside of the dpdk directory, therefore ignore it. |
| 88 | # Also check to see if the file is within the specified sub directory. |
| 89 | filename = line.split()[0] |
| 90 | if (filename != abspath(filename) and |
| 91 | directory in filename): |
| 92 | filepath = relpath(join(build_dir, filename)) |
| 93 | elif line.startswith('-') and filepath: |
| 94 | include = '#include ' + line.split()[2] |
| 95 | print(f"Remove {include} from {filepath} ... ", end='', flush=True) |
| 96 | if keep_str_fns and '<rte_string_fns.h>' in include: |
| 97 | print('skipped') |
| 98 | continue |
| 99 | remove_includes(filepath, include, build_dir) |
| 100 | else: |
| 101 | filepath = None |
| 102 | |
| 103 | |
| 104 | def main(): |
no test coverage detected