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>
This commit is contained in:
committed by
Miklos Vajna
parent
5d89d64846
commit
b3c072a4ee
@@ -147,7 +147,7 @@ def unwrapInclude(include):
|
|||||||
return include[1:-1]
|
return include[1:-1]
|
||||||
|
|
||||||
|
|
||||||
def processIWYUOutput(iwyuOutput, moduleRules):
|
def processIWYUOutput(iwyuOutput, moduleRules, fileName):
|
||||||
inAdd = False
|
inAdd = False
|
||||||
toAdd = []
|
toAdd = []
|
||||||
inRemove = False
|
inRemove = False
|
||||||
@@ -169,15 +169,17 @@ def processIWYUOutput(iwyuOutput, moduleRules):
|
|||||||
inAdd = False
|
inAdd = False
|
||||||
continue
|
continue
|
||||||
|
|
||||||
match = re.match("(.*) should add these lines:$", line)
|
shouldAdd = fileName + " should add these lines:"
|
||||||
|
match = re.match(shouldAdd, line)
|
||||||
if match:
|
if match:
|
||||||
currentFileName = match.group(1)
|
currentFileName = match.group(0).split(' ')[0]
|
||||||
inAdd = True
|
inAdd = True
|
||||||
continue
|
continue
|
||||||
|
|
||||||
match = re.match("(.*) should remove these lines:$", line)
|
shouldRemove = fileName + " should remove these lines:"
|
||||||
|
match = re.match(shouldRemove, line)
|
||||||
if match:
|
if match:
|
||||||
currentFileName = match.group(1)
|
currentFileName = match.group(0).split(' ')[0]
|
||||||
inRemove = True
|
inRemove = True
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -212,7 +214,7 @@ def run_tool(task_queue, failed_files):
|
|||||||
if not len(failed_files):
|
if not len(failed_files):
|
||||||
print("[IWYU] " + invocation.split(' ')[-1])
|
print("[IWYU] " + invocation.split(' ')[-1])
|
||||||
p = subprocess.Popen(invocation, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
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:
|
if retcode == -1:
|
||||||
print("ERROR: A file is probably not self contained, check this commands output:\n" + invocation)
|
print("ERROR: A file is probably not self contained, check this commands output:\n" + invocation)
|
||||||
elif retcode > 0:
|
elif retcode > 0:
|
||||||
|
@@ -58,9 +58,6 @@ blacklist:
|
|||||||
sc/inc/chgviset.hxx:
|
sc/inc/chgviset.hxx:
|
||||||
# base class has to be a complete type
|
# base class has to be a complete type
|
||||||
- unotools/textsearch.hxx
|
- unotools/textsearch.hxx
|
||||||
sc/inc/colcontainer.hxx:
|
|
||||||
# Needed to silence the check on colcontainer.cxx
|
|
||||||
- column.hxx
|
|
||||||
sc/inc/column.hxx:
|
sc/inc/column.hxx:
|
||||||
# base class has to be a complete type
|
# base class has to be a complete type
|
||||||
- mdds/flat_segment_tree.hpp
|
- mdds/flat_segment_tree.hpp
|
||||||
@@ -384,9 +381,6 @@ blacklist:
|
|||||||
sc/source/filter/inc/formulabase.hxx:
|
sc/source/filter/inc/formulabase.hxx:
|
||||||
# Needed for typedef
|
# Needed for typedef
|
||||||
- com/sun/star/table/CellAddress.hpp
|
- com/sun/star/table/CellAddress.hpp
|
||||||
sc/source/filter/inc/fprogressbar.hxx:
|
|
||||||
# Avoid collision with fprogressbar.cxx checking
|
|
||||||
- progress.hxx
|
|
||||||
sc/source/filter/inc/ooxformulaparser.hxx:
|
sc/source/filter/inc/ooxformulaparser.hxx:
|
||||||
# base class has to be a complete type
|
# base class has to be a complete type
|
||||||
- com/sun/star/lang/XInitialization.hpp
|
- com/sun/star/lang/XInitialization.hpp
|
||||||
|
@@ -124,8 +124,6 @@ blacklist:
|
|||||||
# base class has to be a complete type
|
# base class has to be a complete type
|
||||||
- com/sun/star/drawing/framework/XResourceFactory.hpp
|
- com/sun/star/drawing/framework/XResourceFactory.hpp
|
||||||
- com/sun/star/lang/XInitialization.hpp
|
- com/sun/star/lang/XInitialization.hpp
|
||||||
# Don't stop on false positive while checking BasicViewFactory.cxx
|
|
||||||
- namespace vcl { class Window; }
|
|
||||||
sd/source/ui/framework/factories/ChildWindowPane.hxx:
|
sd/source/ui/framework/factories/ChildWindowPane.hxx:
|
||||||
# base class has to be a complete type
|
# base class has to be a complete type
|
||||||
- com/sun/star/lang/XEventListener.hpp
|
- com/sun/star/lang/XEventListener.hpp
|
||||||
@@ -466,9 +464,6 @@ blacklist:
|
|||||||
sd/source/ui/func/fuhhconv.cxx:
|
sd/source/ui/func/fuhhconv.cxx:
|
||||||
# Needed for direct member access
|
# Needed for direct member access
|
||||||
- com/sun/star/awt/XWindow.hpp
|
- com/sun/star/awt/XWindow.hpp
|
||||||
sd/source/ui/inc/fupoor.hxx:
|
|
||||||
# Don't stop on false positive while checking fupoor.cxx
|
|
||||||
- namespace sd { class Window; }
|
|
||||||
sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx:
|
sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx:
|
||||||
# Needed for instantiation of function template specialization
|
# Needed for instantiation of function template specialization
|
||||||
- Window.hxx
|
- Window.hxx
|
||||||
|
@@ -4,9 +4,3 @@ blacklist:
|
|||||||
svtools/source/dialogs/insdlg.cxx:
|
svtools/source/dialogs/insdlg.cxx:
|
||||||
# Needed on WIN
|
# Needed on WIN
|
||||||
- comphelper/classids.hxx
|
- comphelper/classids.hxx
|
||||||
include/svtools/statusbarcontroller.hxx:
|
|
||||||
# Silence warning while checking statusbarcontroller.cxx
|
|
||||||
- cppuhelper/interfacecontainer.hxx
|
|
||||||
include/svtools/toolboxcontroller.hxx:
|
|
||||||
# Silence warning while checking toolboxcontroller.cxx
|
|
||||||
- cppuhelper/interfacecontainer.hxx
|
|
||||||
|
@@ -309,10 +309,6 @@ blacklist:
|
|||||||
- com/sun/star/util/XUpdatable.hpp
|
- com/sun/star/util/XUpdatable.hpp
|
||||||
# Needed for UnoImplPtr template
|
# Needed for UnoImplPtr template
|
||||||
- unobaseclass.hxx
|
- unobaseclass.hxx
|
||||||
include/svtools/unoevent.hxx:
|
|
||||||
# Don't give false positives checking sw/source/core/inc/unoevent.hxx
|
|
||||||
- com/sun/star/container/XNameReplace.hpp
|
|
||||||
- com/sun/star/lang/XServiceInfo.hpp
|
|
||||||
sw/source/core/inc/unoflatpara.hxx:
|
sw/source/core/inc/unoflatpara.hxx:
|
||||||
# Base class needs complete type
|
# Base class needs complete type
|
||||||
- com/sun/star/beans/XPropertySet.hpp
|
- com/sun/star/beans/XPropertySet.hpp
|
||||||
@@ -440,9 +436,6 @@ blacklist:
|
|||||||
sw/qa/extras/ww8import/ww8import.cxx:
|
sw/qa/extras/ww8import/ww8import.cxx:
|
||||||
# Needed for for-loop range
|
# Needed for for-loop range
|
||||||
- com/sun/star/graphic/XGraphic.hpp
|
- com/sun/star/graphic/XGraphic.hpp
|
||||||
include/sal/types.h:
|
|
||||||
# Ignore warning during checking source/filter/ww8/types.hxx
|
|
||||||
- sal/typesizes.h
|
|
||||||
sw/source/filter/ww8/ww8scan.hxx:
|
sw/source/filter/ww8/ww8scan.hxx:
|
||||||
# OSL_BIGENDIAN is being checked
|
# OSL_BIGENDIAN is being checked
|
||||||
- osl/endian.h
|
- osl/endian.h
|
||||||
|
@@ -4,9 +4,6 @@ blacklist:
|
|||||||
toolkit/source/awt/vclxmenu.cxx:
|
toolkit/source/awt/vclxmenu.cxx:
|
||||||
# Needed for direct member access
|
# Needed for direct member access
|
||||||
- vcl/window.hxx
|
- vcl/window.hxx
|
||||||
include/toolkit/controls/geometrycontrolmodel.hxx:
|
|
||||||
# Silence warning while checking geometrycontrolmodel.cxx
|
|
||||||
- toolkit/controls/geometrycontrolmodel_impl.hxx
|
|
||||||
toolkit/source/helper/servicenames.cxx:
|
toolkit/source/helper/servicenames.cxx:
|
||||||
# Needed for extern array declarations
|
# Needed for extern array declarations
|
||||||
- toolkit/helper/servicenames.hxx
|
- toolkit/helper/servicenames.hxx
|
||||||
|
@@ -44,9 +44,6 @@ blacklist:
|
|||||||
vcl/source/gdi/configsettings.cxx:
|
vcl/source/gdi/configsettings.cxx:
|
||||||
# Needed for OSL_DEBUG_LEVEL > 2
|
# Needed for OSL_DEBUG_LEVEL > 2
|
||||||
- sal/log.hxx
|
- sal/log.hxx
|
||||||
include/vcl/mtfxmldump.hxx:
|
|
||||||
# Silence warning about include/vcl/mtfxmldump.hxx
|
|
||||||
- vcl/metaactiontypes.hxx
|
|
||||||
vcl/source/gdi/salgdilayout.cxx:
|
vcl/source/gdi/salgdilayout.cxx:
|
||||||
# Needed on WIN32
|
# Needed on WIN32
|
||||||
- desktop/exithelper.h
|
- desktop/exithelper.h
|
||||||
|
Reference in New Issue
Block a user