From 068ea3105873d3500da9591bd40cc627c78eef3e Mon Sep 17 00:00:00 2001 From: Gabor Kelemen Date: Sun, 16 Jun 2019 08:43:01 +0200 Subject: find-unneeded-includes: show command line in case of IWYU error messages In case of non self contained files IYYU gives only error messages. Prepare for that and print the failing command for further investigation. Change-Id: I744338ab14d4a6cba5e02f842ff74b156c5178a4 Reviewed-on: https://gerrit.libreoffice.org/74111 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- bin/find-unneeded-includes | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes index 3a4e303bbfe6..d3177af8336a 100755 --- a/bin/find-unneeded-includes +++ b/bin/find-unneeded-includes @@ -153,9 +153,14 @@ def processIWYUOutput(iwyuOutput, moduleRules): inRemove = False toRemove = [] currentFileName = None + for line in iwyuOutput: line = line.strip() + # Bail out if IWYU gave an error due to non self-containedness + if re.match ("(.*): error: (.*)", line): + return -1 + if len(line) == 0: if inRemove: inRemove = False @@ -208,7 +213,9 @@ def run_tool(task_queue, 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) - if retcode != 0: + if retcode == -1: + print("ERROR: A file is probably not self contained, check this commands output:\n" + invocation) + elif retcode > 0: print("ERROR: The following command found unused includes:\n" + invocation) failed_files.append(invocation) task_queue.task_done() -- cgit