[Libreoffice-commits] core.git: bin/find-unneeded-includes

Gabor Kelemen (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 17 06:43:19 UTC 2019


 bin/find-unneeded-includes |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 068ea3105873d3500da9591bd40cc627c78eef3e
Author:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
AuthorDate: Sun Jun 16 08:43:01 2019 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Jun 17 08:42:38 2019 +0200

    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 <vmiklos at collabora.com>

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()


More information about the Libreoffice-commits mailing list