summaryrefslogtreecommitdiffstats
path: root/bin/find-unneeded-includes
diff options
context:
space:
mode:
authorGabor Kelemen <kelemen.gabor2@nisz.hu>2019-10-04 00:03:09 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-10-04 09:08:49 +0200
commitb3c072a4ee94c5f86723cdcc98ea08f46f981b4a (patch)
treedbbcc924f1aa83d37d0a7a03a048b9a0818faa49 /bin/find-unneeded-includes
parentxmloff: create XMLDrawMetaExportOOO instances with an uno constructor (diff)
downloadcore-b3c072a4ee94c5f86723cdcc98ea08f46f981b4a.tar.gz
core-b3c072a4ee94c5f86723cdcc98ea08f46f981b4a.zip
find-unneeded-includes: ignore extra recommendations
When IWYU is used to check cxx files it also checks associated hxx (but for .hxx -> .h too) files too and gives addition/removal recommendations There is no documented way of disabling this. Currently f-u-i does not differentiate between recommendations for the checked file and its header and prints everything. Which means sometimes I need to update .hxx files or blacklist warnings that interestingly are not shown when the same .hxx is checked with IWYU. The worst example is ucb/source/ucp/ftp/curl.hxx where IWYU gives recommendations for /usr/include/x86_64-linux-gnu/curl/curl.h Remedy this with considering the full filename + should add these lines: / should remove these lines: string as beginning of interesting recommendations Also remove some now obsolete blacklist entries from yaml files Change-Id: I1d139536992e4b56c699c31a4cc6491d373c2002 Reviewed-on: https://gerrit.libreoffice.org/80172 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'bin/find-unneeded-includes')
-rwxr-xr-xbin/find-unneeded-includes14
1 files changed, 8 insertions, 6 deletions
diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index c89b69fc9d2a..8ba5a7d354a6 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -147,7 +147,7 @@ def unwrapInclude(include):
return include[1:-1]
-def processIWYUOutput(iwyuOutput, moduleRules):
+def processIWYUOutput(iwyuOutput, moduleRules, fileName):
inAdd = False
toAdd = []
inRemove = False
@@ -169,15 +169,17 @@ def processIWYUOutput(iwyuOutput, moduleRules):
inAdd = False
continue
- match = re.match("(.*) should add these lines:$", line)
+ shouldAdd = fileName + " should add these lines:"
+ match = re.match(shouldAdd, line)
if match:
- currentFileName = match.group(1)
+ currentFileName = match.group(0).split(' ')[0]
inAdd = True
continue
- match = re.match("(.*) should remove these lines:$", line)
+ shouldRemove = fileName + " should remove these lines:"
+ match = re.match(shouldRemove, line)
if match:
- currentFileName = match.group(1)
+ currentFileName = match.group(0).split(' ')[0]
inRemove = True
continue
@@ -212,7 +214,7 @@ def run_tool(task_queue, failed_files):
if not len(failed_files):
print("[IWYU] " + invocation.split(' ')[-1])
p = subprocess.Popen(invocation, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- retcode = processIWYUOutput(p.communicate()[0].decode('utf-8').splitlines(), moduleRules)
+ retcode = processIWYUOutput(p.communicate()[0].decode('utf-8').splitlines(), moduleRules, invocation.split(' ')[-1])
if retcode == -1:
print("ERROR: A file is probably not self contained, check this commands output:\n" + invocation)
elif retcode > 0: