bin/find-unneeded-includes: warn about obsolete header exclusions...
only in headersfwd mode. This check ran in --headers mode as well, giving contradicting advice compared to headersfwd mode. Apply the check only in headersfwd mode for consistency Change-Id: Icf58bbb6c47d0a736c2da5d253fe292d6e58a427 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199381 Tested-by: Jenkins Reviewed-by: Gabor Kelemen <gabor.kelemen@collabora.com>
This commit is contained in:
@@ -151,7 +151,7 @@ def unwrapInclude(include):
|
||||
return include[1:-1]
|
||||
|
||||
|
||||
def processIWYUOutput(iwyuOutput, moduleRules, fileName, noexclude, checknamespaces, finderrors, removefwdd):
|
||||
def processIWYUOutput(iwyuOutput, moduleRules, fileName, noexclude, checknamespaces, finderrors, removefwdd, headersfwd):
|
||||
inAdd = False
|
||||
toAdd = []
|
||||
inRemove = False
|
||||
@@ -264,7 +264,7 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName, noexclude, checknamespa
|
||||
# check if a hpp files hdl pair is now considered necessary
|
||||
# then there is no need for an explicit exclusion
|
||||
hdlMatch = re.match(".*.hdl", include)
|
||||
if hdlMatch:
|
||||
if hdlMatch and headersfwd:
|
||||
hdl = include.replace(".hdl", ".hpp")
|
||||
if hdl in excludelistRules[realFileName]:
|
||||
print("WARNING:", hdl, "excluded header can be removed from exclusion list of file:", realFileName)
|
||||
@@ -452,13 +452,13 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName, noexclude, checknamespa
|
||||
return len(toRemove)
|
||||
|
||||
|
||||
def run_tool(task_queue, failed_files, noexclude, checknamespaces, finderrors, removefwdd):
|
||||
def run_tool(task_queue, failed_files, noexclude, checknamespaces, finderrors, removefwdd, headersfwd):
|
||||
while True:
|
||||
invocation, moduleRules = task_queue.get()
|
||||
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, invocation.split(' ')[-1], noexclude, checknamespaces, finderrors, removefwdd)
|
||||
retcode = processIWYUOutput(p.communicate()[0].decode('utf-8').splitlines(), moduleRules, invocation.split(' ')[-1], noexclude, checknamespaces, finderrors, removefwdd, headersfwd)
|
||||
if finderrors:
|
||||
if p.returncode == 1:
|
||||
print("Running the IWYU process returned error code:\n" + invocation)
|
||||
@@ -609,7 +609,7 @@ def tidy(compileCommands, paths, noexclude, checknamespaces, finderrors, removef
|
||||
task_queue = queue.Queue(max_task)
|
||||
failed_files = []
|
||||
for _ in range(max_task):
|
||||
t = threading.Thread(target=run_tool, args=(task_queue, failed_files, noexclude, checknamespaces, finderrors, removefwdd))
|
||||
t = threading.Thread(target=run_tool, args=(task_queue, failed_files, noexclude, checknamespaces, finderrors, removefwdd, headersfwd))
|
||||
t.daemon = True
|
||||
t.start()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user