bin/find-unneeded-includes | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
New commits: commit e985c30dc49ffb8da5cecd5525a49e8cdd4629ea Author: Gabor Kelemen <[email protected]> AuthorDate: Mon Sep 22 23:55:35 2025 +0200 Commit: Gabor Kelemen <[email protected]> CommitDate: Fri Oct 3 16:21:58 2025 +0200 bin/find-unneeded-includes: Catch stale file names without exclusions As seen in sd/IwyuFilter_sd.yaml, some files may lose all their exclusions due to refactoring, yet their name is not removed from the yaml file Now we give a warning about this situation Change-Id: Iec432b8d152122daf3f740cbcaa311dd0ff69f14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191378 Reviewed-by: Gabor Kelemen <[email protected]> Tested-by: Jenkins diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes index 04db6e5f1cd6..b8695fa8a846 100755 --- a/bin/find-unneeded-includes +++ b/bin/find-unneeded-includes @@ -631,10 +631,13 @@ def main(argv): # check that the excluded files / forward declarations are still present # to avoid stale exclusion rules lingering forever else: - for exclusion in excludelistRules[pathname]: - p = subprocess.run(["git", "grep", "-q", "-e", "#include <"+exclusion, "-e", exclusion, file]) - if p.returncode == 1 : - print("WARNING:", exclusion, "is not present anymore in", file) + try: + for exclusion in excludelistRules[pathname]: + p = subprocess.run(["git", "grep", "-q", "-e", "#include <"+exclusion, "-e", exclusion, file]) + if p.returncode == 1 : + print("WARNING:", exclusion, "is not present anymore in", file) + except TypeError: + print("WARNING: no exclusions are defined for:", file) sys.exit(0) tidy(compileCommands, paths=list_of_files, dontstop=vars(args)["continue"], noexclude=args.noexclude, checknamespaces=args.ns, finderrors=args.finderrors, removefwdd=args.fwdecl)
