core.git: bin/find-unneeded-includes

2024-04-09 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 83f1a6f8172ab5688bb3e3883e33ed8295d3f5b7
Author: Gabor Kelemen 
AuthorDate: Mon Apr 1 10:37:45 2024 +0200
Commit: Gabor Kelemen 
CommitDate: Tue Apr 9 10:43:59 2024 +0200

find-unneeded-includes: improve list of namespaces

Add 'star' for com::sun::star instances

Add some vcl-specific ones

'PackageKit' gave always a false warning due to the similarity in
org/freedesktop/PackageKit/*hpp
and
officecfg::Office::Common::PackageKit::*

Change-Id: I109e7a2e8d7588d62b2a6bec2e55ec32e993e49e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165697
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 509331cd5ff3..99c77b654d3e 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -342,7 +342,6 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName, 
noexclude, checknamespa
 'oox|core|drawingml|ole|vml|'
 'OpenStormBento|'
 'osl|'
-'PackageKit|'
 'pdfi|pdfparse|'
 'ppt|'
 'pyuno|'
@@ -359,6 +358,7 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName, 
noexclude, checknamespa
 'sfx2|DocTempl|'
 'sidebar|' # for sfx2::sidebar
 'skeletonmaker|'
+'star|' # for com::sun::star
 'std|chrono_literals|literals|'
 'stoc_sec|'
 'store|'
@@ -374,7 +374,7 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName, 
noexclude, checknamespa
 'unopkg|'
 'util|db|qe|' # for xmlsearch::
 'utl|'
-'vcl|'
+'vcl|psp|x11|'
 'writerfilter|'
 'xforms|'
 'xmloff|token|EnhancedCustomShapeToken' # 
for xmloff::


core.git: bin/find-unneeded-includes

2024-03-18 Thread Andrea Gelmini (via logerrit)
 bin/find-unneeded-includes |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit aa76c9e27d5ab2bed4b056ab41d7c1dfc628486a
Author: Andrea Gelmini 
AuthorDate: Mon Mar 18 14:18:35 2024 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Mar 18 23:14:15 2024 +0100

Fix typo

Change-Id: I40e237a2acfe67cb9b40f1018e1a236616b2fe29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164971
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 439bb5230418..509331cd5ff3 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -386,7 +386,7 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName, 
noexclude, checknamespa
 if reason:
 # Warn about namespaces: if a header is suggested only '// 
for $namespace', then the namespace is not used
 # otherwise the used classes name would show up after the 
'// for'
-# Cleaning out the respective header (if ther is any
+# Cleaning out the respective header (if there is any
 # - which is not always the case) is for the next run!
 nameSpace = reason.group(1).split(' ')[0]
 print("WARNING:", fileName, "This 'using namespace' is 
likely unnecessary:", nameSpace)


core.git: bin/find-unneeded-includes

2024-03-18 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |  208 +++--
 1 file changed, 200 insertions(+), 8 deletions(-)

New commits:
commit a741dd2cd5059e3d6a06307fb7c6c016b4099c81
Author: Gabor Kelemen 
AuthorDate: Thu Mar 14 12:40:53 2024 +0100
Commit: Miklos Vajna 
CommitDate: Mon Mar 18 09:21:27 2024 +0100

find-unneeded-includes: add option to detect unneeded namespaces

Sometimes there are unneeded namespaces included, these can be detected
from the IWYU output.
This mode makes a suggestion to remove these, then in a subsequent normal
run some more headers can be detected as unnecessary, whose presence was
justified by the "using namespace" statement.

Change-Id: I45616537925ec0d09039edf3d9237ffbd13e2410
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164939
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 12659fa82a31..439bb5230418 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -153,11 +153,12 @@ def unwrapInclude(include):
 return include[1:-1]
 
 
-def processIWYUOutput(iwyuOutput, moduleRules, fileName, noexclude):
+def processIWYUOutput(iwyuOutput, moduleRules, fileName, noexclude, 
checknamespaces):
 inAdd = False
 toAdd = []
 inRemove = False
 toRemove = []
+inFull = False
 currentFileName = None
 
 for line in iwyuOutput:
@@ -174,6 +175,9 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName, 
noexclude):
 if inAdd:
 inAdd = False
 continue
+if inFull:
+inFull = False
+continue
 
 shouldAdd = fileName + " should add these lines:"
 match = re.match(shouldAdd, line)
@@ -189,6 +193,12 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName, 
noexclude):
 inRemove = True
 continue
 
+if checknamespaces:
+match = re.match("The full include-list for " + fileName, line)
+if match:
+inFull = True
+continue
+
 if inAdd:
 match = re.match('#include ([^ ]+)', line)
 if match:
@@ -198,7 +208,7 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName, 
noexclude):
 # Forward declaration.
 toAdd.append(line)
 
-if inRemove:
+if inRemove and not checknamespaces:
 match = re.match("- #include (.*)  // lines (.*)-.*", line)
 if match:
 # Only suggest removals for now. Removing fwd decls is more 
complex: they may be
@@ -209,25 +219,203 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName, 
noexclude):
 if not ignoreRemoval(include, toAdd, currentFileName, 
moduleRules, noexclude):
 toRemove.append("%s:%s: %s" % (currentFileName, lineno, 
include))
 
+if inFull:
+if checknamespaces:
+# match for all possible URE/UNO namespaces, created with:
+# find udkapi/com/sun/star/ -type d | sort| xargs basename -a 
| tr '
' '|'
+# find offapi/com/sun/star/ -type d | sort | xargs basename -a 
| tr '
' '|'
+# and ooo::vba namespaces
+# plus a few popular ones about other modules
+ns = re.compile(
+'.*for\ ('
+# URE namespaces
+'beans|'
+'bridge|oleautomation|'
+'connection|'
+'container|'
+'io|'
+'java|'
+'lang|'
+'loader|'
+'reflection|'
+'registry|'
+'script|'
+'security|'
+'task|'
+'uno|'
+'uri|'
+'util|'
+# UNO namespaces
+'accessibility|'
+'animations|'
+'auth|'
+'awt|tab|tree|grid|'
+'chart|'
+'chart2|data|'
+'configuration|bootstrap|backend|xml|'
+'cui|'
+'datatransfer|clipboard|dnd|'
+'deployment|test|ui|'
+'document|'
+'drawing|framework|'
+

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

2023-09-19 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |4 
 1 file changed, 4 insertions(+)

New commits:
commit 05418537bf82929c1e4a8575453b26d7d4c843fe
Author: Gabor Kelemen 
AuthorDate: Sun Sep 17 10:35:44 2023 +0200
Commit: Miklos Vajna 
CommitDate: Tue Sep 19 08:20:10 2023 +0200

bin/find-unneeded-includes: silence error on include/vcl/toolkit

Change-Id: Ia40717df6d6137ca5a8f6d91dd5b95a1decbaa72
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156991
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index cc694fcb41a6..d538a90e32af 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -261,6 +261,10 @@ def tidy(compileCommands, paths, dontstop, noexclude):
 if isInUnoIncludeFile(path):
 continue
 
+# IWYU fails on these with #error: don't use this in new code
+if path.startswith("include/vcl/toolkit"):
+continue
+
 moduleName = path.split("/")[0]
 
 rulePath = os.path.join(moduleName, "IwyuFilter_" + moduleName + 
".yaml")


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

2022-04-25 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 655e5d4406e15774a76c945a57700d21516813c1
Author: Gabor Kelemen 
AuthorDate: Mon Apr 18 14:54:26 2022 +0200
Commit: Miklos Vajna 
CommitDate: Mon Apr 25 08:43:38 2022 +0200

find-unneeded-includes: bail out early if no files are found with 
--recursive

Change-Id: I5bd726b33e4fc7068baad91ff185763274307b35
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133308
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index f58677c48bb7..cc694fcb41a6 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -346,6 +346,13 @@ def main(argv):
 
 # quickly sanity check whether files with exceptions in yaml still exists
 # only check for the module of the very first filename passed
+
+# Verify there are files selected for checking, with --recursive it
+# may happen that there are in fact no C/C++ files in a module directory
+if not list_of_files:
+print("No files found to check!")
+sys.exit(-2)
+
 moduleName = sorted(list_of_files)[0].split("/")[0]
 rulePath = os.path.join(moduleName, "IwyuFilter_" + moduleName + ".yaml")
 moduleRules = {}


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

2022-04-24 Thread Andrea Gelmini (via logerrit)
 bin/find-unneeded-includes |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit eaab20c304882d26b9593edab402d64cc55c2df3
Author: Andrea Gelmini 
AuthorDate: Sun Apr 24 10:23:56 2022 +0200
Commit: Andrea Gelmini 
CommitDate: Sun Apr 24 11:22:44 2022 +0200

Fix typo

Change-Id: I85013e2fc1150b1830fa21da7ed77ac95ff7452e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133352
Reviewed-by: Julien Nabet 
Tested-by: Jenkins

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index ea8ba64fb921..f58677c48bb7 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -316,7 +316,7 @@ def main(argv):
 parser.add_argument('--headers', action='store_true',
 help='Check header files. If omitted, check source files. 
Use with --recursive.')
 parser.add_argument('--noexclude', action='store_true',
-help='Ignore excludelist. Useful to check wheher its 
exclusions are still all valid.')
+help='Ignore excludelist. Useful to check whether its 
exclusions are still all valid.')
 
 args = parser.parse_args()
 


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

2022-04-23 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |   22 --
 1 file changed, 12 insertions(+), 10 deletions(-)

New commits:
commit f775b625b497b4fa6731bddd433916dde52fbb2e
Author: Gabor Kelemen 
AuthorDate: Mon Apr 18 14:46:20 2022 +0200
Commit: Thorsten Behrens 
CommitDate: Sat Apr 23 16:35:03 2022 +0200

find-unneeded-includes: add --noexclude argument

To ignore the excludelist, thereby checking if its exclusions
are still valid.
It may happen that some refactorings make an exclusion obsolete.
In this case the IWYU suggestion to remove a now-really-unnecessary
header would be ignored forever.

It makes sense to use it after a full cleanup of a module in normal mode.

Change-Id: I8216a79ea2354ab428d6ce7a56a49e5cf67056fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133307
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 8197e9bf6814..ea8ba64fb921 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -31,7 +31,7 @@ import argparse
 import pathlib
 
 
-def ignoreRemoval(include, toAdd, absFileName, moduleRules):
+def ignoreRemoval(include, toAdd, absFileName, moduleRules, noexclude):
 # global rules
 
 # Avoid replacing .hpp with .hdl in the com::sun::star and  ooo::vba 
namespaces.
@@ -139,9 +139,9 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 if include.endswith(".hpp"):
 return True
 
-# yaml rules
+# yaml rules, except when --noexclude is given
 
-if "excludelist" in moduleRules.keys():
+if "excludelist" in moduleRules.keys() and not noexclude:
 excludelistRules = moduleRules["excludelist"]
 if fileName in excludelistRules.keys():
 if include in excludelistRules[fileName]:
@@ -155,7 +155,7 @@ def unwrapInclude(include):
 return include[1:-1]
 
 
-def processIWYUOutput(iwyuOutput, moduleRules, fileName):
+def processIWYUOutput(iwyuOutput, moduleRules, fileName, noexclude):
 inAdd = False
 toAdd = []
 inRemove = False
@@ -208,7 +208,7 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName):
 # avoid the later.
 include = unwrapInclude(match.group(1))
 lineno = match.group(2)
-if not ignoreRemoval(include, toAdd, currentFileName, 
moduleRules):
+if not ignoreRemoval(include, toAdd, currentFileName, 
moduleRules, noexclude):
 toRemove.append("%s:%s: %s" % (currentFileName, lineno, 
include))
 
 for remove in sorted(toRemove):
@@ -216,13 +216,13 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName):
 return len(toRemove)
 
 
-def run_tool(task_queue, failed_files, dontstop):
+def run_tool(task_queue, failed_files, dontstop, noexclude):
 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])
+retcode = 
processIWYUOutput(p.communicate()[0].decode('utf-8').splitlines(), moduleRules, 
invocation.split(' ')[-1], noexclude)
 if retcode == -1:
 print("ERROR: A file is probably not self contained, check 
this commands output:\n" + invocation)
 elif retcode > 0:
@@ -245,7 +245,7 @@ def isInUnoIncludeFile(path):
 or path.startswith("include/uno/")
 
 
-def tidy(compileCommands, paths, dontstop):
+def tidy(compileCommands, paths, dontstop, noexclude):
 return_code = 0
 
 try:
@@ -253,7 +253,7 @@ def tidy(compileCommands, paths, dontstop):
 task_queue = queue.Queue(max_task)
 failed_files = []
 for _ in range(max_task):
-t = threading.Thread(target=run_tool, args=(task_queue, 
failed_files, dontstop))
+t = threading.Thread(target=run_tool, args=(task_queue, 
failed_files, dontstop, noexclude))
 t.daemon = True
 t.start()
 
@@ -315,6 +315,8 @@ def main(argv):
 help='Recursively search a directory for source files to 
check')
 parser.add_argument('--headers', action='store_true',
 help='Check header files. If omitted, check source files. 
Use with --recursive.')
+parser.add_argument('--noexclude', action='store_true',
+help='Ignore excludelist. Useful to check wheher its 
exclusions are still all valid.')
 
 args = parser.parse_args()
 
@@ -356,7 +358,7 @@ def main(argv):
 if not file.exists():
 print("WARNING: File listed in " + rulePath + " no longer 
exists: " + pathname)
 
-tidy(compileCommands, paths=list_of_files, 

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

2022-02-15 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |   15 +++
 1 file changed, 15 insertions(+)

New commits:
commit ad1cc7420ff87745ef6981a85e4e0122f8d8a9e3
Author: Gabor Kelemen 
AuthorDate: Sun Feb 13 15:27:41 2022 +0100
Commit: Miklos Vajna 
CommitDate: Tue Feb 15 09:28:44 2022 +0100

find-unneeded-includes: check existence of files listed in yaml files

It might happen that some files are removed/renamed
warn about such files to adjust filter rules

Change-Id: Ib8f1c586a67310cc8be04edfcc75f655da2dbfe0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129881
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index bdff09bf23eb..8197e9bf6814 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -28,6 +28,7 @@ import sys
 import threading
 import yaml
 import argparse
+import pathlib
 
 
 def ignoreRemoval(include, toAdd, absFileName, moduleRules):
@@ -341,6 +342,20 @@ def main(argv):
 print ("File 'compile_commands.json' does not exist, please run:\nmake 
vim-ide-integration")
 sys.exit(-1)
 
+# quickly sanity check whether files with exceptions in yaml still exists
+# only check for the module of the very first filename passed
+moduleName = sorted(list_of_files)[0].split("/")[0]
+rulePath = os.path.join(moduleName, "IwyuFilter_" + moduleName + ".yaml")
+moduleRules = {}
+if os.path.exists(rulePath):
+moduleRules = yaml.full_load(open(rulePath))
+if "excludelist" in moduleRules.keys():
+excludelistRules = moduleRules["excludelist"]
+for pathname in excludelistRules.keys():
+file = pathlib.Path(pathname)
+if not file.exists():
+print("WARNING: File listed in " + rulePath + " no longer 
exists: " + pathname)
+
 tidy(compileCommands, paths=list_of_files, dontstop=vars(args)["continue"])
 
 if __name__ == '__main__':


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

2022-02-13 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 5382df1422832fb7a18a2a39ac52fb75ababff17
Author: Gabor Kelemen 
AuthorDate: Sun Feb 13 14:36:52 2022 +0100
Commit: Miklos Vajna 
CommitDate: Mon Feb 14 08:31:00 2022 +0100

find-unneeded-includes: rename argument to --continue

sounds more natural than --dontstop

Change-Id: I4650f8bf97a426782828f0e088805551c5830acc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129880
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 93257451cce9..bdff09bf23eb 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -306,7 +306,7 @@ def tidy(compileCommands, paths, dontstop):
 
 def main(argv):
 parser = argparse.ArgumentParser(description='Check source files for 
unneeded includes.')
-parser.add_argument('--dontstop', action='store_true',
+parser.add_argument('--continue', action='store_true',
 help='Don\'t stop on errors. Useful for periodic re-check 
of large amount of files')
 parser.add_argument('Files' , nargs='*',
 help='The files to be checked')
@@ -341,7 +341,7 @@ def main(argv):
 print ("File 'compile_commands.json' does not exist, please run:\nmake 
vim-ide-integration")
 sys.exit(-1)
 
-tidy(compileCommands, paths=list_of_files, dontstop=args.dontstop)
+tidy(compileCommands, paths=list_of_files, dontstop=vars(args)["continue"])
 
 if __name__ == '__main__':
 main(sys.argv[1:])


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

2021-12-13 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |2 ++
 ucb/IwyuFilter_ucb.yaml|4 
 2 files changed, 2 insertions(+), 4 deletions(-)

New commits:
commit ad56717ed85d271616e102540a2e20e3cf7a887c
Author: Gabor Kelemen 
AuthorDate: Mon Dec 13 14:22:01 2021 +0100
Commit: Miklos Vajna 
CommitDate: Tue Dec 14 08:39:30 2021 +0100

find-unneeded-includes: add exception for boost/shared_ptr.hpp

* as seen in vcl/inc/skia/salbmp.hxx
* also remove earlier exception from ucb modules file

Change-Id: Ie0ad46048147916b615f74d8eab6e033c2020565
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126739
Tested-by: Jenkins
Tested-by: Gabor Kelemen 
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 0e8cec276968..93257451cce9 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -86,6 +86,8 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 return True
 if include == "boost/intrusive_ptr.hpp" and 
"boost/smart_ptr/intrusive_ptr.hpp" in toAdd:
 return True
+if include == "boost/shared_ptr.hpp" and "boost/smart_ptr/shared_ptr.hpp" 
in toAdd:
+return True
 if include == "boost/variant.hpp" and "boost/variant/variant.hpp" in toAdd:
 return True
 if include == "boost/unordered_map.hpp" and 
"boost/unordered/unordered_map.hpp" in toAdd:
diff --git a/ucb/IwyuFilter_ucb.yaml b/ucb/IwyuFilter_ucb.yaml
index 2c0ef5bb6552..cd9ff1c84725 100644
--- a/ucb/IwyuFilter_ucb.yaml
+++ b/ucb/IwyuFilter_ucb.yaml
@@ -1,10 +1,6 @@
 ---
 assumeFilename: ucb/source/core/ucb.cxx
 excludelist:
-ucb/source/ucp/cmis/std_outputstream.hxx:
-- boost/shared_ptr.hpp
-ucb/source/ucp/cmis/std_inputstream.hxx:
-- boost/shared_ptr.hpp
 ucb/source/ucp/ftp/ftploaderthread.hxx:
 # Wrapper for external lib
 - curl.hxx


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

2021-08-05 Thread Miklos Vajna (via logerrit)
 bin/find-unneeded-includes |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 746d95bb4067943679f0fe3b8bf91269debf519b
Author: Miklos Vajna 
AuthorDate: Thu Aug 5 14:54:45 2021 +0200
Commit: Miklos Vajna 
CommitDate: Thu Aug 5 16:55:01 2021 +0200

find-unneeded-includes: remove leftover debug print()

Change-Id: I738d191415db130d875d5b7139ff768ad389dd93
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120070
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 48f8f6c73337..0e8cec276968 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -289,7 +289,6 @@ def tidy(compileCommands, paths, dontstop):
 args = args.replace(assumeAbs, "-x c++ " + pathAbs)
 
 invocation = "include-what-you-use -Xiwyu --no_fwd_decls -Xiwyu 
--max_line_length=200 " + args
-print(invocation)
 task_queue.put((invocation, moduleRules))
 
 task_queue.join()


[Libreoffice-commits] core.git: bin/find-unneeded-includes sw/CppunitTest_sw_core_edit.mk sw/Module_sw.mk sw/qa sw/source

2021-08-05 Thread Miklos Vajna (via logerrit)
 bin/find-unneeded-includes   |1 
 sw/CppunitTest_sw_core_edit.mk   |   75 +++
 sw/Module_sw.mk  |1 
 sw/qa/core/edit/data/redline-hidden.fodt |   32 +
 sw/qa/core/edit/edit.cxx |   43 +
 sw/source/core/edit/edatmisc.cxx |2 
 6 files changed, 153 insertions(+), 1 deletion(-)

New commits:
commit 39392ee94c78692a9179f7face15af0c9e74e492
Author: Miklos Vajna 
AuthorDate: Thu Aug 5 13:43:50 2021 +0200
Commit: Miklos Vajna 
CommitDate: Thu Aug 5 14:51:58 2021 +0200

sw: fix assert fail with ShowRedlineChanges=false and para format

It fails like this:

loolforkit: sw/source/core/layout/wsfrm.cxx:4551: void 
UnHide(SwRootFrame&): Assertion `rLayout.GetCurrShell()->ActionPend()' failed.
#4  0x7f98e9f8c198 in UnHide(SwRootFrame&) (rLayout=...) at 
sw/source/core/layout/wsfrm.cxx:4551
#5  0x7f98e9f8c839 in SwRootFrame::SetHideRedlines(bool) 
(this=0x7f98c40f7bd0, bHideRedlines=false) at 
sw/source/core/layout/wsfrm.cxx:4664
#6  0x7f98e9b18afd in 
sw::DocumentRedlineManager::SetRedlineFlags(RedlineFlags) (this=0x80a4120, 
eMode=49) at sw/source/core/doc/DocumentRedlineManager.cxx:1097
#7  0x7f98e9cfa503 in SwEditShell::SetAttrSet(SfxItemSet 
const&, SetAttrMode, SwPaM*, bool) (this=0x8885840, rSet=
SfxItemSet of pool 0x808fd10 with parent 0x0 and Which ranges: 
[(63, 64), (120, 120)] = {...}, nFlags=SetAttrMode::DEFAULT, pPaM=0x0, 
bParagraphSetting=true)
at sw/source/core/edit/edatmisc.cxx:187
#8  0x7f98ea995f07 in SwTextShell::ExecParaAttr(SfxRequest&) 
(this=0x8bd0820, rReq=...) at sw/source/uibase/shells/txtattr.cxx:451

Fix it the same way commit dd489bc01adc22fc5015ea56b61d66104af184a8
(tdf#125754 sw_redlinehide: avoid recursive layout in SetHideRedlines(),
2019-06-19) did: make sure that SetHideRedlines() is called before
EndAllAction().

Change-Id: I6304abec2e2e2967a8369b0219492bebcd606d03
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120069
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 0e8cec276968..48f8f6c73337 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -289,6 +289,7 @@ def tidy(compileCommands, paths, dontstop):
 args = args.replace(assumeAbs, "-x c++ " + pathAbs)
 
 invocation = "include-what-you-use -Xiwyu --no_fwd_decls -Xiwyu 
--max_line_length=200 " + args
+print(invocation)
 task_queue.put((invocation, moduleRules))
 
 task_queue.join()
diff --git a/sw/CppunitTest_sw_core_edit.mk b/sw/CppunitTest_sw_core_edit.mk
new file mode 100644
index ..21afd9ec538f
--- /dev/null
+++ b/sw/CppunitTest_sw_core_edit.mk
@@ -0,0 +1,75 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*
+
+$(eval $(call gb_CppunitTest_CppunitTest,sw_core_edit))
+
+$(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_core_edit))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sw_core_edit, \
+sw/qa/core/edit/edit \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sw_core_edit, \
+editeng \
+comphelper \
+cppu \
+cppuhelper \
+sal \
+sfx \
+svxcore \
+sw \
+   swqahelper \
+test \
+unotest \
+utl \
+vcl \
+svt \
+tl \
+svl \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,sw_core_edit,\
+boost_headers \
+libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sw_core_edit,\
+-I$(SRCDIR)/sw/inc \
+-I$(SRCDIR)/sw/source/core/inc \
+-I$(SRCDIR)/sw/source/uibase/inc \
+-I$(SRCDIR)/sw/qa/inc \
+$$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,sw_core_edit,\
+   udkapi \
+   offapi \
+   oovbaapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,sw_core_edit))
+$(eval $(call gb_CppunitTest_use_vcl,sw_core_edit))
+
+$(eval $(call gb_CppunitTest_use_rdb,sw_core_edit,services))
+
+$(eval $(call gb_CppunitTest_use_custom_headers,sw_core_edit,\
+officecfg/registry \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sw_core_edit))
+
+$(eval $(call gb_CppunitTest_use_uiconfigs,sw_core_edit, \
+modules/swriter \
+))
+
+$(eval $(call gb_CppunitTest_use_more_fonts,sw_core_edit))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index 

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

2021-07-15 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 246c766cadcafc5d26f39f832a683a13f2dfe40b
Author: Gabor Kelemen 
AuthorDate: Wed Jul 14 22:33:01 2021 +0200
Commit: Miklos Vajna 
CommitDate: Thu Jul 15 11:59:52 2021 +0200

find-unneeded-includes: Add --headers option

so that --recursive checks only header files.
if omitted, --recursive checks source files.

Change-Id: I7406e90dc4df4603b62d23751d3c78a1fdedec38
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118959
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 9b38fd524f49..0e8cec276968 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -310,6 +310,8 @@ def main(argv):
 help='The files to be checked')
 parser.add_argument('--recursive', metavar='DIR', nargs=1, type=str,
 help='Recursively search a directory for source files to 
check')
+parser.add_argument('--headers', action='store_true',
+help='Check header files. If omitted, check source files. 
Use with --recursive.')
 
 args = parser.parse_args()
 
@@ -321,8 +323,12 @@ def main(argv):
 if args.recursive:
 for root, dirs, files in os.walk(args.recursive[0]):
 for file in files:
-if (file.endswith(".cxx") or file.endswith(".hxx") or 
file.endswith(".hrc") or file.endswith(".h") or file.endswith(".c")):
-list_of_files.append(os.path.join(root,file))
+if args.headers:
+if (file.endswith(".hxx") or file.endswith(".hrc") or 
file.endswith(".h")):
+list_of_files.append(os.path.join(root,file))
+else:
+if (file.endswith(".cxx") or file.endswith(".c")):
+list_of_files.append(os.path.join(root,file))
 else:
 list_of_files = args.Files
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-14 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |   13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 3f618170b8474b4a4e97aa7685daf064d0413a57
Author: Gabor Kelemen 
AuthorDate: Wed Jul 14 00:24:50 2021 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jul 14 11:28:49 2021 +0200

find-unneeded-includes: add --recursive option

so that f-u-i will be able to find files to check on its own.

Previously you had to find foo -name "*cxx" | xargs bin/f-u-i

Now its a bit easier to mass-check files.

Change-Id: I2823832ce8335a30493cf9f538f6fc5baec42dde
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118875
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index fbda1007adfd..9b38fd524f49 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -308,6 +308,8 @@ def main(argv):
 help='Don\'t stop on errors. Useful for periodic re-check 
of large amount of files')
 parser.add_argument('Files' , nargs='*',
 help='The files to be checked')
+parser.add_argument('--recursive', metavar='DIR', nargs=1, type=str,
+help='Recursively search a directory for source files to 
check')
 
 args = parser.parse_args()
 
@@ -315,6 +317,15 @@ def main(argv):
 parser.print_help()
 return
 
+list_of_files = []
+if args.recursive:
+for root, dirs, files in os.walk(args.recursive[0]):
+for file in files:
+if (file.endswith(".cxx") or file.endswith(".hxx") or 
file.endswith(".hrc") or file.endswith(".h") or file.endswith(".c")):
+list_of_files.append(os.path.join(root,file))
+else:
+list_of_files = args.Files
+
 try:
 with open("compile_commands.json", 'r') as compileCommandsSock:
 compileCommands = json.load(compileCommandsSock)
@@ -322,7 +333,7 @@ def main(argv):
 print ("File 'compile_commands.json' does not exist, please run:\nmake 
vim-ide-integration")
 sys.exit(-1)
 
-tidy(compileCommands, paths=args.Files, dontstop=args.dontstop)
+tidy(compileCommands, paths=list_of_files, dontstop=args.dontstop)
 
 if __name__ == '__main__':
 main(sys.argv[1:])
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-06-28 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |   23 +--
 1 file changed, 17 insertions(+), 6 deletions(-)

New commits:
commit 1421831429056ed770a67feeec12c843f80bb006
Author: Gabor Kelemen 
AuthorDate: Thu Jun 24 07:42:32 2021 +0200
Commit: Miklos Vajna 
CommitDate: Mon Jun 28 08:58:02 2021 +0200

find-unneeded-includes: introduce --dontstop switch

...to make it not stop after each error found.

In case there are not many problems to be expected, it is faster to
check a bunch of files and fix the problematic 5% than re-check
over and over again the non-problematic ones after each error found.

Change-Id: Iec5a2aa96ac557c0247ae2f06eb710daa75cc19b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117756
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 4f90ab55e9f5..fbda1007adfd 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -27,6 +27,7 @@ import subprocess
 import sys
 import threading
 import yaml
+import argparse
 
 
 def ignoreRemoval(include, toAdd, absFileName, moduleRules):
@@ -212,7 +213,7 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName):
 return len(toRemove)
 
 
-def run_tool(task_queue, failed_files):
+def run_tool(task_queue, failed_files, dontstop):
 while True:
 invocation, moduleRules = task_queue.get()
 if not len(failed_files):
@@ -223,7 +224,8 @@ def run_tool(task_queue, failed_files):
 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)
+if not dontstop:
+failed_files.append(invocation)
 task_queue.task_done()
 
 
@@ -240,14 +242,15 @@ def isInUnoIncludeFile(path):
 or path.startswith("include/uno/")
 
 
-def tidy(compileCommands, paths):
+def tidy(compileCommands, paths, dontstop):
 return_code = 0
+
 try:
 max_task = multiprocessing.cpu_count()
 task_queue = queue.Queue(max_task)
 failed_files = []
 for _ in range(max_task):
-t = threading.Thread(target=run_tool, args=(task_queue, 
failed_files))
+t = threading.Thread(target=run_tool, args=(task_queue, 
failed_files, dontstop))
 t.daemon = True
 t.start()
 
@@ -300,8 +303,16 @@ def tidy(compileCommands, paths):
 
 
 def main(argv):
+parser = argparse.ArgumentParser(description='Check source files for 
unneeded includes.')
+parser.add_argument('--dontstop', action='store_true',
+help='Don\'t stop on errors. Useful for periodic re-check 
of large amount of files')
+parser.add_argument('Files' , nargs='*',
+help='The files to be checked')
+
+args = parser.parse_args()
+
 if not len(argv):
-print("usage: find-unneeded-includes [FILE]...")
+parser.print_help()
 return
 
 try:
@@ -311,7 +322,7 @@ def main(argv):
 print ("File 'compile_commands.json' does not exist, please run:\nmake 
vim-ide-integration")
 sys.exit(-1)
 
-tidy(compileCommands, paths=argv)
+tidy(compileCommands, paths=args.Files, dontstop=args.dontstop)
 
 if __name__ == '__main__':
 main(sys.argv[1:])
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-06-07 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 996694d78641df4b2adb5357e6e274a9f9e8ca46
Author: Gabor Kelemen 
AuthorDate: Sat Jun 5 16:07:53 2021 +0200
Commit: Miklos Vajna 
CommitDate: Mon Jun 7 12:06:03 2021 +0200

find-unneeded-includes: fix YAMLLoadWarning on newer systems

After upgrading to Ubuntu 20.04 I got this warning:
YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as 
the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full 
details.

Change f-u-i per instructions on website above to fix this warning.

Change-Id: I4424b0ced49d81dceb33131e1df150387a89df4a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116748
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 65f791101d90..4f90ab55e9f5 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -260,7 +260,7 @@ def tidy(compileCommands, paths):
 rulePath = os.path.join(moduleName, "IwyuFilter_" + moduleName + 
".yaml")
 moduleRules = {}
 if os.path.exists(rulePath):
-moduleRules = yaml.load(open(rulePath))
+moduleRules = yaml.full_load(open(rulePath))
 assume = None
 pathAbs = os.path.abspath(path)
 compileFile = pathAbs
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-01-19 Thread Miklos Vajna (via logerrit)
 bin/find-unneeded-includes   |2 
 include/vcl/filter/PDFiumLibrary.hxx |   53 ++--
 vcl/source/pdf/PDFiumLibrary.cxx |   77 ---
 3 files changed, 78 insertions(+), 54 deletions(-)

New commits:
commit 53d4346968c82c8c998ed074aa72591b73f02814
Author: Miklos Vajna 
AuthorDate: Tue Jan 19 21:05:46 2021 +0100
Commit: Miklos Vajna 
CommitDate: Wed Jan 20 08:25:50 2021 +0100

pdfium: rework to eliminate FPDF_PAGEOBJECT from the public interface

And fix bin/find-unneeded-includes to not report noise on
PDFiumLibrary.cxx.

Change-Id: I93337e49a5656349089bdb790876bebe8505082c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109656
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 90c4d89d8800..65f791101d90 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -118,6 +118,8 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 # Works around a build breakage specific to the broken Android
 # toolchain.
 "android/compatibility.hxx",
+# Removing this would change the meaning of '#if defined 
OSL_BIGENDIAN'.
+"osl/endian.h",
 )
 if include in noRemove:
 return True
diff --git a/include/vcl/filter/PDFiumLibrary.hxx 
b/include/vcl/filter/PDFiumLibrary.hxx
index 79f91c6f5264..2774e1328ebf 100644
--- a/include/vcl/filter/PDFiumLibrary.hxx
+++ b/include/vcl/filter/PDFiumLibrary.hxx
@@ -122,40 +122,31 @@ public:
 virtual PDFSegmentType getType() const = 0;
 };
 
-class VCL_DLLPUBLIC PDFiumPageObject final
+class VCL_DLLPUBLIC PDFiumPageObject
 {
-private:
-FPDF_PAGEOBJECT mpPageObject;
-
-PDFiumPageObject(const PDFiumPageObject&) = delete;
-PDFiumPageObject& operator=(const PDFiumPageObject&) = delete;
-
 public:
-PDFiumPageObject(FPDF_PAGEOBJECT pPageObject);
-~PDFiumPageObject();
-
-FPDF_PAGEOBJECT getPointer() { return mpPageObject; }
-
-PDFPageObjectType getType();
-OUString getText(std::unique_ptr const& pTextPage);
-
-int getFormObjectCount();
-std::unique_ptr getFormObject(int nIndex);
-
-basegfx::B2DHomMatrix getMatrix();
-basegfx::B2DRectangle getBounds();
-double getFontSize();
-OUString getFontName();
-PDFTextRenderMode getTextRenderMode();
-Color getFillColor();
-Color getStrokeColor();
-double getStrokeWidth();
+virtual ~PDFiumPageObject() = default;
+
+virtual PDFPageObjectType getType() = 0;
+virtual OUString getText(std::unique_ptr const& pTextPage) 
= 0;
+
+virtual int getFormObjectCount() = 0;
+virtual std::unique_ptr getFormObject(int nIndex) = 0;
+
+virtual basegfx::B2DHomMatrix getMatrix() = 0;
+virtual basegfx::B2DRectangle getBounds() = 0;
+virtual double getFontSize() = 0;
+virtual OUString getFontName() = 0;
+virtual PDFTextRenderMode getTextRenderMode() = 0;
+virtual Color getFillColor() = 0;
+virtual Color getStrokeColor() = 0;
+virtual double getStrokeWidth() = 0;
 // Path
-int getPathSegmentCount();
-std::unique_ptr getPathSegment(int index);
-Size getImageSize(PDFiumPage& rPage);
-std::unique_ptr getImageBitmap();
-bool getDrawMode(PDFFillMode& eFillMode, bool& bStroke);
+virtual int getPathSegmentCount() = 0;
+virtual std::unique_ptr getPathSegment(int index) = 0;
+virtual Size getImageSize(PDFiumPage& rPage) = 0;
+virtual std::unique_ptr getImageBitmap() = 0;
+virtual bool getDrawMode(PDFFillMode& eFillMode, bool& bStroke) = 0;
 };
 
 class VCL_DLLPUBLIC PDFiumTextPage final
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx
index 42fb1370ce9f..886549031596 100644
--- a/vcl/source/pdf/PDFiumLibrary.cxx
+++ b/vcl/source/pdf/PDFiumLibrary.cxx
@@ -209,6 +209,39 @@ public:
 std::vector getAttachmentPoints(size_t nIndex) override;
 std::vector getLineGeometry() override;
 };
+
+class PDFiumPageObjectImpl final : public PDFiumPageObject
+{
+private:
+FPDF_PAGEOBJECT mpPageObject;
+
+PDFiumPageObjectImpl(const PDFiumPageObjectImpl&) = delete;
+PDFiumPageObjectImpl& operator=(const PDFiumPageObjectImpl&) = delete;
+
+public:
+PDFiumPageObjectImpl(FPDF_PAGEOBJECT pPageObject);
+
+PDFPageObjectType getType() override;
+OUString getText(std::unique_ptr const& pTextPage) 
override;
+
+int getFormObjectCount() override;
+std::unique_ptr getFormObject(int nIndex) override;
+
+basegfx::B2DHomMatrix getMatrix() override;
+basegfx::B2DRectangle getBounds() override;
+double getFontSize() override;
+OUString getFontName() override;
+PDFTextRenderMode getTextRenderMode() override;
+Color getFillColor() override;
+Color getStrokeColor() override;
+double getStrokeWidth() override;
+// Path
+int getPathSegmentCount() override;
+std::unique_ptr 

[Libreoffice-commits] core.git: bin/find-unneeded-includes embeddedobj/source writerperfect/source xmlsecurity/source

2020-09-02 Thread Miklos Vajna (via logerrit)
 bin/find-unneeded-includes|6 +-
 embeddedobj/source/commonembedding/xfactory.cxx   |2 --
 embeddedobj/source/general/xcreator.cxx   |1 -
 embeddedobj/source/msole/oleembed.cxx |1 -
 embeddedobj/source/msole/ownview.cxx  |1 -
 writerperfect/source/impress/KeynoteImportFilter.cxx  |1 -
 xmlsecurity/source/helper/documentsignaturehelper.cxx |1 -
 7 files changed, 5 insertions(+), 8 deletions(-)

New commits:
commit 47579fc2405e3253c9d2664522b5f6861d7c0aa0
Author: Miklos Vajna 
AuthorDate: Tue Sep 1 20:58:43 2020 +0200
Commit: Miklos Vajna 
CommitDate: Wed Sep 2 09:08:11 2020 +0200

Remove some unused includes

Change-Id: I90d4e3db3eefa41f8492cfe23c5088ea93134afc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101890
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 5d3dcb6367da..90c4d89d8800 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -108,6 +108,8 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 return True
 if include == "librevenge/librevenge.h" and 
"librevenge/RVNGPropertyList.h" in toAdd:
 return True
+if include == "libetonyek/libetonyek.h" and "libetonyek/EtonyekDocument.h" 
in toAdd:
+return True
 
 noRemove = (
 #  insists on 
not
@@ -262,7 +264,9 @@ def tidy(compileCommands, paths):
 compileFile = pathAbs
 matches = [i for i in compileCommands if i["file"] == compileFile]
 if not len(matches):
-if "assumeFilename" in moduleRules.keys():
+# Only use assume-filename for headers, so we don't try to 
analyze e.g. Windows-only
+# code on Linux.
+if "assumeFilename" in moduleRules.keys() and not 
path.endswith("cxx"):
 assume = moduleRules["assumeFilename"]
 if assume:
 assumeAbs = os.path.abspath(assume)
diff --git a/embeddedobj/source/commonembedding/xfactory.cxx 
b/embeddedobj/source/commonembedding/xfactory.cxx
index d383567f3e47..a4ef74d08ee4 100644
--- a/embeddedobj/source/commonembedding/xfactory.cxx
+++ b/embeddedobj/source/commonembedding/xfactory.cxx
@@ -19,12 +19,10 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
diff --git a/embeddedobj/source/general/xcreator.cxx 
b/embeddedobj/source/general/xcreator.cxx
index a186ad20a06f..9e9bb0934603 100644
--- a/embeddedobj/source/general/xcreator.cxx
+++ b/embeddedobj/source/general/xcreator.cxx
@@ -27,7 +27,6 @@
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #include 
diff --git a/embeddedobj/source/msole/oleembed.cxx 
b/embeddedobj/source/msole/oleembed.cxx
index 40924b413072..70d2b5d0a7d9 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -44,7 +44,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/embeddedobj/source/msole/ownview.cxx 
b/embeddedobj/source/msole/ownview.cxx
index 8abb7f9d2acf..9cb811b7c672 100644
--- a/embeddedobj/source/msole/ownview.cxx
+++ b/embeddedobj/source/msole/ownview.cxx
@@ -24,7 +24,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/writerperfect/source/impress/KeynoteImportFilter.cxx 
b/writerperfect/source/impress/KeynoteImportFilter.cxx
index c212c5ab85d0..900555be6e0b 100644
--- a/writerperfect/source/impress/KeynoteImportFilter.cxx
+++ b/writerperfect/source/impress/KeynoteImportFilter.cxx
@@ -21,7 +21,6 @@
 #include 
 
 #include 
-#include 
 #include 
 
 #include "KeynoteImportFilter.hxx"
diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx 
b/xmlsecurity/source/helper/documentsignaturehelper.cxx
index 482ae6cc4126..784a5571d2a9 100644
--- a/xmlsecurity/source/helper/documentsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx
@@ -23,7 +23,6 @@
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-07-12 Thread Andrea Gelmini (via logerrit)
 bin/find-unneeded-includes |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 34fc69c7beef71fcae4e6d1fde7237c156c0bdbc
Author: Andrea Gelmini 
AuthorDate: Fri Jul 10 12:33:56 2020 +0200
Commit: Julien Nabet 
CommitDate: Sun Jul 12 18:20:42 2020 +0200

Fix typo

Change-Id: Ib728bcd332400df7e6c5466387fcdbda97792382
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98489
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 2090339b21df..5d3dcb6367da 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -12,7 +12,7 @@
 # you can generate one with 'make vim-ide-integration'.
 #
 # Design goals:
-# - exludelist mechanism, so a warning is either fixed or excluded
+# - excludelist mechanism, so a warning is either fixed or excluded
 # - works in a plugins-enabled clang build
 # - no custom configure options required
 # - no need to generate a dummy library to build a header
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-02-13 Thread Miklos Vajna (via logerrit)
 bin/find-unneeded-includes |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 919f639c721256e852f20c0e84b3942860e69f32
Author: Miklos Vajna 
AuthorDate: Wed Feb 12 20:43:31 2020 +0100
Commit: Miklos Vajna 
CommitDate: Thu Feb 13 09:04:19 2020 +0100

find-unneeded-includes: silence broken o3tl::optional -> std::optional 
proposal

This is just a workaround, see the upstream bugreport for the details.

Change-Id: I2334fb3ad86db7f43bd49c694eea3c240316bfa0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88566
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 8ba5a7d354a6..a6ec228fce58 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -64,7 +64,10 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 "functional": "bits/std_function.h",
 "cmath": "bits/std_abs.h",
 "ctime": "bits/types/clock_t.h",
-"cstdint": "bits/stdint-uintn.h"
+"cstdint": "bits/stdint-uintn.h",
+# Keep using the o3tl wrapper for .
+# Works around 
.
+"o3tl/optional.hxx": "optional",
 }
 for k, v in bits.items():
 if include == k and v in toAdd:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: bin/find-unneeded-includes sc/IwyuFilter_sc.yaml sd/IwyuFilter_sd.yaml svtools/IwyuFilter_svtools.yaml sw/IwyuFilter_sw.yaml toolkit/IwyuFilter_toolkit.yaml vcl/IwyuFil

2019-10-04 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes  |   14 --
 sc/IwyuFilter_sc.yaml   |6 --
 sd/IwyuFilter_sd.yaml   |5 -
 svtools/IwyuFilter_svtools.yaml |6 --
 sw/IwyuFilter_sw.yaml   |7 ---
 toolkit/IwyuFilter_toolkit.yaml |3 ---
 vcl/IwyuFilter_vcl.yaml |3 ---
 7 files changed, 8 insertions(+), 36 deletions(-)

New commits:
commit b3c072a4ee94c5f86723cdcc98ea08f46f981b4a
Author: Gabor Kelemen 
AuthorDate: Fri Oct 4 00:03:09 2019 +0200
Commit: Miklos Vajna 
CommitDate: Fri Oct 4 09:08:49 2019 +0200

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 

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:
diff --git a/sc/IwyuFilter_sc.yaml b/sc/IwyuFilter_sc.yaml
index 6708f69fec8b..2743efdd96f2 100644
--- a/sc/IwyuFilter_sc.yaml
+++ b/sc/IwyuFilter_sc.yaml
@@ -58,9 +58,6 @@ blacklist:
 sc/inc/chgviset.hxx:
 # base class has to be a complete type
 - unotools/textsearch.hxx
-sc/inc/colcontainer.hxx:
-# Needed to silence the check on colcontainer.cxx
-- column.hxx
 sc/inc/column.hxx:
 # base class has to be a complete type
 - mdds/flat_segment_tree.hpp
@@ -384,9 +381,6 @@ blacklist:
 sc/source/filter/inc/formulabase.hxx:
 # Needed for typedef
 - 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:
 # base class has to be a complete type
 - com/sun/star/lang/XInitialization.hpp
diff --git a/sd/IwyuFilter_sd.yaml b/sd/IwyuFilter_sd.yaml
index b5b715e0214e..d69c951a8bbd 100644
--- a/sd/IwyuFilter_sd.yaml
+++ b/sd/IwyuFilter_sd.yaml
@@ -124,8 +124,6 @@ blacklist:
 # base class has to be a complete type
 - com/sun/star/drawing/framework/XResourceFactory.hpp
 - com/sun/star/lang/XInitialization.hpp
-# Don't stop on false positive while checking BasicViewFactory.cxx
-- namespace vcl { class Window; }
 

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

2019-07-29 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit fc6b31910f419ea7ea541aa9c4e44ba33d2cc549
Author: Gabor Kelemen 
AuthorDate: Fri Jul 26 22:18:10 2019 +0200
Commit: Miklos Vajna 
CommitDate: Mon Jul 29 09:10:00 2019 +0200

find-unneeded-includes: warn first time user nicely about missing file

Change-Id: Ibc0b818a410cf0aee19b1d2a42a53db9aff87638
Reviewed-on: https://gerrit.libreoffice.org/76461
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 66a5df6f044b..c89b69fc9d2a 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -296,8 +296,12 @@ def main(argv):
 print("usage: find-unneeded-includes [FILE]...")
 return
 
-with open("compile_commands.json", 'r') as compileCommandsSock:
-compileCommands = json.load(compileCommandsSock)
+try:
+with open("compile_commands.json", 'r') as compileCommandsSock:
+compileCommands = json.load(compileCommandsSock)
+except FileNotFoundError:
+print ("File 'compile_commands.json' does not exist, please run:\nmake 
vim-ide-integration")
+sys.exit(-1)
 
 tidy(compileCommands, paths=argv)
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-07-15 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6eed518408a93ad5a9896623d83405c4834b100c
Author: Gabor Kelemen 
AuthorDate: Sun Jul 14 20:08:18 2019 +0200
Commit: Michael Stahl 
CommitDate: Mon Jul 15 12:11:59 2019 +0200

find-unneeded-includes: raise maximum output line length

This is helpful when checking and rechecking the detailed output.

It happens often that removing an unnecessary header makes it
necessary to add a transitively included header. This is
indicated by an error message referring to a now unknown class name.

Finding that header was hard because the default 80 char output limit
usually truncates the class names.

Change-Id: Iae08bc326625961009038007db4a982859f64c8c
Reviewed-on: https://gerrit.libreoffice.org/75598
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index c70006add441..66a5df6f044b 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -277,7 +277,7 @@ def tidy(compileCommands, paths):
 if assume:
 args = args.replace(assumeAbs, "-x c++ " + pathAbs)
 
-invocation = "include-what-you-use -Xiwyu --no_fwd_decls " + args
+invocation = "include-what-you-use -Xiwyu --no_fwd_decls -Xiwyu 
--max_line_length=200 " + args
 task_queue.put((invocation, moduleRules))
 
 task_queue.join()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-07-15 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit bdffe94e0a467774f0b87a4b74587390b4338100
Author: Gabor Kelemen 
AuthorDate: Sun Jul 14 20:05:10 2019 +0200
Commit: Michael Stahl 
CommitDate: Mon Jul 15 12:11:05 2019 +0200

find-unneeded-includes: don't propose to replace hpp with hdl...

in the ooo/vba namespace either. Quite frequent in sc/source/ui/vba

Change-Id: I62c89bb430455f025b25f1246e55012b411db21e
Reviewed-on: https://gerrit.libreoffice.org/75597
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index d3177af8336a..c70006add441 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -32,8 +32,8 @@ import yaml
 def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 # global rules
 
-# Avoid replacing .hpp with .hdl in the com::sun::star namespace.
-if include.startswith("com/sun/star") and include.endswith(".hpp"):
+# Avoid replacing .hpp with .hdl in the com::sun::star and  ooo::vba 
namespaces.
+if ( include.startswith("com/sun/star") or include.startswith("ooo/vba") ) 
and include.endswith(".hpp"):
 hdl = include.replace(".hpp", ".hdl")
 if hdl in toAdd:
 return True
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-06-17 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 068ea3105873d3500da9591bd40cc627c78eef3e
Author: Gabor Kelemen 
AuthorDate: Sun Jun 16 08:43:01 2019 +0200
Commit: Miklos Vajna 
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 

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()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-06-12 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 206f3c789ae0f7c82de37d04cc3a77627c76fd47
Author: Gabor Kelemen 
AuthorDate: Mon Jun 10 12:28:40 2019 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jun 12 09:18:39 2019 +0200

find-unneeded-includes: don't propose to replace boost/functional/hash.hpp

As seen in vcl/inc/widgetdraw/WidgetDefinition.hxx

Change-Id: Ic56ebd0f1c62b7cad25694b95bf8f91435169db9
Reviewed-on: https://gerrit.libreoffice.org/73753
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 9cce1cad1bdf..3a4e303bbfe6 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -89,6 +89,8 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 return True
 if include == "boost/unordered_map.hpp" and 
"boost/unordered/unordered_map.hpp" in toAdd:
 return True
+if include == "boost/functional/hash.hpp" and 
"boost/container_hash/extensions.hpp" in toAdd:
+return True
 
 # Avoid .hxx to .h proposals in basic css/uno/* API
 unoapi = {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-06-03 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit cef975478815369c5456e4ebc934fb855f358f83
Author: Gabor Kelemen 
AuthorDate: Sat Jun 1 22:21:38 2019 +0200
Commit: Michael Stahl 
CommitDate: Mon Jun 3 11:12:03 2019 +0200

find-unneeded-includes: don't propose to remove ...

..and replace with debug header if multimap is used.

As seen in include/svx/SmartTagMgr.hxx

Change-Id: If239cd6e9471f74f3035c659077ed7515a9df473
Reviewed-on: https://gerrit.libreoffice.org/73367
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index bea49fd7a267..9cce1cad1bdf 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -45,7 +45,7 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 "deque": ("debug/deque", ),
 "forward_list": ("debug/forward_list", ),
 "list": ("debug/list", ),
-"map": ("debug/map.h", ),
+"map": ("debug/map.h", "debug/multimap.h"),
 "set": ("debug/set.h", "debug/multiset.h"),
 "unordered_map": ("debug/unordered_map", ),
 "unordered_set": ("debug/unordered_set", ),
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-05-31 Thread Miklos Vajna (via logerrit)
 bin/find-unneeded-includes |   16 
 1 file changed, 4 insertions(+), 12 deletions(-)

New commits:
commit cee2e455605bbb921e1e32201cc27af973cb775c
Author: Miklos Vajna 
AuthorDate: Fri May 31 09:37:43 2019 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 31 10:51:15 2019 +0200

find-unneded-includes: don't suggest removal of fwd decls

Removal of those have to be decided manually:

1) If it would be removed to be replaced with an include, that's bad.

2) If the fwd decls is truly unused, that's good.

Focus on the mechanical part: removal of includes which are unused, and
where removal doesn't introduce a transitive dependency.

Verified that e.g. writerfilter/source/dmapper/DomainMapper.cxx reports
no removals now, but including e.g. filter/msfilter/rtfutil.hxx in
either writerfilter/source/dmapper/DomainMapper.cxx or
writerfilter/source/dmapper/DomainMapper.hxx triggers a removal hint.

Change-Id: I4c359318113ccba421a125984e23c9778567ea4e
Reviewed-on: https://gerrit.libreoffice.org/73240
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 35784c0083e8..bea49fd7a267 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -186,24 +186,16 @@ def processIWYUOutput(iwyuOutput, moduleRules):
 if inRemove:
 match = re.match("- #include (.*)  // lines (.*)-.*", line)
 if match:
+# Only suggest removals for now. Removing fwd decls is more 
complex: they may be
+# indeed unused or they may removed to be replaced with an 
include. And we want to
+# avoid the later.
 include = unwrapInclude(match.group(1))
 lineno = match.group(2)
 if not ignoreRemoval(include, toAdd, currentFileName, 
moduleRules):
 toRemove.append("%s:%s: %s" % (currentFileName, lineno, 
include))
-continue
-
-match = re.match("- (.*;(?: })*)*  // lines (.*)-.*", line)
-if match:
-fwdDecl = match.group(1)
-if fwdDecl.endswith(";"):
-# Remove trailing semicolon.
-fwdDecl = fwdDecl[:-1]
-lineno = match.group(2)
-if not ignoreRemoval(fwdDecl, toAdd, currentFileName, 
moduleRules):
-toRemove.append("%s:%s: %s" % (currentFileName, lineno, 
fwdDecl))
 
 for remove in sorted(toRemove):
-print("ERROR: %s: remove not needed include / forward declaration" % 
remove)
+print("ERROR: %s: remove not needed include" % remove)
 return len(toRemove)
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-05-31 Thread Miklos Vajna (via logerrit)
 bin/find-unneeded-includes |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 62a9df7473f4213d6ac63faa0a7c0555212bfdee
Author: Miklos Vajna 
AuthorDate: Thu May 30 21:20:25 2019 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 31 08:35:04 2019 +0200

find-unneded-includes: avoid replacing includes with forward-declarations

Verified that e.g. writerfilter/source/dmapper/DomainMapper.cxx used to
trigger advices to replace includes with forward-declarations, and now
that's gone.

See https://gerrit.libreoffice.org/#/c/72972/ for motivation, there are
cases where a forward-declaration depends on the version of the
external, while the include does not, so such changes have to be done
with more care.

Change-Id: I86d396ac743b3fc425868ffda26c0c9e85a00d0e
Reviewed-on: https://gerrit.libreoffice.org/73221
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index aaa2b251434b..35784c0083e8 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -276,7 +276,7 @@ def tidy(compileCommands, paths):
 if assume:
 args = args.replace(assumeAbs, "-x c++ " + pathAbs)
 
-invocation = "include-what-you-use " + args
+invocation = "include-what-you-use -Xiwyu --no_fwd_decls " + args
 task_queue.put((invocation, moduleRules))
 
 task_queue.join()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-05-09 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 2f60d8d3b67508c9fef59971ae725a12463a420d
Author: Gabor Kelemen 
AuthorDate: Tue May 7 00:23:57 2019 +0200
Commit: Michael Stahl 
CommitDate: Thu May 9 11:08:54 2019 +0200

find-unneeded-includes: dont propose to replace cstdint with internal header

As seen in tools/source/misc/cpuid.cxx

Change-Id: Ic596cca387efc1c310f65cbed141946be0742371
Reviewed-on: https://gerrit.libreoffice.org/71885
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 18bcd5d6711d..aaa2b251434b 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -63,7 +63,8 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 "memory": "bits/shared_ptr.h",
 "functional": "bits/std_function.h",
 "cmath": "bits/std_abs.h",
-"ctime": "bits/types/clock_t.h"
+"ctime": "bits/types/clock_t.h",
+"cstdint": "bits/stdint-uintn.h"
 }
 for k, v in bits.items():
 if include == k and v in toAdd:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-05-09 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 2070adb69823bfd596a241c77d1bb3ff106d00ae
Author: Gabor Kelemen 
AuthorDate: Thu May 9 00:50:57 2019 +0200
Commit: Michael Stahl 
CommitDate: Thu May 9 11:08:07 2019 +0200

find-unneeded-includes: filter out boost/unordered_map.hpp

As seen in configmgr/source/modifications.hxx and
configmgr/source/partial.hxx
this replacement is not needed

Change-Id: I6a8d7bc37779f305fccb5d3c7df22fba4a4f73d0
Reviewed-on: https://gerrit.libreoffice.org/72013
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 834a4319cf71..18bcd5d6711d 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -86,6 +86,8 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 return True
 if include == "boost/variant.hpp" and "boost/variant/variant.hpp" in toAdd:
 return True
+if include == "boost/unordered_map.hpp" and 
"boost/unordered/unordered_map.hpp" in toAdd:
+return True
 
 # Avoid .hxx to .h proposals in basic css/uno/* API
 unoapi = {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-05-08 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 91695ecf98c32c6e99b4c6f803a896180ba96a53
Author: Gabor Kelemen 
AuthorDate: Tue May 7 00:19:52 2019 +0200
Commit: Miklos Vajna 
CommitDate: Wed May 8 17:49:32 2019 +0200

find-unneeded-includes: dont propose to replace ctime with internal header

As seen in sw/source/core/inc/layact.hxx

Change-Id: Icc4281cd57b0cd8310a1044f6106691a5d1cd3c4
Reviewed-on: https://gerrit.libreoffice.org/71884
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index bc8e728078a8..834a4319cf71 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -62,7 +62,8 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 "exception": "bits/exception.h",
 "memory": "bits/shared_ptr.h",
 "functional": "bits/std_function.h",
-"cmath": "bits/std_abs.h"
+"cmath": "bits/std_abs.h",
+"ctime": "bits/types/clock_t.h"
 }
 for k, v in bits.items():
 if include == k and v in toAdd:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-05-06 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |1 +
 1 file changed, 1 insertion(+)

New commits:
commit e2c2136dccbf2f4800ca4adc04911b6258a179fe
Author: Gabor Kelemen 
AuthorDate: Mon Apr 29 23:42:09 2019 +0200
Commit: Miklos Vajna 
CommitDate: Mon May 6 16:47:42 2019 +0200

find-unneeded-includes: don't try to replace forward_list with debug header

As seen in tools/source/inet/inetmime.cxx

Change-Id: I3122e07a01020e84b5b75bc46dcaca33560b84bb
Reviewed-on: https://gerrit.libreoffice.org/71558
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index da143cde3249..bc8e728078a8 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -43,6 +43,7 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 "array": ("debug/array", ),
 "bitset": ("debug/bitset", ),
 "deque": ("debug/deque", ),
+"forward_list": ("debug/forward_list", ),
 "list": ("debug/list", ),
 "map": ("debug/map.h", ),
 "set": ("debug/set.h", "debug/multiset.h"),
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-04-09 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit a387c18f726958b7557a9a75a00b60d9fb3281d7
Author: Gabor Kelemen 
AuthorDate: Mon Apr 8 07:44:30 2019 +0200
Commit: Miklos Vajna 
CommitDate: Tue Apr 9 13:49:27 2019 +0200

find-unneeded-includes: fix tuple default items in debugStl

So it gives no false positives as currently seen in e.g.
include/sfx2/charmapcontrol.hxx
include/sfx2/docinsert.hxx

Change-Id: I087a949875df20c4ef25a10c80571bb57334cf80
Reviewed-on: https://gerrit.libreoffice.org/70400
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index e20888b34042..da143cde3249 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -40,15 +40,15 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 
 # Avoid debug STL.
 debugStl = {
-"array": ("debug/array"),
-"bitset": ("debug/bitset"),
-"deque": ("debug/deque"),
-"list": ("debug/list"),
-"map": ("debug/map.h"),
+"array": ("debug/array", ),
+"bitset": ("debug/bitset", ),
+"deque": ("debug/deque", ),
+"list": ("debug/list", ),
+"map": ("debug/map.h", ),
 "set": ("debug/set.h", "debug/multiset.h"),
-"unordered_map": ("debug/unordered_map"),
-"unordered_set": ("debug/unordered_set"),
-"vector": ("debug/vector"),
+"unordered_map": ("debug/unordered_map", ),
+"unordered_set": ("debug/unordered_set", ),
+"vector": ("debug/vector", ),
 }
 for k, values in debugStl.items():
 if include == k:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-04-03 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 93f1c3665fcdc31c36078f179ac37fd69d3ebb00
Author: Gabor Kelemen 
AuthorDate: Sun Mar 31 22:26:42 2019 +0200
Commit: Miklos Vajna 
CommitDate: Wed Apr 3 09:07:59 2019 +0200

find-unneeded-includes: filter out boost/variant.hpp

As seen in include/sfx2/sidebar/Paint.hxx
this replacement is not needed

Change-Id: Idba8014a7effaec69c06891657cbd62546b7ac09
Reviewed-on: https://gerrit.libreoffice.org/70026
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index c902a6172ac9..e20888b34042 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -82,6 +82,8 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 return True
 if include == "boost/intrusive_ptr.hpp" and 
"boost/smart_ptr/intrusive_ptr.hpp" in toAdd:
 return True
+if include == "boost/variant.hpp" and "boost/variant/variant.hpp" in toAdd:
+return True
 
 # Avoid .hxx to .h proposals in basic css/uno/* API
 unoapi = {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-04-02 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |   27 ++-
 1 file changed, 14 insertions(+), 13 deletions(-)

New commits:
commit 80a90a63f1bac43926b26921ef17a30e6698cc40
Author: Gabor Kelemen 
AuthorDate: Sat Mar 30 11:23:13 2019 +0100
Commit: Miklos Vajna 
CommitDate: Tue Apr 2 18:25:46 2019 +0200

find-unneeded-includes: use a better data structure

Turns out plain dictionary requires keys to be unique.
So we need to store values as lists.

This way there are no more false positives for  as in
include/sfx2/linkmgr.hxx and include/sfx2/objsh.hxx

Thanks Miklos for the advice!

Change-Id: Ie2cfb63644d6cbd51171eb95e3bcdd9246343efa
Reviewed-on: https://gerrit.libreoffice.org/69953
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 12b5893baac8..c902a6172ac9 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -40,20 +40,21 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 
 # Avoid debug STL.
 debugStl = {
-"array": "debug/array",
-"bitset": "debug/bitset",
-"deque": "debug/deque",
-"list": "debug/list",
-"map": "debug/map.h",
-"set": "debug/set.h",
-"set": "debug/multiset.h",
-"unordered_map": "debug/unordered_map",
-"unordered_set": "debug/unordered_set",
-"vector": "debug/vector",
+"array": ("debug/array"),
+"bitset": ("debug/bitset"),
+"deque": ("debug/deque"),
+"list": ("debug/list"),
+"map": ("debug/map.h"),
+"set": ("debug/set.h", "debug/multiset.h"),
+"unordered_map": ("debug/unordered_map"),
+"unordered_set": ("debug/unordered_set"),
+"vector": ("debug/vector"),
 }
-for k, v in debugStl.items():
-if include == k and v in toAdd:
-return True
+for k, values in debugStl.items():
+if include == k:
+for value in values:
+if value in toAdd:
+return True
 
 # Avoid proposing to use libstdc++ internal headers.
 bits = {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-03-22 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |1 +
 1 file changed, 1 insertion(+)

New commits:
commit c094442f997054bbfdacc0d9f213dc218453d29c
Author: Gabor Kelemen 
AuthorDate: Mon Mar 18 19:43:06 2019 +0100
Commit: Miklos Vajna 
CommitDate: Fri Mar 22 11:12:07 2019 +0100

find-unneeded-includes: don't try to fw. declare o3tl/span.hxx

As seen in include/sfx2/dispatch.hxx IWYU proposes to replace
o3tl/span.hxx with fw declaration, but that won't compile

Change-Id: If5739075bd91511cf22a39f3382c424c21829053
Reviewed-on: https://gerrit.libreoffice.org/69397
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index aed66a0dabe6..12b5893baac8 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -70,6 +70,7 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 o3tl = {
 "o3tl/typed_flags_set.hxx" : "namespace o3tl { template  
struct typed_flags; }",
 "o3tl/deleter.hxx" : "namespace o3tl { template  struct 
default_delete; }",
+"o3tl/span.hxx" : "namespace o3tl { template  class span; 
}",
 }
 for k, v, in o3tl.items():
 if include == k and v in toAdd:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-03-18 Thread Libreoffice Gerrit user
 bin/find-unneeded-includes |1 +
 1 file changed, 1 insertion(+)

New commits:
commit a11a2d84b09f85d2020c47f3ce42cd9efbff818a
Author: Gabor Kelemen 
AuthorDate: Sat Mar 9 08:23:45 2019 +0100
Commit: Miklos Vajna 
CommitDate: Mon Mar 18 16:45:34 2019 +0100

find-unneeded-includes: don't propose debug/set.h if multiset is used

As seen while cleaning sd/source/ui/dlg/TemplateScanner.cxx

Change-Id: I31a6892b4419947a411b2c4100281d4cf7c50f09
Reviewed-on: https://gerrit.libreoffice.org/68969
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 2bcf48604552..aed66a0dabe6 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -46,6 +46,7 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 "list": "debug/list",
 "map": "debug/map.h",
 "set": "debug/set.h",
+"set": "debug/multiset.h",
 "unordered_map": "debug/unordered_map",
 "unordered_set": "debug/unordered_set",
 "vector": "debug/vector",
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-02-11 Thread Libreoffice Gerrit user
 bin/find-unneeded-includes |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 6ff712db7f581c66b50b1b50506ae0a5c3089218
Author: Gabor Kelemen 
AuthorDate: Fri Feb 8 23:40:01 2019 +0100
Commit: Miklos Vajna 
CommitDate: Mon Feb 11 09:41:35 2019 +0100

find-unneeded-includes: Skip headers used only for compile test

As proposed in https://gerrit.libreoffice.org/#/c/67473/

Change-Id: Ibbc2d32dde2363502915cfeb036fa6f4ba568932
Reviewed-on: https://gerrit.libreoffice.org/67574
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index e955ae7d33e4..2bcf48604552 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -114,6 +114,11 @@ def ignoreRemoval(include, toAdd, absFileName, 
moduleRules):
 
 fileName = os.path.relpath(absFileName, os.getcwd())
 
+# Skip headers used only for compile test
+if fileName == "cppu/qa/cppumaker/test_cppumaker.cxx":
+if include.endswith(".hpp"):
+return True
+
 # yaml rules
 
 if "blacklist" in moduleRules.keys():
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: bin/find-unneeded-includes include/comphelper include/IwyuFilter_include.yaml include/vcl sc/IwyuFilter_sc.yaml sc/source sd/IwyuFilter_sd.yaml sd/source sw/IwyuFilter_

2019-01-24 Thread Libreoffice Gerrit user
 bin/find-unneeded-includes  |1 +
 include/IwyuFilter_include.yaml |3 ---
 include/comphelper/unique_disposing_ptr.hxx |3 +--
 include/vcl/dockwin.hxx |3 +--
 sc/IwyuFilter_sc.yaml   |6 --
 sc/source/ui/inc/docsh.hxx  |2 +-
 sc/source/ui/inc/gridwin.hxx|2 +-
 sc/source/ui/inc/output.hxx |2 +-
 sc/source/ui/inc/tabvwsh.hxx|3 +--
 sd/IwyuFilter_sd.yaml   |   11 ---
 sd/source/ui/inc/ViewShell.hxx  |3 +--
 sd/source/ui/inc/ViewShellImplementation.hxx|3 +--
 sd/source/ui/inc/tools/SdGlobalResourceContainer.hxx|2 +-
 sd/source/ui/slidesorter/inc/controller/SlsAnimator.hxx |2 +-
 sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx   |2 +-
 sw/IwyuFilter_sw.yaml   |9 -
 16 files changed, 12 insertions(+), 45 deletions(-)

New commits:
commit 38aa12075432cc6b4e6de60de84c04c1f480768d
Author: Gabor Kelemen 
AuthorDate: Tue Jan 22 18:14:35 2019 +0100
Commit: Miklos Vajna 
CommitDate: Thu Jan 24 11:28:52 2019 +0100

find-unneeeded-includes: don't propose to replace o3tl/deleter.hxx

As seen while analysing
sw/source/core/inc/DocumentChartDataProviderManager.hxx
replacing o3tl/deleter.hxx with fw declaration does not work,
it compiles only when it is transitively included.

This also removes mistakenly added fw declarations and
now unnecessary IwyuFilter blacklist items

Change-Id: I2d631f0693dbfd0bb0e62218a525113042c9a907
Reviewed-on: https://gerrit.libreoffice.org/66750
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 948e12ccd8c7..e955ae7d33e4 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -68,6 +68,7 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 # Avoid proposing o3tl fw declaration
 o3tl = {
 "o3tl/typed_flags_set.hxx" : "namespace o3tl { template  
struct typed_flags; }",
+"o3tl/deleter.hxx" : "namespace o3tl { template  struct 
default_delete; }",
 }
 for k, v, in o3tl.items():
 if include == k and v in toAdd:
diff --git a/include/IwyuFilter_include.yaml b/include/IwyuFilter_include.yaml
index d4f652f42911..5da7e0550fc0 100644
--- a/include/IwyuFilter_include.yaml
+++ b/include/IwyuFilter_include.yaml
@@ -255,9 +255,6 @@ blacklist:
 include/vcl/devicecoordinate.hxx:
 # Needed for #if configure switch
 - basegfx/point/b2ipoint.hxx
-include/vcl/edit.hxx:
-# Needed for template
-- o3tl/deleter.hxx
 include/vcl/event.hxx:
 # Needed for enum type 
 - vcl/window.hxx
diff --git a/include/comphelper/unique_disposing_ptr.hxx 
b/include/comphelper/unique_disposing_ptr.hxx
index e72b039e6606..51a9710f606d 100644
--- a/include/comphelper/unique_disposing_ptr.hxx
+++ b/include/comphelper/unique_disposing_ptr.hxx
@@ -17,10 +17,9 @@
 #include 
 #include 
 
+#include 
 #include 
 
-namespace o3tl { template  struct default_delete; }
-
 namespace comphelper
 {
 //Similar to std::unique_ptr, except additionally releases the ptr on 
XComponent::disposing and/or XTerminateListener::notifyTermination if supported
diff --git a/include/vcl/dockwin.hxx b/include/vcl/dockwin.hxx
index 7bbbc9e49d79..5d88e9de65f1 100644
--- a/include/vcl/dockwin.hxx
+++ b/include/vcl/dockwin.hxx
@@ -21,13 +21,12 @@
 #define INCLUDED_VCL_DOCKWIN_HXX
 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 
-namespace o3tl { template  struct default_delete; }
-
 // data to be sent with docking events
 struct DockingData
 {
diff --git a/sc/IwyuFilter_sc.yaml b/sc/IwyuFilter_sc.yaml
index 571bcd22258a..f5ef18ecba0f 100644
--- a/sc/IwyuFilter_sc.yaml
+++ b/sc/IwyuFilter_sc.yaml
@@ -118,9 +118,6 @@ blacklist:
 # base class has to be a complete type
 - com/sun/star/frame/XDispatchProviderInterceptor.hpp
 - com/sun/star/view/XSelectionChangeListener.hpp
-sc/inc/document.hxx:
-# std::unique_ptr deleter type has to be complete
-- o3tl/deleter.hxx
 sc/inc/docuno.hxx:
 # base class has to be a complete type
 - com/sun/star/container/XEnumerationAccess.hpp
@@ -479,9 +476,6 @@ blacklist:
 sc/source/ui/inc/ExponentialSmoothingDialog.hxx:
 # base class has to be a complete type
 - viewdata.hxx
-sc/source/ui/inc/impex.hxx:
-# Needed for template
-- o3tl/deleter.hxx
 sc/source/ui/inc/MatrixComparisonGenerator.hxx:
 # base class has to be a complete type
 - viewdata.hxx
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index b6c523958c5f..e68a6d5bc560 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ 

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

2019-01-17 Thread Libreoffice Gerrit user
 bin/find-unneeded-includes |1 +
 1 file changed, 1 insertion(+)

New commits:
commit e9a9fce77822d4a79eab18930144941a10b0029a
Author: Gabor Kelemen 
AuthorDate: Sun Jan 13 12:39:22 2019 +0100
Commit: Miklos Vajna 
CommitDate: Thu Jan 17 09:24:49 2019 +0100

find-unneeded-includes: don't propose debug/bitset either

Found while checking include/vcl/fontcapabilities.hxx

Change-Id: Ib598978672d08d3cae7bf6f96d1b874ca13fcb5f
Reviewed-on: https://gerrit.libreoffice.org/66254
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 28a5471eb0df..948e12ccd8c7 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -41,6 +41,7 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 # Avoid debug STL.
 debugStl = {
 "array": "debug/array",
+"bitset": "debug/bitset",
 "deque": "debug/deque",
 "list": "debug/list",
 "map": "debug/map.h",
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-01-11 Thread Libreoffice Gerrit user
 bin/find-unneeded-includes |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 25f2fd3aa45dc47356b7074151e8e5b6ae750e92
Author: Gabor Kelemen 
AuthorDate: Mon Jan 7 08:41:22 2019 +0100
Commit: Michael Stahl 
CommitDate: Fri Jan 11 18:30:50 2019 +0100

find-unneeded-includes: don't propose cmath -> bits/std_abs.h

Found while cleaning sd/source/ui/sidebar/PageMarginUtils.hxx

Change-Id: Iccbd45d9c53dd6561a6161f9949d6fb9d8539514
Reviewed-on: https://gerrit.libreoffice.org/65923
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index b7da51714bb0..28a5471eb0df 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -58,6 +58,7 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 "exception": "bits/exception.h",
 "memory": "bits/shared_ptr.h",
 "functional": "bits/std_function.h",
+"cmath": "bits/std_abs.h"
 }
 for k, v in bits.items():
 if include == k and v in toAdd:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: bin/find-unneeded-includes include/IwyuFilter_include.yaml include/svl include/unotools include/vcl sc/inc sc/IwyuFilter_sc.yaml sc/source sd/IwyuFilter_sd.yaml sw/Iwyu

2018-12-11 Thread Libreoffice Gerrit user
 bin/find-unneeded-includes|8 
 include/IwyuFilter_include.yaml   |   64 --
 include/svl/languageoptions.hxx   |2 -
 include/svl/zforlist.hxx  |2 -
 include/unotools/configitem.hxx   |3 -
 include/unotools/fontcfg.hxx  |2 -
 include/vcl/GraphicObject.hxx |2 -
 include/vcl/decoview.hxx  |3 -
 include/vcl/floatwin.hxx  |3 -
 include/vcl/graphicfilter.hxx |2 -
 sc/IwyuFilter_sc.yaml |   15 
 sc/inc/compiler.hxx   |3 -
 sc/source/filter/inc/colrowst.hxx |3 -
 sc/source/filter/inc/xelink.hxx   |3 -
 sc/source/ui/inc/csvcontrol.hxx   |3 -
 sd/IwyuFilter_sd.yaml |3 -
 sw/IwyuFilter_sw.yaml |   24 --
 17 files changed, 20 insertions(+), 125 deletions(-)

New commits:
commit 28726190d52b0729339d7257b84b449fafa4c34e
Author: Gabor Kelemen 
AuthorDate: Thu Dec 6 00:17:03 2018 +0100
Commit: Miklos Vajna 
CommitDate: Tue Dec 11 09:29:41 2018 +0100

find-unneeded-includes: Avoid proposing o3tl fw declaration

This does not really work: even when it seems to, it compiles only
because of transitive includes

- Filter o3tl/typed_flags_set.hxx in f-u-u
- Remove already added fw declarations from hxx files and
  include full header just in case
- Remove now unnecessary blacklist entries

Change-Id: Ie0de6667af697095a623b435806449e7e28a6004
Reviewed-on: https://gerrit.libreoffice.org/64659
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index ecc29fe32919..b7da51714bb0 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -63,6 +63,14 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 if include == k and v in toAdd:
 return True
 
+# Avoid proposing o3tl fw declaration
+o3tl = {
+"o3tl/typed_flags_set.hxx" : "namespace o3tl { template  
struct typed_flags; }",
+}
+for k, v, in o3tl.items():
+if include == k and v in toAdd:
+return True
+
 # Follow boost documentation.
 if include == "boost/optional.hpp" and "boost/optional/optional.hpp" in 
toAdd:
 return True
diff --git a/include/IwyuFilter_include.yaml b/include/IwyuFilter_include.yaml
index 0615d343c09d..f2f6169f8a69 100644
--- a/include/IwyuFilter_include.yaml
+++ b/include/IwyuFilter_include.yaml
@@ -40,12 +40,6 @@ blacklist:
 include/rtl/math.hxx:
 # TODO MSVC does not compile basegfx/numeric/ftools.hxx when this is 
replaced
 - math.h
-include/registry/regtype.h:
-# Needed for template
-- o3tl/typed_flags_set.hxx
-include/registry/types.hxx:
-# Needed for template
-- o3tl/typed_flags_set.hxx
 include/sfx2/toolbarids.hxx:
 # needed for enum definition
 - sal/types.h
@@ -103,9 +97,6 @@ blacklist:
 - cppuhelper/typeprovider.hxx
 - cppuhelper/supportsservice.hxx
 - cppuhelper/factory.hxx
-include/ucbhelper/simpleinteractionrequest.hxx:
-# Needed for template
-- o3tl/typed_flags_set.hxx
 include/comphelper/accessiblekeybindinghelper.hxx:
 # base class has to be a complete type
 - com/sun/star/accessibility/XAccessibleKeyBinding.hpp
@@ -138,13 +129,8 @@ blacklist:
 # base class has to be a complete type
 - com/sun/star/lang/XSingleServiceFactory.hpp
 include/comphelper/configurationhelper.hxx:
-# Needed for template
-- o3tl/typed_flags_set.hxx
 # Needed for implicit destructor
 - com/sun/star/uno/Any.hxx
-include/comphelper/documentconstants.hxx:
-   # Needed for template
-- o3tl/typed_flags_set.hxx
 include/comphelper/docpasswordrequest.hxx:
 # base class has to be a complete type
 - com/sun/star/task/XInteractionRequest.hpp
@@ -201,17 +187,12 @@ blacklist:
 include/comphelper/uno3.hxx:
 # Needed for macro
 - comphelper/sequence.hxx
-include/basegfx/polygon/b2dpolygontools.hxx:
-# Needed for template
-- o3tl/typed_flags_set.hxx
 include/basegfx/utils/unopolypolygon.hxx:
 # base class has to be a complete type
 - com/sun/star/lang/XServiceInfo.hpp
 - com/sun/star/rendering/XBezierPolyPolygon2D.hpp
 - com/sun/star/rendering/XLinePolyPolygon2D.hpp
 include/sot/exchange.hxx:
-# Needed for template
-- o3tl/typed_flags_set.hxx
 # Used in a macro #define
 - com/sun/star/datatransfer/dnd/DNDConstants.hpp
 include/tools/debug.hxx:
@@ -222,21 +203,9 @@ blacklist:
 - com/sun/star/lang/IllegalArgumentException.hpp
 - com/sun/star/uno/RuntimeException.hpp
 - rtl/ustring.hxx
-include/tools/fontenum.hxx:
-# Needed for template
-- o3tl/typed_flags_set.hxx
 include/tools/svlibrary.h:
 # Used behind #ifndef
 - osl/module.h
-include/tools/poly.hxx:
-# Needed for template
-- o3tl/typed_flags_set.hxx
-   

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

2018-11-13 Thread Libreoffice Gerrit user
 bin/find-unneeded-includes |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ae245cdde94432e01f2a4cd7b695c766ae6f569d
Author: Gabor Kelemen 
AuthorDate: Thu Nov 8 23:37:33 2018 +0100
Commit: Miklos Vajna 
CommitDate: Tue Nov 13 09:03:45 2018 +0100

find-unneeded-includes: sort the output

Default IWYU output is sorted alphabetically by filename

A more friendly way to present f-u-i information would be
to sort by line numbers: so that a developer can go through the removal
proposals in the editor top to bottom, without too much cursor positioning
in the list of 100 header lines to delete 20 of them.

The result is not perfect, because numbers in text are not naturally sorted:
line 205 will be listed between 20 and 21; but that's a really rare occasion

Change-Id: I8011321a299a76f5a32469a9d77eb8fcc4521034
Reviewed-on: https://gerrit.libreoffice.org/63144
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index c949c887d905..ecc29fe32919 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -176,7 +176,7 @@ def processIWYUOutput(iwyuOutput, moduleRules):
 if not ignoreRemoval(fwdDecl, toAdd, currentFileName, 
moduleRules):
 toRemove.append("%s:%s: %s" % (currentFileName, lineno, 
fwdDecl))
 
-for remove in toRemove:
+for remove in sorted(toRemove):
 print("ERROR: %s: remove not needed include / forward declaration" % 
remove)
 return len(toRemove)
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: bin/find-unneeded-includes sw/inc sw/IwyuFilter_sw.yaml sw/source

2018-10-25 Thread Libreoffice Gerrit user
 bin/find-unneeded-includes|3 +++
 sw/IwyuFilter_sw.yaml |   12 
 sw/inc/calbck.hxx |5 +++--
 sw/inc/cellatr.hxx|1 +
 sw/inc/charfmt.hxx|1 +
 sw/inc/dbgoutsw.hxx   |1 -
 sw/inc/dbmgr.hxx  |3 ---
 sw/inc/dcontact.hxx   |1 -
 sw/inc/docary.hxx |1 -
 sw/inc/docsh.hxx  |4 ++--
 sw/inc/fldbas.hxx |1 +
 sw/inc/fmtcol.hxx |1 +
 sw/inc/frmfmt.hxx |1 +
 sw/inc/hhcwrp.hxx |1 -
 sw/inc/ndgrf.hxx  |1 -
 sw/inc/swmodule.hxx   |2 +-
 sw/inc/txtftn.hxx |3 +--
 sw/source/uibase/app/docsh.cxx|1 +
 sw/source/uibase/app/docsh2.cxx   |3 ++-
 sw/source/uibase/app/swmodule.cxx |1 +
 20 files changed, 31 insertions(+), 16 deletions(-)

New commits:
commit 5af524251642a43747f56c1f24c41222fd9ac69f
Author: Miklos Vajna 
AuthorDate: Wed Oct 24 21:19:37 2018 +0200
Commit: Miklos Vajna 
CommitDate: Thu Oct 25 11:22:21 2018 +0200

sw: fix some IWYU warnings

Change-Id: Ic7e6aa31e5c6d210101da7223a294092ab5b7481
Reviewed-on: https://gerrit.libreoffice.org/62334
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 5d043f0da1a9..c949c887d905 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -169,6 +169,9 @@ def processIWYUOutput(iwyuOutput, moduleRules):
 match = re.match("- (.*;(?: })*)*  // lines (.*)-.*", line)
 if match:
 fwdDecl = match.group(1)
+if fwdDecl.endswith(";"):
+# Remove trailing semicolon.
+fwdDecl = fwdDecl[:-1]
 lineno = match.group(2)
 if not ignoreRemoval(fwdDecl, toAdd, currentFileName, 
moduleRules):
 toRemove.append("%s:%s: %s" % (currentFileName, lineno, 
fwdDecl))
diff --git a/sw/IwyuFilter_sw.yaml b/sw/IwyuFilter_sw.yaml
index cd278aba47b6..3597e35b8f07 100644
--- a/sw/IwyuFilter_sw.yaml
+++ b/sw/IwyuFilter_sw.yaml
@@ -17,6 +17,8 @@ blacklist:
 - numrule.hxx
 # tox.hxx brings in SwTOXType, which is needed by SwTOXTypes, as 
SwVectorModifyBase's dtor wants to delete it
 - tox.hxx
+# section.hxx brings in SwSectionFormat, which is needed by 
SwSectionFormats, as SwFormatsModifyBase's type param has to be complete
+- section.hxx
 sw/inc/docfac.hxx:
 # Complete type is needed by rtl::Reference.
 - doc.hxx
@@ -36,6 +38,8 @@ blacklist:
 - o3tl/typed_flags_set.hxx
 sw/inc/doc.hxx:
 - o3tl/deleter.hxx
+sw/inc/docsh.hxx:
+- o3tl/deleter.hxx
 sw/inc/list.hxx:
 - o3tl/deleter.hxx
 sw/inc/IDocumentLinksAdministration.hxx:
@@ -56,6 +60,8 @@ blacklist:
 - o3tl/typed_flags_set.hxx
 sw/inc/undobj.hxx:
 - o3tl/typed_flags_set.hxx
+sw/inc/itabenum.hxx:
+- o3tl/typed_flags_set.hxx
 sw/inc/unosett.hxx:
 # sw::UnoImplPtr typedef
 - unobaseclass.hxx
@@ -240,6 +246,7 @@ blacklist:
 - class SwUpdateAttr
 - class SfxBoolItem
 - class SvxCharSetColorItem
+- class SvxColorItem
 # used in extern declaration
 - struct SfxItemInfo
 sw/inc/textboxhelper.hxx:
@@ -252,3 +259,8 @@ blacklist:
 # complete type is wanted
 - com/sun/star/awt/XBitmap.hpp
 - com/sun/star/text/XTextColumns.hpp
+sw/inc/pagepreviewlayout.hxx:
+- vector
+sw/inc/shellio.hxx:
+- o3tl/deleter.hxx
+- o3tl/typed_flags_set.hxx
diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 08f9e254829e..d470ea12a9ac 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -20,17 +20,18 @@
 #ifndef INCLUDED_SW_INC_CALBCK_HXX
 #define INCLUDED_SW_INC_CALBCK_HXX
 
+#include 
+
 #include 
 #include 
-#include 
 #include "swdllapi.h"
 #include "ring.hxx"
-#include "hintids.hxx"
 #include 
 #include 
 #include 
 
 class SwModify;
+class SfxPoolItem;
 
 /*
 SwModify and SwClient cooperate in propagating attribute changes.
diff --git a/sw/inc/cellatr.hxx b/sw/inc/cellatr.hxx
index 62a5716c3af0..3b9de189478f 100644
--- a/sw/inc/cellatr.hxx
+++ b/sw/inc/cellatr.hxx
@@ -24,6 +24,7 @@
 #include 
 #include "swdllapi.h"
 #include "format.hxx"
+#include "hintids.hxx"
 #include "cellfml.hxx"
 
 /** The number formatter's default locale's @ Text format.
diff --git a/sw/inc/charfmt.hxx b/sw/inc/charfmt.hxx
index b84d31c780bc..b372de271437 100644
--- a/sw/inc/charfmt.hxx
+++ b/sw/inc/charfmt.hxx
@@ -20,6 +20,7 @@
 #define INCLUDED_SW_INC_CHARFMT_HXX
 
 #include "format.hxx"
+#include "hintids.hxx"
 
 class SW_DLLPUBLIC SwCharFormat : public SwFormat
 {
diff --git a/sw/inc/dbgoutsw.hxx b/sw/inc/dbgoutsw.hxx
index b32f410cc36d..28551b180666 100644
--- a/sw/inc/dbgoutsw.hxx
+++ b/sw/inc/dbgoutsw.hxx
@@ -41,7 +41,6 @@ class SwUndo;
 class SwRect;

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

2018-10-13 Thread Libreoffice Gerrit user
 bin/find-unneeded-includes |   11 +++
 1 file changed, 11 insertions(+)

New commits:
commit e9e347e9d7b36a32d44b5f0b53d8f9fe47567c16
Author: Gabor Kelemen 
AuthorDate: Sat Oct 13 16:52:36 2018 +0200
Commit: Miklos Vajna 
CommitDate: Sat Oct 13 18:41:02 2018 +0200

find-unneeded-includes: do not propose css/uno .hxx to .h replacements

Better to not replace stable API headers with implementation details

Change-Id: I66c7a237b1df13b7aa2523eba87d45d123621a95
Reviewed-on: https://gerrit.libreoffice.org/61742
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 7f221e646e14..5d043f0da1a9 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -69,6 +69,17 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 if include == "boost/intrusive_ptr.hpp" and 
"boost/smart_ptr/intrusive_ptr.hpp" in toAdd:
 return True
 
+# Avoid .hxx to .h proposals in basic css/uno/* API
+unoapi = {
+"com/sun/star/uno/Any.hxx": "com/sun/star/uno/Any.h",
+"com/sun/star/uno/Reference.hxx": "com/sun/star/uno/Reference.h",
+"com/sun/star/uno/Sequence.hxx": "com/sun/star/uno/Sequence.h",
+"com/sun/star/uno/Type.hxx": "com/sun/star/uno/Type.h"
+}
+for k, v in unoapi.items():
+if include == k and v in toAdd:
+return True
+
 # 3rd-party, non-self-contained headers.
 if include == "libepubgen/libepubgen.h" and 
"libepubgen/libepubgen-decls.h" in toAdd:
 return True
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-10-08 Thread Libreoffice Gerrit user
 bin/find-unneeded-includes |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9b686537f59a63bad05a0cfe7fc5f1096bb7a7c1
Author: Gabor Kelemen 
AuthorDate: Sat Oct 6 23:25:46 2018 +0200
Commit: Miklos Vajna 
CommitDate: Mon Oct 8 12:15:23 2018 +0200

find-unneeded-includes: warn about fw decls in namespaces too

This regex parsed unneeded fw declarations reported by IWYU in the form of:
class foo;
But not ones inside namespaces, e.g.:
namespace foo { class bar; }
namespace com { namespace sun { namespace star { namespace foo { class bar; 
} } } }

Change-Id: Ie2962b9fb1cf9382e8da45903f3716d0311dd58e
Reviewed-on: https://gerrit.libreoffice.org/61485
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 4196640e5d2b..7f221e646e14 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -155,7 +155,7 @@ def processIWYUOutput(iwyuOutput, moduleRules):
 toRemove.append("%s:%s: %s" % (currentFileName, lineno, 
include))
 continue
 
-match = re.match("- (.*);  // lines (.*)-.*", line)
+match = re.match("- (.*;(?: })*)*  // lines (.*)-.*", line)
 if match:
 fwdDecl = match.group(1)
 lineno = match.group(2)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-09-21 Thread Libreoffice Gerrit user
 bin/find-unneeded-includes |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 6ed8e3258da439172e97a1404ef9e4d6453556a1
Author: Gabor Kelemen 
AuthorDate: Thu Sep 20 20:41:20 2018 +0200
Commit: Miklos Vajna 
CommitDate: Fri Sep 21 09:29:07 2018 +0200

find-unneeded-includes: Don't propose functional -> bits/std_function.h

As seen for include/comphelper/doublecheckedinit.hxx - won't compile anyways

Change-Id: I3a0d5e115ecfc61ae90c6e843ecf4f0213b76e82
Reviewed-on: https://gerrit.libreoffice.org/60838
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index e912a9155c82..4196640e5d2b 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -57,6 +57,7 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 bits = {
 "exception": "bits/exception.h",
 "memory": "bits/shared_ptr.h",
+"functional": "bits/std_function.h",
 }
 for k, v in bits.items():
 if include == k and v in toAdd:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: bin/find-unneeded-includes chart2/IwyuFilter_chart2.yaml sc/IwyuFilter_sc.yaml sd/IwyuFilter_sd.yaml

2018-07-05 Thread Gabor Kelemen
 bin/find-unneeded-includes|9 +
 chart2/IwyuFilter_chart2.yaml |3 ---
 sc/IwyuFilter_sc.yaml |9 -
 sd/IwyuFilter_sd.yaml |6 +-
 4 files changed, 10 insertions(+), 17 deletions(-)

New commits:
commit 450482220a14a5e083f11bfa1c9561994dc91ec8
Author: Gabor Kelemen 
Date:   Thu Jul 5 00:41:53 2018 +0200

find-unneeded-includes: stop proposing internal libstdc++ headers

They wouldn't really compile anyways and only cause unnecessary
blacklist entries.
Some '- memory' entries can already be removed from the blacklists.

Change-Id: Iab53d5a57121f61abe935e712dc23a55390235bf
Reviewed-on: https://gerrit.libreoffice.org/56979
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index b4a2a89e0377..2e3d15f2230c 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -53,6 +53,15 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules):
 if include == k and v in toAdd:
 return True
 
+# Avoid proposing to use libstdc++ internal headers.
+bits = {
+"exception": "bits/exception.h",
+"memory": "bits/shared_ptr.h",
+}
+for k, v in bits.items():
+if include == k and v in toAdd:
+return True
+
 # Follow boost documentation.
 if include == "boost/optional.hpp" and "boost/optional/optional.hpp" in 
toAdd:
 return True
diff --git a/chart2/IwyuFilter_chart2.yaml b/chart2/IwyuFilter_chart2.yaml
index 92a202f08e4a..f95dad4807b7 100644
--- a/chart2/IwyuFilter_chart2.yaml
+++ b/chart2/IwyuFilter_chart2.yaml
@@ -38,9 +38,6 @@ blacklist:
 - com/sun/star/lang/XUnoTunnel.hpp
 - com/sun/star/qa/XDumper.hpp
 - com/sun/star/util/XModifyListener.hpp
-chart2/source/inc/chartview/ExplicitValueProvider.hxx:
-# base class has to be a complete type
-- memory
 chart2/source/inc/AxisHelper.hxx:
 # base class has to be a complete type
 - com/sun/star/chart2/ScaleData.hpp
diff --git a/sc/IwyuFilter_sc.yaml b/sc/IwyuFilter_sc.yaml
index 7941a28d7640..951f833a310a 100644
--- a/sc/IwyuFilter_sc.yaml
+++ b/sc/IwyuFilter_sc.yaml
@@ -38,9 +38,6 @@ blacklist:
 sc/inc/autoform.hxx:
 # contains macro definitions
 - scitems.hxx
-sc/inc/calcconfig.hxx:
-# needed for std::shared_ptr
-- memory
 sc/inc/chartuno.hxx:
 # base class has to be a complete type
 - com/sun/star/container/XEnumerationAccess.hpp
@@ -253,9 +250,6 @@ blacklist:
 sc/inc/scmatrix.hxx:
 # base class has to be a complete type
 - svl/sharedstringpool.hxx
-sc/inc/simplerangelist.hxx:
-# base class has to be a complete type
-- memory
 sc/inc/spellcheckcontext.hxx:
 # base class has to be a complete type
 - editeng/misspellrange.hxx
@@ -298,9 +292,6 @@ blacklist:
 - com/sun/star/lang/XServiceInfo.hpp
 - com/sun/star/lang/XUnoTunnel.hpp
 - com/sun/star/text/XTextFieldsSupplier.hpp
-sc/inc/token.hxx:
-# needed for std::shared_ptr
-- memory
 sc/inc/tokenuno.hxx:
 # base class has to be a complete type
 - com/sun/star/beans/XPropertySet.hpp
diff --git a/sd/IwyuFilter_sd.yaml b/sd/IwyuFilter_sd.yaml
index 9729c1b65af8..963b62da4088 100644
--- a/sd/IwyuFilter_sd.yaml
+++ b/sd/IwyuFilter_sd.yaml
@@ -70,7 +70,6 @@ blacklist:
 sd/inc/TransitionPreset.hxx:
 # base class has to be a complete type
 - com/sun/star/lang/XMultiServiceFactory.hpp
-- memory
 sd/inc/undoanim.hxx:
 # base class has to be a complete type
 - com/sun/star/animations/XAnimationNode.hpp
@@ -80,9 +79,6 @@ blacklist:
 sd/source/filter/eppt/eppt.hxx:
 # base class has to be a complete type
 - escherex.hxx
-sd/source/filter/eppt/pptexanimations.hxx:
-# base class has to be a complete type
-- memory
 sd/source/ui/inc/AccessibleDocumentViewBase.hxx:
 # base class has to be a complete type
 - com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp
@@ -124,4 +120,4 @@ blacklist:
 - sfx2/sfxbasecontroller.hxx
 sd/source/ui/inc/fupage.hxx:
 # base class has to be a complete type
-- vcl/weld.hxx
\ No newline at end of file
+- vcl/weld.hxx
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-05-23 Thread Gabor Kelemen
 bin/find-unneeded-includes |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9b2136fb7124934a8869a4d72cf7bf86db503935
Author: Gabor Kelemen 
Date:   Sat May 19 07:34:51 2018 +0200

find-unneeded-includes: Make the output user friendlier

This way it's easy to copy-paste the problematic command
for further investigation of IWYUs proposals

Change-Id: I9e7403f0f05e64e562441941f00127a62bf15265
Reviewed-on: https://gerrit.libreoffice.org/54560
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 7cc933ff6c9a..b4a2a89e0377 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -165,7 +165,7 @@ def run_tool(task_queue, failed_files):
 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:
-print("ERROR: '" + invocation + "' found unused includes.")
+print("ERROR: The following command found unused includes:\n" 
+ invocation)
 failed_files.append(invocation)
 task_queue.task_done()
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: bin/find-unneeded-includes include/sfx2 sw/inc sw/IwyuFilter_sw.yaml sw/source

2018-04-25 Thread Miklos Vajna
 bin/find-unneeded-includes  |9 +
 include/sfx2/viewsh.hxx |1 
 sw/IwyuFilter_sw.yaml   |  150 
 sw/inc/AnnotationWin.hxx|1 
 sw/inc/EnhancedPDFExportHelper.hxx  |2 
 sw/inc/IDocumentChartDataProviderAccess.hxx |4 
 sw/inc/IDocumentFieldsAccess.hxx|1 
 sw/inc/IDocumentRedlineAccess.hxx   |2 
 sw/inc/IGrammarContact.hxx  |1 
 sw/inc/IMark.hxx|2 
 sw/inc/PostItMgr.hxx|5 
 sw/inc/SwNodeNum.hxx|1 
 sw/inc/SwStyleNameMapper.hxx|2 
 sw/inc/ToxTextGenerator.hxx |3 
 sw/inc/acmplwrd.hxx |1 
 sw/inc/anchoredobject.hxx   |1 
 sw/inc/authfld.hxx  |1 
 sw/inc/calbck.hxx   |8 -
 sw/inc/cellatr.hxx  |2 
 sw/inc/chpfld.hxx   |1 
 sw/inc/crsrsh.hxx   |   13 --
 sw/inc/dcontact.hxx |6 -
 sw/inc/dobjfac.hxx  |2 
 sw/inc/docary.hxx   |8 -
 sw/inc/drawdoc.hxx  |1 
 sw/inc/fmtcol.hxx   |1 
 sw/inc/fmthdft.hxx  |1 
 sw/inc/fmtmeta.hxx  |3 
 sw/inc/fmtpdsc.hxx  |4 
 sw/inc/format.hxx   |1 
 sw/inc/frmfmt.hxx   |3 
 sw/inc/gotodlg.hxx  |1 
 sw/inc/hintids.hxx  |3 
 sw/inc/hints.hxx|2 
 sw/inc/mdiexp.hxx   |1 
 sw/inc/modcfg.hxx   |1 
 sw/inc/ndarr.hxx|2 
 sw/inc/ndindex.hxx  |3 
 sw/inc/ndole.hxx|2 
 sw/inc/ndtxt.hxx|4 
 sw/inc/numrule.hxx  |2 
 sw/inc/pam.hxx  |2 
 sw/inc/paratr.hxx   |1 
 sw/inc/postithelper.hxx |1 
 sw/inc/printdata.hxx|5 
 sw/inc/redline.hxx  |1 
 sw/inc/swatrset.hxx |4 
 sw/inc/swtable.hxx  |4 
 sw/inc/swtblfmt.hxx |2 
 sw/inc/tblsel.hxx   |3 
 sw/inc/undobj.hxx   |1 
 sw/inc/unochart.hxx |2 
 sw/inc/unoframe.hxx |3 
 sw/inc/unoparagraph.hxx |1 
 sw/inc/unosett.hxx  |2 
 sw/inc/unosrch.hxx  |1 
 sw/inc/unotbl.hxx   |1 
 sw/inc/unotext.hxx  |5 
 sw/inc/unotxdoc.hxx |8 -
 sw/inc/view.hxx |1 
 sw/inc/viewsh.hxx   |2 
 sw/inc/viscrs.hxx   |2 
 sw/source/uibase/inc/inpdlg.hxx |1 
 sw/source/uibase/uiview/viewport.cxx|1 
 64 files changed, 182 insertions(+), 134 deletions(-)

New commits:
commit 90c91b824c2b362b43bdd2f8d8d647867d8fe612
Author: Miklos Vajna 
Date:   Tue Apr 24 21:55:39 2018 +0200

sw: fix remaining IWYU warnings in inc/*.hxx

Also check for not needed forward declarations.

Change-Id: I92759f3f40d9458fd192665b39b87a78d8b97e5a
Reviewed-on: https://gerrit.libreoffice.org/53418
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index de91a3570231..7cc933ff6c9a 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -145,8 +145,15 @@ def processIWYUOutput(iwyuOutput, moduleRules):
 toRemove.append("%s:%s: %s" % (currentFileName, lineno, 
include))
 continue
 
+match = re.match("- (.*);  // lines (.*)-.*", line)
+if match:
+fwdDecl = match.group(1)
+lineno = match.group(2)
+if not ignoreRemoval(fwdDecl, toAdd, currentFileName, 
moduleRules):
+toRemove.append("%s:%s: %s" % (currentFileName, lineno, 
fwdDecl))
+
 for remove in toRemove:
-print("ERROR: %s: remove not needed include" % remove)
+print("ERROR: %s: remove not needed include / forward declaration" % 
remove)
 return len(toRemove)
 
 
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index 8f72837bbdaa..37f051a8167b 100644
--- 

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

2018-04-23 Thread Andrea Gelmini
 bin/find-unneeded-includes |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6e3db40b8bccc13b106b63de31de1b8d7b9348cb
Author: Andrea Gelmini 
Date:   Sat Apr 7 15:20:11 2018 +0200

Fix typo in variable

Change-Id: I9ff961e9d6558478e72098a74048a5957299a953
Reviewed-on: https://gerrit.libreoffice.org/52547
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 9723ceffbfb9..de91a3570231 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -117,7 +117,7 @@ def processIWYUOutput(iwyuOutput, moduleRules):
 
 match = re.match("(.*) should add these lines:$", line)
 if match:
-currrentFileName = match.group(1)
+currentFileName = match.group(1)
 inAdd = True
 continue
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: bin/find-unneeded-includes sc/IwyuFilter_sc.yaml sw/IwyuFilter_sw.yaml writerfilter/IwyuFilter_writerfilter.yaml

2018-04-07 Thread Miklos Vajna
 bin/find-unneeded-includes|  233 ++
 sc/IwyuFilter_sc.yaml |2 
 sw/IwyuFilter_sw.yaml |   64 
 writerfilter/IwyuFilter_writerfilter.yaml |8 +
 4 files changed, 307 insertions(+)

New commits:
commit b5ede834dece9e5ece3e525f610912984c60661b
Author: Miklos Vajna 
Date:   Tue Apr 3 09:20:57 2018 +0200

Add IWYU wrapper script to find unused includes

I've used this script in the recent past to fix warnings in mostly
sw/inc/*.hxx. Hopefully sharing it creates interest for others to do
similar fixes in other modules.

Change-Id: I4c8b6a1e92b006d4fd56b403a25715f11964d639
Reviewed-on: https://gerrit.libreoffice.org/52289
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
new file mode 100755
index ..9723ceffbfb9
--- /dev/null
+++ b/bin/find-unneeded-includes
@@ -0,0 +1,233 @@
+#!/usr/bin/env python3
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This parses the output of 'include-what-you-use', focusing on just removing
+# not needed includes and providing a relatively conservative output by
+# filtering out a number of LibreOffice-specific false positives.
+#
+# It assumes you have a 'compile_commands.json' around (similar to clang-tidy),
+# you can generate one with 'make vim-ide-integration'.
+#
+# Design goals:
+# - blacklist mechanism, so a warning is either fixed or blacklisted
+# - works in a plugins-enabled clang build
+# - no custom configure options required
+# - no need to generate a dummy library to build a header
+
+import glob
+import json
+import multiprocessing
+import os
+import queue
+import re
+import subprocess
+import sys
+import threading
+import yaml
+
+
+def ignoreRemoval(include, toAdd, absFileName, moduleRules):
+# global rules
+
+# Avoid replacing .hpp with .hdl in the com::sun::star namespace.
+if include.startswith("com/sun/star") and include.endswith(".hpp"):
+hdl = include.replace(".hpp", ".hdl")
+if hdl in toAdd:
+return True
+
+# Avoid debug STL.
+debugStl = {
+"array": "debug/array",
+"deque": "debug/deque",
+"list": "debug/list",
+"map": "debug/map.h",
+"set": "debug/set.h",
+"unordered_map": "debug/unordered_map",
+"unordered_set": "debug/unordered_set",
+"vector": "debug/vector",
+}
+for k, v in debugStl.items():
+if include == k and v in toAdd:
+return True
+
+# Follow boost documentation.
+if include == "boost/optional.hpp" and "boost/optional/optional.hpp" in 
toAdd:
+return True
+if include == "boost/intrusive_ptr.hpp" and 
"boost/smart_ptr/intrusive_ptr.hpp" in toAdd:
+return True
+
+# 3rd-party, non-self-contained headers.
+if include == "libepubgen/libepubgen.h" and 
"libepubgen/libepubgen-decls.h" in toAdd:
+return True
+if include == "librevenge/librevenge.h" and 
"librevenge/RVNGPropertyList.h" in toAdd:
+return True
+
+noRemove = (
+#  insists on 
not
+# removing this.
+"sal/config.h",
+# Works around a build breakage specific to the broken Android
+# toolchain.
+"android/compatibility.hxx",
+)
+if include in noRemove:
+return True
+
+# Ignore when  is to be replaced with "foo".
+if include in toAdd:
+return True
+
+fileName = os.path.relpath(absFileName, os.getcwd())
+
+# yaml rules
+
+if "blacklist" in moduleRules.keys():
+blacklistRules = moduleRules["blacklist"]
+if fileName in blacklistRules.keys():
+if include in blacklistRules[fileName]:
+return True
+
+return False
+
+
+def unwrapInclude(include):
+# Drop <> or "" around the include.
+return include[1:-1]
+
+
+def processIWYUOutput(iwyuOutput, moduleRules):
+inAdd = False
+toAdd = []
+inRemove = False
+toRemove = []
+currentFileName = None
+for line in iwyuOutput:
+line = line.strip()
+
+if len(line) == 0:
+if inRemove:
+inRemove = False
+continue
+if inAdd:
+inAdd = False
+continue
+
+match = re.match("(.*) should add these lines:$", line)
+if match:
+currrentFileName = match.group(1)
+inAdd = True
+continue
+
+match = re.match("(.*) should remove these lines:$", line)
+if match:
+currentFileName = match.group(1)
+inRemove = True
+continue