core.git: bin/find-unneeded-includes

2026-01-28 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit c765ee9d1a241d4f2740f44aa74c1a7792dc
Author: Gabor Kelemen 
AuthorDate: Wed Jan 28 09:22:36 2026 +0100
Commit: Gabor Kelemen 
CommitDate: Wed Jan 28 16:53:01 2026 +0100

bin/find-unneeded-includes: check if hdl files are considered necessary

spotted while rechecking include/toolkit, some hpp headers are now
not suggested to be replaced by fw declarations incorrectly,
but to be replaced by their matching hdl files.

There is already a rule to skip these automatically, no need to keep such
in exception files

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index fb5edfb103fd..99b69b2ded65 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -261,6 +261,13 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName, 
noexclude, checknamespa
 if realFileName in excludelistRules.keys():
 if include in excludelistRules[realFileName]:
 print("WARNING:", include, "excluded header can be 
removed from exclusion list of file:", realFileName)
+# check if a hpp files hdl pair is now considered necessary
+# then there is no need for an explicit exclusion
+hdlMatch = re.match(".*.hdl", include)
+if hdlMatch:
+hdl = include.replace(".hdl", ".hpp")
+if hdl in excludelistRules[realFileName]:
+print("WARNING:", hdl, "excluded header can be 
removed from exclusion list of file:", realFileName)
 
 if checknamespaces:
 # match for all possible URE/UNO namespaces, created with:


core.git: bin/find-unneeded-includes

2026-01-28 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit eeec01881aed2639741403d075ee9a74a9374c59
Author: Gabor Kelemen 
AuthorDate: Fri Jan 23 16:53:51 2026 +0100
Commit: Gabor Kelemen 
CommitDate: Wed Jan 28 16:52:44 2026 +0100

bin/find-unneeded-includes: more generic way to avoid versioned namespaces

Spotted with include/i18nlangtag/languagetagicu.hxx:
iwyu wants to replace unicode/locid.h with namespace icu_78 { class Locale; 
}
but this is super fragile

Now this works for both this and the older example:
bin/find-unneeded-includes --headersfwd 
i18npool/inc/breakiterator_unicode.hxx  include/i18nlangtag/languagetagicu.hxx
should give no suggestions

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 8822a663d2f6..fb5edfb103fd 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -105,9 +105,9 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules, 
noexclude):
 # Skip forward declaration of versioned namespaces
 # see https://gerrit.libreoffice.org/c/core/+/72972
 # for an example of breakage caused by this
-if include == "unicode/regex.h":
+if include.startswith("unicode/"):
 for item in toAdd:
-match = re.search(r'namespace icu.* class RegexMatcher', item)
+match = re.search(r'namespace icu_.*', item)
 if match:
 return True
 


core.git: bin/find-unneeded-includes

2026-01-12 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |  104 ++---
 1 file changed, 99 insertions(+), 5 deletions(-)

New commits:
commit 0941cb8a0b5a81dbd1aad51e0b3e9276e1a3cf48
Author: Gabor Kelemen 
AuthorDate: Mon Jan 5 13:04:00 2026 +0100
Commit: Miklos Vajna 
CommitDate: Mon Jan 12 09:46:16 2026 +0100

bin/find-unneeded-includes: Improve exclusion lists

Add several paths to skip checking under Linux

This is preparation to integrate this script into CI,
so that it does not report error on headers that are
entirely Win/Mac/IOS/Android/... specific.

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 3161b0ed907d..8822a663d2f6 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -485,19 +485,113 @@ def isInUnoIncludeFile(path):
 def isNonLinuxPath(path):
 return path.startswith("avmedia/source/win/") \
 or path.startswith("avmedia/source/macavf/") \
-or path.startswith("include/apple_remote/")
+or path.startswith("bridges/inc/gcc3_ios/") \
+or path.startswith("bridges/inc/gcc3_linux_alpha/") \
+or path.startswith("bridges/inc/gcc3_linux_arm/") \
+or path.startswith("bridges/inc/gcc3_linux_hppa/") \
+or path.startswith("bridges/inc/gcc3_linux_ia64/") \
+or path.startswith("bridges/inc/gcc3_linux_intel/") \
+or path.startswith("bridges/inc/gcc3_linux_loongarch64/") \
+or path.startswith("bridges/inc/gcc3_linux_m68k/") \
+or path.startswith("bridges/inc/gcc3_linux_mips/") \
+or path.startswith("bridges/inc/gcc3_linux_mips64/") \
+or path.startswith("bridges/inc/gcc3_linux_mips64/") \
+or path.startswith("bridges/inc/gcc3_linux_powerpc/") \
+or path.startswith("bridges/inc/gcc3_linux_powerpc64/") \
+or path.startswith("bridges/inc/gcc3_linux_riscv64/") \
+or path.startswith("bridges/inc/gcc3_linux_s390x/") \
+or path.startswith("bridges/inc/gcc3_linux_sparc/") \
+or path.startswith("bridges/inc/gcc3_linux_sparc64/") \
+or path.startswith("bridges/inc/gcc3_macosx_x86-64/") \
+or path.startswith("bridges/inc/gcc3_wasm/") \
+or path.startswith("bridges/inc/msvc/") \
+or path.startswith("bridges/source/cpp_uno/gcc3_ios/") \
+or path.startswith("bridges/source/cpp_uno/gcc3_ios/") \
+or path.startswith("bridges/source/cpp_uno/gcc3_linux_aarch64/") \
+or path.startswith("bridges/source/cpp_uno/gcc3_linux_alpha/") \
+or path.startswith("bridges/source/cpp_uno/gcc3_linux_arm/") \
+or path.startswith("bridges/source/cpp_uno/gcc3_linux_hppa/") \
+or path.startswith("bridges/source/cpp_uno/gcc3_linux_ia64/") \
+or path.startswith("bridges/source/cpp_uno/gcc3_linux_intel/") \
+or path.startswith("bridges/source/cpp_uno/gcc3_linux_loongarch64/") \
+or path.startswith("bridges/source/cpp_uno/gcc3_linux_m68k/") \
+or path.startswith("bridges/source/cpp_uno/gcc3_linux_mips/") \
+or path.startswith("bridges/source/cpp_uno/gcc3_linux_mips64/") \
+or path.startswith("bridges/source/cpp_uno/gcc3_linux_mips64/") \
+or path.startswith("bridges/source/cpp_uno/gcc3_linux_powerpc/") \
+or path.startswith("bridges/source/cpp_uno/gcc3_linux_powerpc64/") \
+or path.startswith("bridges/source/cpp_uno/gcc3_linux_riscv64/") \
+or path.startswith("bridges/source/cpp_uno/gcc3_linux_s390x/") \
+or path.startswith("bridges/source/cpp_uno/gcc3_linux_sparc/") \
+or path.startswith("bridges/source/cpp_uno/gcc3_linux_sparc64/") \
+or path.startswith("bridges/source/cpp_uno/gcc3_macosx_x86-64/") \
+or path.startswith("bridges/source/cpp_uno/gcc3_wasm/") \
+or path.startswith("bridges/source/cpp_uno/msvc_win32_arm64/") \
+or path.startswith("bridges/source/cpp_uno/msvc_win32_x86-64/") \
+or path.startswith("canvas/source/directx") \
+or path.startswith("connectivity/source/drivers/ado") \
+or path.startswith("connectivity/source/drivers/macab") \
+or path.startswith("connectivity/source/inc/ado") \
+or path.startswith("desktop/win32") \
+or path.startswith("embeddedobj/source/msole") \
+or path.startswith("extensions/source/activex") \
+or path.startswith("extensions/source/macosx") \
+or path.startswith("extensions/source/ole") \
+or path.startswith("fpicker/source/aqua/") \
+or path.startswith("fpicker/source/win32/") \
+or path.startswith("include/apple_remote/") \
+or path.startswith("ios") \
+or path.startswith("lingucomponent/source/spellcheck/macosxspell") \
+or path.startswith("osx") \
+ 

core.git: bin/find-unneeded-includes

2026-01-03 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit e57189f9c1c3a119e40f68a159056fd8c7660cad
Author: Gabor Kelemen 
AuthorDate: Wed Dec 31 13:23:19 2025 +0100
Commit: Gabor Kelemen 
CommitDate: Sat Jan 3 14:26:42 2026 +0100

bin/find-unneeded-includes: improve headersfwd mode

- give warning if a header is skipped because it contains #if defs
- give an option to still check those (together with --noexclude)

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index b547ba6d5d13..3161b0ed907d 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -568,10 +568,11 @@ def tidy(compileCommands, paths, noexclude, 
checknamespaces, finderrors, removef
 p2 = subprocess.Popen(['grep', '-e', '#if'], stdin=p1.stdout, 
stdout=subprocess.PIPE, text=True)
 p1.stdout.close()
 output, _ = p2.communicate()
-if not output:
+if not output or noexclude:
 invocation = "include-what-you-use -Xiwyu --cxx17ns -Xiwyu 
--max_line_length=200 " + args
 else:
 # '#if' found, skipping file
+print("WARNING: #if found in file:", path, "- skipping for 
now.")
 continue
 
 # In --fwdecl mode we ask for fw declaration removal suggestions.


core.git: bin/find-unneeded-includes

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

New commits:
commit 930ff2b830ebaf44b8db6fd0d6be9342da814b0a
Author: Gabor Kelemen 
AuthorDate: Fri Dec 26 21:31:43 2025 +0100
Commit: Gabor Kelemen 
CommitDate: Fri Jan 2 19:57:07 2026 +0100

bin/find-unneeded-includes: make --headersfwd work without --recursive

Also add text=True for good output - previously, this did not work at all
(it let include/vcl/BitmapTools.hxx checked, see it in subsequent patch)

Previously this check was placed a bit incorrectly, which made
it run only if both --headersfwd and --recursive was provided

Now it runs with simple glob patterns too, such as:
bin/find-unneeded-includes --headersfwd include/vcl/[A-Z]*

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 154195d5200a..b547ba6d5d13 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -562,7 +562,18 @@ def tidy(compileCommands, paths, noexclude, 
checknamespaces, finderrors, removef
 invocation = "include-what-you-use -Xiwyu --no_fwd_decls 
-Xiwyu --max_line_length=200 " + args
 # Suggest headers' replacement with forward declarations
 elif headersfwd:
-invocation = "include-what-you-use -Xiwyu --cxx17ns -Xiwyu 
--max_line_length=200 " + args
+# Peek inside the file to check for code behind #ifdef or 
similar
+# This is the fragile part, skip forward declaration 
suggestions for such
+p1 = subprocess.Popen(['git', 'grep', '-v', '-e', 'INCLUDED', 
path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
+p2 = subprocess.Popen(['grep', '-e', '#if'], stdin=p1.stdout, 
stdout=subprocess.PIPE, text=True)
+p1.stdout.close()
+output, _ = p2.communicate()
+if not output:
+invocation = "include-what-you-use -Xiwyu --cxx17ns -Xiwyu 
--max_line_length=200 " + args
+else:
+# '#if' found, skipping file
+continue
+
 # In --fwdecl mode we ask for fw declaration removal suggestions.
 # In this mode obsolete fw declarations are suggested for removal.
 # Later we ignore the header removal suggestions, which may be
@@ -626,7 +637,7 @@ def main(argv):
 if args.recursive:
 for root, dirs, files in os.walk(args.recursive[0]):
 for file in files:
-if args.headers:
+if args.headers or args.headersfwd:
 if not args.fwdecl:
 if (file.endswith(".hxx") or file.endswith(".hrc") or 
file.endswith(".h")):
 list_of_files.append(os.path.join(root,file))
@@ -635,18 +646,6 @@ def main(argv):
 # used in defines and iwyu (0.21 at least) can not yet 
understand those properly
 if (file.endswith(".hxx") or file.endswith(".h")):
 list_of_files.append(os.path.join(root,file))
-elif args.headersfwd:
-if (file.endswith(".hxx") or file.endswith(".hrc") or 
file.endswith(".h")):
-# Peek inside the file to check for code behind #ifdef 
or similar
-# This is the fragile part, skip forward declaration 
suggestions for such
-p1 = subprocess.Popen(['git', 'grep', '-v', '-e', 
'INCLUDED', os.path.join(root,file) ], stdout=subprocess.PIPE)
-p2 = subprocess.Popen(['grep', '-e', '#if'], 
stdin=p1.stdout, stdout=subprocess.PIPE)
-p1.stdout.close()
-output, _ = p2.communicate()
-if not output:
-list_of_files.append(os.path.join(root,file))
-else:
-continue
 else:
 if (file.endswith(".cxx") or file.endswith(".c")):
 list_of_files.append(os.path.join(root,file))


core.git: bin/find-unneeded-includes

2025-11-23 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |   12 
 1 file changed, 4 insertions(+), 8 deletions(-)

New commits:
commit 3bc5f3beb87cd0748ffa3c07c9e4c59164b0c7ea
Author: Gabor Kelemen 
AuthorDate: Sun Nov 23 13:58:56 2025 +0100
Commit: Miklos Vajna 
CommitDate: Mon Nov 24 08:57:51 2025 +0100

bin/find-unneeded-includes: drop --continue option

I find it nowadays rather inconvenient to use it
almost always

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index b664121cb53d..154195d5200a 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -445,7 +445,7 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName, 
noexclude, checknamespa
 return len(toRemove)
 
 
-def run_tool(task_queue, failed_files, dontstop, noexclude, checknamespaces, 
finderrors, removefwdd):
+def run_tool(task_queue, failed_files, noexclude, checknamespaces, finderrors, 
removefwdd):
 while True:
 invocation, moduleRules = task_queue.get()
 if not len(failed_files):
@@ -462,8 +462,6 @@ def run_tool(task_queue, failed_files, dontstop, noexclude, 
checknamespaces, fin
 print("ERROR: The following command found unused includes:
" + invocation)
 else:
 print("ERROR: The following command found unused forward 
declarations:
" + invocation)
-if not dontstop:
-failed_files.append(invocation)
 task_queue.task_done()
 if checknamespaces:
 # Workaround: sometimes running git grep makes the letters typed into 
the terminal disappear after the script is finished
@@ -502,7 +500,7 @@ def isNonLinuxFile(path):
 if path in NonLinuxFiles:
 return True
 
-def tidy(compileCommands, paths, dontstop, noexclude, checknamespaces, 
finderrors, removefwdd, debug, headersfwd):
+def tidy(compileCommands, paths, noexclude, checknamespaces, finderrors, 
removefwdd, debug, headersfwd):
 return_code = 0
 
 try:
@@ -510,7 +508,7 @@ def tidy(compileCommands, paths, dontstop, noexclude, 
checknamespaces, finderror
 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, noexclude, checknamespaces, finderrors, removefwdd))
+t = threading.Thread(target=run_tool, args=(task_queue, 
failed_files, noexclude, checknamespaces, finderrors, removefwdd))
 t.daemon = True
 t.start()
 
@@ -592,8 +590,6 @@ def tidy(compileCommands, paths, dontstop, noexclude, 
checknamespaces, finderror
 
 def main(argv):
 parser = argparse.ArgumentParser(description='Check source files for 
unneeded includes.')
-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')
 parser.add_argument('--recursive', metavar='DIR', nargs=1, type=str,
@@ -715,7 +711,7 @@ def main(argv):
 print("WARNING: no exclusions are defined for:", file)
 sys.exit(0)
 
-tidy(compileCommands, paths=list_of_files, 
dontstop=vars(args)["continue"], noexclude=args.noexclude, 
checknamespaces=args.ns, finderrors=args.finderrors, removefwdd=args.fwdecl, 
debug=args.d, headersfwd=args.headersfwd)
+tidy(compileCommands, paths=list_of_files, noexclude=args.noexclude, 
checknamespaces=args.ns, finderrors=args.finderrors, removefwdd=args.fwdecl, 
debug=args.d, headersfwd=args.headersfwd)
 
 if __name__ == '__main__':
 main(sys.argv[1:])


core.git: bin/find-unneeded-includes

2025-11-14 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |   32 
 1 file changed, 32 deletions(-)

New commits:
commit 57f62d87f1c00b616c98b70b0e02faaf70cd42d0
Author: Gabor Kelemen 
AuthorDate: Thu Oct 16 23:02:26 2025 +0200
Commit: Gabor Kelemen 
CommitDate: Fri Nov 14 10:03:30 2025 +0100

bin/find-unneeded-includes: stop checking for debug and bits

prefixes of standard library headers

I'm not seeing these errors anymore in fresh v0.24+ IWYU's output

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 5cd11c696c36..b664121cb53d 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -39,38 +39,6 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules, 
noexclude):
 if hdl in toAdd:
 return True
 
-# Avoid debug STL.
-debugStl = {
-"array": ("debug/array", ),
-"bitset": ("debug/bitset", ),
-"deque": ("debug/deque", ),
-"forward_list": ("debug/forward_list", ),
-"list": ("debug/list", ),
-"map": ("debug/map.h", "debug/multimap.h"),
-"set": ("debug/set.h", "debug/multiset.h"),
-"unordered_map": ("debug/unordered_map", ),
-"unordered_set": ("debug/unordered_set", ),
-"vector": ("debug/vector", ),
-}
-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 = {
-"exception": "bits/exception.h",
-"memory": "bits/shared_ptr.h",
-"functional": "bits/std_function.h",
-"cmath": "bits/std_abs.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:
-return True
-
 # Avoid proposing o3tl fw declaration
 o3tl = {
 "o3tl/typed_flags_set.hxx" : "namespace o3tl { template  
struct typed_flags; }",


core.git: bin/find-unneeded-includes

2025-11-06 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |   21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

New commits:
commit 980437e7380077e008b7e145b472c8c79b89d83e
Author: Gabor Kelemen 
AuthorDate: Thu Oct 16 22:52:23 2025 +0200
Commit: Miklos Vajna 
CommitDate: Fri Nov 7 08:36:42 2025 +0100

bin/find-unneeded-includes: exclude some paths from checking

individual files and dirs with many files as well,
if they are related to any non-linux build, such as
Win, Mac, Emscripten, IOS, Android

Preparation for making this everybody elses problem,
but for now, only on linux builders

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 405a6c9286a2..5cd11c696c36 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -514,6 +514,25 @@ def isInUnoIncludeFile(path):
 or path.startswith("include/typelib/") \
 or path.startswith("include/uno/")
 
+# Don't bother with non-linux specific paths,
+# useful for automatically checking headers
+def isNonLinuxPath(path):
+return path.startswith("avmedia/source/win/") \
+or path.startswith("avmedia/source/macavf/") \
+or path.startswith("include/apple_remote/")
+
+def isNonLinuxFile(path):
+NonLinuxFiles = (
+"include/comphelper/windowserrorstring.hxx",
+"include/comphelper/windowsdebugoutput.hxx",
+"include/comphelper/windowsStart.hxx",
+"include/drawinglayer/processor2d/d2dpixelprocessor2d.hxx",
+"include/static/unoembindhelpers/PrimaryBindings.hxx",
+"include/version.hrc",
+"include/vcl/winscheduler.hxx",
+)
+if path in NonLinuxFiles:
+return True
 
 def tidy(compileCommands, paths, dontstop, noexclude, checknamespaces, 
finderrors, removefwdd, debug, headersfwd):
 return_code = 0
@@ -528,7 +547,7 @@ def tidy(compileCommands, paths, dontstop, noexclude, 
checknamespaces, finderror
 t.start()
 
 for path in sorted(paths):
-if isInUnoIncludeFile(path):
+if isInUnoIncludeFile(path) or isNonLinuxFile(path) or 
isNonLinuxPath(path):
 continue
 
 # IWYU fails on these with #error: don't use this in new code


core.git: bin/find-unneeded-includes include/IwyuFilter_include.yaml

2025-11-06 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes  |   11 +++
 include/IwyuFilter_include.yaml |3 ---
 2 files changed, 11 insertions(+), 3 deletions(-)

New commits:
commit fc989238e57dcaf541f870a1202b3c6681386293
Author: Gabor Kelemen 
AuthorDate: Mon Oct 20 20:58:07 2025 +0200
Commit: Gabor Kelemen 
CommitDate: Thu Nov 6 19:28:39 2025 +0100

bin/find-unneeded-includes: another method against obsolete exclusions

Spotted with include/o3tl/vector_utils.hxx
it can happen that IWYU starts to consider a header having
all correct includes, in this case it does not give a list of
proposals.

This makes the previous method of spotting obsolete exclusions
ineffective in these cases.

Start watching for the "foo.hxx has correct #includes/fwd-decls"
announcement and consider every exclusion as obsolete

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 2dafa002b4cc..405a6c9286a2 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -235,6 +235,17 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName, 
noexclude, checknamespa
 inFull = True
 continue
 
+# Check if IWYU considers the header as having correct
+# list of includes - this would make all exclusions obsolete
+match = re.match(".*has correct #includes/fwd-decls.*", line)
+if match:
+if "excludelist" in moduleRules.keys():
+excludelistRules = moduleRules["excludelist"]
+realFileName = os.path.relpath(fileName, os.getcwd())
+if realFileName in excludelistRules.keys():
+print("WARNING:", "File has correct #includes/fwd-decls; 
all excluded headers can be removed from exclusion list of:", realFileName)
+continue
+
 if inAdd:
 match = re.match('#include ([^ ]+)', line)
 if match:
diff --git a/include/IwyuFilter_include.yaml b/include/IwyuFilter_include.yaml
index d10299f84262..8f5373c8e2a8 100644
--- a/include/IwyuFilter_include.yaml
+++ b/include/IwyuFilter_include.yaml
@@ -212,9 +212,6 @@ excludelist:
 include/o3tl/unreachable.hxx:
 # Needed for C++23 mode
 - utility
-include/o3tl/vector_utils.hxx:
-# Needed for std::copy_if
-- algorithm
 include/sot/exchange.hxx:
 # Used in a macro #define
 - com/sun/star/datatransfer/dnd/DNDConstants.hpp


core.git: bin/find-unneeded-includes sw/IwyuFilter_sw.yaml sw/source vcl/IwyuFilter_vcl.yaml

2025-10-30 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes   |7 +++
 sw/IwyuFilter_sw.yaml|7 +++
 sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx |1 +
 sw/source/writerfilter/dmapper/GraphicImport.hxx |7 +++
 sw/source/writerfilter/dmapper/PropertyMap.hxx   |2 ++
 sw/source/writerfilter/dmapper/ThemeColorHandler.hxx |1 +
 vcl/IwyuFilter_vcl.yaml  |5 +
 7 files changed, 30 insertions(+)

New commits:
commit ccfebc2718c2feb8324a4d6abbd45935dcdcc597
Author: Gabor Kelemen 
AuthorDate: Thu Oct 16 19:41:18 2025 +0200
Commit: Miklos Vajna 
CommitDate: Thu Oct 30 10:07:22 2025 +0100

bin/find-unneeded-includes: add assumeDirs support in yaml file

There are cases when a modules certain header files need
some other include search path than the single assumeFile provides

This is visible when one runs in the --finderrors mode
and the detailed IWYU run complains like:

include/oox/export/drawingml.hxx:39:10: fatal error: 'oox/token/tokens.hxx' 
file not found

Solve this by introducing assumeDirs in the yaml files, which provides
a different assumeFile for headers in certain directories

Demo on vcl/inc/qt[56] and sw/source/writerfilter;
also with fixing the few identified non-self contained headers there

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 3f9d3bfeccc5..2dafa002b4cc 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -539,6 +539,13 @@ def tidy(compileCommands, paths, dontstop, noexclude, 
checknamespaces, finderror
 # code on Linux.
 if "assumeFilename" in moduleRules.keys() and not 
path.endswith("cxx"):
 assume = moduleRules["assumeFilename"]
+# Check for lower level assume file name
+if "customAssumeFilenames" in moduleRules:
+customAssumeRules = 
moduleRules["customAssumeFilenames"]
+for dirName in customAssumeRules.keys():
+if path.startswith(dirName):
+assume = customAssumeRules[dirName]
+
 if assume:
 assumeAbs = os.path.abspath(assume)
 compileFile = assumeAbs
diff --git a/sw/IwyuFilter_sw.yaml b/sw/IwyuFilter_sw.yaml
index 0b0da76f296d..b6aef2298de8 100644
--- a/sw/IwyuFilter_sw.yaml
+++ b/sw/IwyuFilter_sw.yaml
@@ -1,5 +1,12 @@
 ---
 assumeFilename: sw/source/core/doc/docnew.cxx
+customAssumeFilenames:
+# Need -I/.../sw/source/writerfilter/inc
+sw/source/writerfilter: sw/source/writerfilter/dmapper/DomainMapper.cxx
+# Need -I/.../workdir/UnpackedTarball/cppunit/include to work
+sw/qa/inc: sw/qa/core/test_ToxMiscTest.cxx
+# Needs -I/...workdir/CustomTarget/oox/generated
+sw/source/filter/ww8: sw/source/filter/ww8/docxattributeoutput.cxx
 excludelist:
 sw/sdi/swslots.hrc:
 # Needed for sdi files to compile
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx
index b6d3df34e79a..79fcc0ba1937 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx
@@ -56,6 +56,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 class SwXTextDocument;
diff --git a/sw/source/writerfilter/dmapper/GraphicImport.hxx 
b/sw/source/writerfilter/dmapper/GraphicImport.hxx
index 6db245f1cbbf..0721988327cd 100644
--- a/sw/source/writerfilter/dmapper/GraphicImport.hxx
+++ b/sw/source/writerfilter/dmapper/GraphicImport.hxx
@@ -20,6 +20,7 @@
 
 #include 
 #include 
+#include 
 
 #include "LoggedResources.hxx"
 #include "WrapPolygonHandler.hxx"
@@ -29,6 +30,12 @@
 #include 
 #include 
 #include 
+#include 
+
+#include 
+#include 
+
+#include 
 
 class SwXTextGraphicObject;
 namespace com::sun::star {
diff --git a/sw/source/writerfilter/dmapper/PropertyMap.hxx 
b/sw/source/writerfilter/dmapper/PropertyMap.hxx
index 3424c5143d58..ad066ecf5d6a 100644
--- a/sw/source/writerfilter/dmapper/PropertyMap.hxx
+++ b/sw/source/writerfilter/dmapper/PropertyMap.hxx
@@ -31,6 +31,8 @@
 #include 
 #include "PropertyIds.hxx"
 #include 
+#include 
+
 #include 
 #include 
 #include 
diff --git a/sw/source/writerfilter/dmapper/ThemeColorHandler.hxx 
b/sw/source/writerfilter/dmapper/ThemeColorHandler.hxx
index 49d7db20674f..da23f8a55d3a 100644
--- a/sw/source/writerfilter/dmapper/ThemeColorHandler.hxx
+++ b/sw/source/writerfilter/dmapper/ThemeColorHandler.hxx
@@ -17,6 +17,7 @@
 #include "PropertyIds.hxx"
 
 #include 
+#include 
 #include 
 
 #include 
diff --git a/vcl/IwyuFilter_vcl.yaml b/vcl/IwyuFilter_vcl.yaml
index 7a9

core.git: bin/find-unneeded-includes

2025-10-18 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |   14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit b6b8643fbd0fbf777f2bb8bc7720ad97785ea155
Author: Gabor Kelemen 
AuthorDate: Thu Oct 2 23:18:26 2025 +0200
Commit: Gabor Kelemen 
CommitDate: Fri Oct 10 22:12:04 2025 +0200

bin/find-unneeded-includes: handle namespaces in sanitycheck better

as seen in chart2/ or store/, some namespace fw declarations are
written in two lines so matching them without the namespace prefix
is necessary, i.e. to avoid:

WARNING: namespace chart { class ChartTypeTabPage; } is not present anymore 
in chart2/source/controller/inc/dlg_ChartType.hxx
or
WARNING: store/source/stordir.hxx : namespace store { struct 
OStoreDirectoryPageData; } line is not present anymore, remove it from: 
store/IwyuFilter_store.yaml

we need to look for "class ChartTypeTabPage" and
"struct OStoreDirectoryPageData" too when searching
for obsolete exclusions.

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 76daaabb67c2..601881c7c786 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -657,9 +657,17 @@ def main(argv):
 else:
 try:
 for exclusion in excludelistRules[pathname]:
-p = subprocess.run(["git", "grep", "-q", "-e", 
"#include <"+exclusion, "-e", exclusion, file])
-if p.returncode == 1 :
-print("WARNING:", exclusion, "is not present 
anymore in", file)
+# class names behind namespace prefixes may be in 
separate lines
+c=re.match(r"(?:namespace.*{ )(class.*|struct .*); 
}.*", exclusion)
+if c:
+classname=c.group(1)
+p = subprocess.run(["git", "grep", "-q", "-e", 
"#include <"+exclusion, "-e", exclusion, "-e", classname, file])
+if p.returncode == 1 :
+print("WARNING:", exclusion, "is not 
present anymore in", file)
+else:
+p = subprocess.run(["git", "grep", "-q", "-e", 
"#include <"+exclusion, "-e", exclusion, file])
+if p.returncode == 1 :
+print("WARNING:", exclusion, "is not 
present anymore in", file)
 except TypeError:
 print("WARNING: no exclusions are defined for:", file)
 sys.exit(0)


core.git: bin/find-unneeded-includes

2025-10-18 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3dec69a8b9a3a9c451d3fd4f8fff5f183a1535bf
Author: Gabor Kelemen 
AuthorDate: Sat Sep 27 15:27:56 2025 +0200
Commit: Gabor Kelemen 
CommitDate: Tue Oct 7 09:52:29 2025 +0200

bin/find-unneeded-includes: non-self containedness is just a warning

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 9b5afc6d6634..d2874a84a1e0 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -466,7 +466,7 @@ def run_tool(task_queue, failed_files, dontstop, noexclude, 
checknamespaces, fin
 if p.returncode == 1:
 print("Running the IWYU process returned error code:
" + invocation)
 if retcode == -1 and not checknamespaces and not removefwdd:
-print("ERROR: A file is probably not self contained, check 
this commands output:
" + invocation)
+print("WARNING: A file is probably not self contained, check 
this commands output:
" + invocation)
 elif retcode > 0:
 if not removefwdd:
 print("ERROR: The following command found unused includes:
" + invocation)


core.git: bin/find-unneeded-includes i18npool/IwyuFilter_i18npool.yaml

2025-10-18 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes|9 +
 i18npool/IwyuFilter_i18npool.yaml |2 --
 2 files changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 85148426ab3340dbd7365122ab32fa3eb255ee88
Author: Gabor Kelemen 
AuthorDate: Wed Oct 15 09:55:12 2025 +0200
Commit: Miklos Vajna 
CommitDate: Wed Oct 15 13:26:27 2025 +0200

bin/find-unneeded-includes: skip versioned namespace

This has led to
commit 62a9df7473f4213d6ac63faa0a7c0555212bfdee
"find-unneded-includes: avoid replacing includes with forward-declarations"

now the replacement of unicode/regex.h with a versioned namespace is not 
suggested

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 423aa4eae64b..1f82f2b044b1 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -134,6 +134,15 @@ def ignoreRemoval(include, toAdd, absFileName, 
moduleRules, noexclude):
 if include == "box2d/box2d.h" and "box2d/b2_world.h" in toAdd:
 return True
 
+# Skip forward declaration of versioned namespaces
+# see https://gerrit.libreoffice.org/c/core/+/72972
+# for an example of breakage caused by this
+if include == "unicode/regex.h":
+for item in toAdd:
+match = re.search(r'namespace icu.* class RegexMatcher', item)
+if match:
+return True
+
 noRemove = (
 #  insists on 
not
 # removing this.
diff --git a/i18npool/IwyuFilter_i18npool.yaml 
b/i18npool/IwyuFilter_i18npool.yaml
index a94ab69792ea..337c7cb60781 100644
--- a/i18npool/IwyuFilter_i18npool.yaml
+++ b/i18npool/IwyuFilter_i18npool.yaml
@@ -82,8 +82,6 @@ excludelist:
 # Base class needs complete type
 - com/sun/star/util/XTextSearch2.hpp
 - com/sun/star/lang/XServiceInfo.hpp
-# contains versioned namespace so cannot forward declare
-- unicode/regex.h
 i18npool/source/collator/collator_unicode.cxx:
 # Config options are used in #ifdef
 - config_locales.h


core.git: bin/find-unneeded-includes extensions/IwyuFilter_extensions.yaml forms/IwyuFilter_forms.yaml framework/IwyuFilter_framework.yaml include/IwyuFilter_include.yaml io/IwyuFilter_io.yaml sfx2/Iw

2025-10-18 Thread Gabor Kelemen (via logerrit)
 UnoControls/IwyuFilter_UnoControls.yaml |6 --
 bin/find-unneeded-includes  |1 +
 extensions/IwyuFilter_extensions.yaml   |9 -
 forms/IwyuFilter_forms.yaml |3 ---
 framework/IwyuFilter_framework.yaml |   15 ---
 include/IwyuFilter_include.yaml |   10 --
 io/IwyuFilter_io.yaml   |3 ---
 sfx2/IwyuFilter_sfx2.yaml   |6 --
 svx/IwyuFilter_svx.yaml |3 ---
 sw/IwyuFilter_sw.yaml   |3 ---
 10 files changed, 1 insertion(+), 58 deletions(-)

New commits:
commit 4ba94c18b2ebf1872d1db1f03857172e9a114917
Author: Gabor Kelemen 
AuthorDate: Fri Sep 19 08:47:37 2025 +0200
Commit: Gabor Kelemen 
CommitDate: Wed Sep 24 23:16:15 2025 +0200

bin/find-unneeded-includes: add exception for URE header

cppuhelper/interfacecontainer.hxx, so that these can be
removed from per-module yaml files

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

diff --git a/UnoControls/IwyuFilter_UnoControls.yaml 
b/UnoControls/IwyuFilter_UnoControls.yaml
index 7f18b36621cb..dead31050385 100644
--- a/UnoControls/IwyuFilter_UnoControls.yaml
+++ b/UnoControls/IwyuFilter_UnoControls.yaml
@@ -1,12 +1,6 @@
 ---
 assumeFilename: UnoControls/source/base/basecontrol.cxx
 excludelist:
-UnoControls/inc/multiplexer.hxx:
-# Don't propose hxx -> h change in URE libs
-- cppuhelper/interfacecontainer.hxx
-UnoControls/source/inc/OConnectionPointContainerHelper.hxx:
-# Don't propose hxx -> h change in URE libs
-- cppuhelper/interfacecontainer.hxx
 UnoControls/source/controls/framecontrol.cxx:
 # Needed for use in cppu::UnoType template
 - com/sun/star/awt/XControlContainer.hpp
diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 1d6efb0963fe..7c19119088b2 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -101,6 +101,7 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules, 
noexclude):
 "com/sun/star/uno/Sequence.hxx": "com/sun/star/uno/Sequence.h",
 "com/sun/star/uno/Type.hxx": "com/sun/star/uno/Type.h",
 "rtl/byteseq.hxx": "rtl/byteseq.h",
+"cppuhelper/interfacecontainer.hxx": "cppuhelper/interfacecontainer.h",
 "osl/thread.hxx": "osl/thread.h"
 }
 for k, v in unoapi.items():
diff --git a/extensions/IwyuFilter_extensions.yaml 
b/extensions/IwyuFilter_extensions.yaml
index 9a81eecf5fff..6258e71ad7bb 100644
--- a/extensions/IwyuFilter_extensions.yaml
+++ b/extensions/IwyuFilter_extensions.yaml
@@ -4,18 +4,12 @@ excludelist:
 extensions/inc/strings.hrc:
 # Needed for TranslateId macro
 - unotools/resmgr.hxx
-extensions/source/logging/loghandler.hxx:
-# Don't propose hxx -> h change in URE libs
-- cppuhelper/interfacecontainer.hxx
 extensions/source/abpilot/admininvokationimpl.cxx:
 # Needed for direct member access
 - com/sun/star/awt/XWindow.hpp
 extensions/source/abpilot/unodialogabp.cxx:
 # Needed for direct member access
 - com/sun/star/awt/XWindow.hpp
-extensions/source/bibliography/framectr.cxx:
-# Don't propose hxx -> h change in URE libs
-- cppuhelper/interfacecontainer.hxx
 # Actually used
 - com/sun/star/form/runtime/XFormController.hpp
 - com/sun/star/beans/PropertyValue.hpp
@@ -51,9 +45,6 @@ excludelist:
 extensions/source/propctrlr/formlinkdialog.cxx:
 # Needed for template
 - com/sun/star/sdb/XSingleSelectQueryComposer.hpp
-extensions/source/propctrlr/formgeometryhandler.cxx:
-# Don't propose hxx -> h change in URE libs
-- cppuhelper/interfacecontainer.hxx
 extensions/source/propctrlr/handlerhelper.cxx:
 # Actually used
 - com/sun/star/inspection/LineDescriptor.hpp
diff --git a/forms/IwyuFilter_forms.yaml b/forms/IwyuFilter_forms.yaml
index f14c4c6d7377..432373604333 100644
--- a/forms/IwyuFilter_forms.yaml
+++ b/forms/IwyuFilter_forms.yaml
@@ -7,9 +7,6 @@ excludelist:
 forms/inc/strings.hrc:
 # Needed for TranslateId macro
 - unotools/resmgr.hxx
-forms/source/component/errorbroadcaster.hxx:
-# Don't propose hxx -> h change in URE libs
-- cppuhelper/interfacecontainer.hxx
 forms/source/xforms/unohelper.hxx:
 # Needed for css shortcut
 - sal/types.h
diff --git a/framework/IwyuFilter_framework.yaml 
b/framework/IwyuFilter_framework.yaml
index 317551896c0c..e2c1a2ef3d4a 100644
--- a/framework/IwyuFilter_framework.yaml
+++ b/framework/IwyuFilter_framework.yaml
@@ -1,27 +1,12 @@
 ---
 assumeFilename: framework/source/services/autorecovery.cxx
 excludelist:
-framework/inc/stdtypes.h:
-#  Don't propose hxx -> h change in URE libs
-- cppuhelper/interfacecontainer.hxx
-framework/inc/services/layoutmanager.hxx:
-#  Don't propose hxx -> h change in URE 

core.git: bin/find-unneeded-includes

2025-10-18 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |   12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 40b447c064f551a596c6e009efc9968a60f1b5bc
Author: Gabor Kelemen 
AuthorDate: Tue Oct 7 14:34:06 2025 +0200
Commit: Gabor Kelemen 
CommitDate: Tue Oct 14 11:02:50 2025 +0200

bin/find-unneeded-includes: Add -d option to debug

Inspecting IWYU output when find-unneeded-includes
did not report any issue is less complicated this way

which is useful during improvement of this script

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 601881c7c786..62786fb4fa87 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -493,7 +493,7 @@ def isInUnoIncludeFile(path):
 or path.startswith("include/uno/")
 
 
-def tidy(compileCommands, paths, dontstop, noexclude, checknamespaces, 
finderrors, removefwdd):
+def tidy(compileCommands, paths, dontstop, noexclude, checknamespaces, 
finderrors, removefwdd, debug):
 return_code = 0
 
 try:
@@ -552,6 +552,11 @@ def tidy(compileCommands, paths, dontstop, noexclude, 
checknamespaces, finderror
 # but those and our CI are not reliable enough yet for use
 else:
 invocation = "include-what-you-use -Xiwyu --cxx17ns -Xiwyu 
--max_line_length=200 " + args
+
+if debug:
+print(invocation)
+sys.exit(0)
+
 task_queue.put((invocation, moduleRules))
 
 task_queue.join()
@@ -584,6 +589,9 @@ def main(argv):
 parser.add_argument('--finderrors', action='store_true',
help='Report IWYU failures when it returns with -1 error 
code. '
 'Use only for debugging this script!')
+parser.add_argument('-d', action='store_true',
+   help='Print the full IWYU invocation of a given file. '
+'Use only for debugging this script!')
 parser.add_argument('--fwdecl', action='store_true',
 help='Suggest removal of obsolete forward declarations')
 parser.add_argument('--sanitycheck', action='store_true',
@@ -672,7 +680,7 @@ def main(argv):
 print("WARNING: no exclusions are defined for:", file)
 sys.exit(0)
 
-tidy(compileCommands, paths=list_of_files, 
dontstop=vars(args)["continue"], noexclude=args.noexclude, 
checknamespaces=args.ns, finderrors=args.finderrors, removefwdd=args.fwdecl)
+tidy(compileCommands, paths=list_of_files, 
dontstop=vars(args)["continue"], noexclude=args.noexclude, 
checknamespaces=args.ns, finderrors=args.finderrors, removefwdd=args.fwdecl, 
debug=args.d)
 
 if __name__ == '__main__':
 main(sys.argv[1:])


core.git: bin/find-unneeded-includes include/IwyuFilter_include.yaml

2025-10-18 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes  |8 +++
 include/IwyuFilter_include.yaml |   42 
 2 files changed, 8 insertions(+), 42 deletions(-)

New commits:
commit 1a9b45700ffb1d3ee7886c8cc5be0cdad6a73278
Author: Gabor Kelemen 
AuthorDate: Sun Sep 21 16:58:54 2025 +0200
Commit: Miklos Vajna 
CommitDate: Mon Sep 29 09:07:47 2025 +0200

bin/find-unneeded-includes: check for stale exclusion rules

Similar to how it checks that mentioned files are still existing

Now: check that headers mentioned as exclusions are still present
to avoid too many stale exclusions piling up for no good reason

Check include/ as proof of concept

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 3821a4b51164..4aab4183afd6 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -624,6 +624,14 @@ def main(argv):
 file = pathlib.Path(pathname)
 if not file.exists():
 print("WARNING: File listed in " + rulePath + " no longer 
exists: " + pathname)
+# If the file mentioned in the IwyuFilter file exists,
+# check that the excluded files / forward declarations are still 
present
+# to avoid stale exclusion rules lingering forever
+else:
+for exclusion in excludelistRules[pathname]:
+p = subprocess.run(["git", "grep", "-q", "-e", "#include 
<"+exclusion, "-e", exclusion, file])
+if p.returncode == 1 :
+print("WARNING:", exclusion, "is not present anymore 
in", file)
 
 tidy(compileCommands, paths=list_of_files, 
dontstop=vars(args)["continue"], noexclude=args.noexclude, 
checknamespaces=args.ns, finderrors=args.finderrors, removefwdd=args.fwdecl)
 
diff --git a/include/IwyuFilter_include.yaml b/include/IwyuFilter_include.yaml
index a0a053d78e78..4bf618a38a78 100644
--- a/include/IwyuFilter_include.yaml
+++ b/include/IwyuFilter_include.yaml
@@ -117,7 +117,6 @@ excludelist:
 - com/sun/star/accessibility/XAccessibleKeyBinding.hpp
 include/comphelper/OAccessible.hxx:
 # base class has to be a complete type
-- com/sun/star/accessibility/XAccessibleContext.hpp
 - com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp
 - com/sun/star/accessibility/XAccessibleExtendedComponent.hpp
 include/comphelper/accessibleselectionhelper.hxx:
@@ -187,9 +186,6 @@ excludelist:
 # base class has to be a complete type
 - com/sun/star/io/XInputStream.hpp
 - com/sun/star/io/XSeekable.hpp
-include/comphelper/servicehelper.hxx:
-# Needed for macro
-- rtl/instance.hxx
 include/comphelper/unique_disposing_ptr.hxx:
 # base class has to be a complete type
 - com/sun/star/lang/XServiceInfo.hpp
@@ -212,13 +208,8 @@ excludelist:
 include/o3tl/char16_t2wchar_t.hxx:
 # Needed on WIN32
 - string_view
-include/o3tl/deleter.hxx:
-# Needed for __COVERITY__
-- com/sun/star/uno/Exception.hpp
-- sal/log.hxx
 include/o3tl/intcmp.hxx:
 # Needed for C++20 mode
-- type_traits
 - utility
 include/o3tl/make_shared.hxx:
 # Needed for __COVERITY__
@@ -238,9 +229,6 @@ excludelist:
 include/sot/exchange.hxx:
 # Used in a macro #define
 - com/sun/star/datatransfer/dnd/DNDConstants.hpp
-include/package/Inflater.hxx:
-# Needed in --fwdecl mode
-- struct z_stream_s
 include/package/Deflater.hxx:
 # Needed in --fwdecl mode
 - struct z_stream_s
@@ -271,9 +259,6 @@ excludelist:
 # base class has to be a complete type
 - com/sun/star/container/XNameReplace.hpp
 - com/sun/star/document/XEventsSupplier.hpp
-include/unotools/fontcfg.hxx:
-# Needed for a sal_uLong enum
-- tools/solar.h
 include/unotools/progresshandlerwrap.hxx:
 # base class has to be a complete type
 - com/sun/star/ucb/XProgressHandler.hpp
@@ -299,7 +284,6 @@ excludelist:
 - tools/link.hxx
 include/svl/style.hxx:
 # base class has to be a complete type
-- com/sun/star/lang/XUnoTunnel.hpp
 - com/sun/star/style/XStyle.hpp
 include/vcl/FilterConfigItem.hxx:
 # Needed on Windows with --disable-pch
@@ -311,9 +295,6 @@ excludelist:
 include/vcl/decoview.hxx:
 # Full definition needed for VclPtr
 - vcl/outdev.hxx
-include/vcl/event.hxx:
-# Needed for enum type 
-- vcl/window.hxx
 include/vcl/imap.hxx:
 # Needed for implicit dtor
 - vcl/imapobj.hxx
@@ -329,14 +310,10 @@ excludelist:
 - com/sun/star/datatransfer/XTransferable2.hpp
 - com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp
 - com/sun/star/datatransfer/dnd/XDragSourceListener.hpp
-- com/sun/star/lang/XUnoTunnel.hpp
 - com/sun/star/lang/XServic

core.git: bin/find-unneeded-includes io/IwyuFilter_io.yaml

2025-10-18 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |2 ++
 io/IwyuFilter_io.yaml  |2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit ea45ce73b937d7b182cbcc3ccfd701cfb9e725ca
Author: Gabor Kelemen 
AuthorDate: Fri Sep 19 21:54:55 2025 +0200
Commit: Gabor Kelemen 
CommitDate: Fri Sep 26 20:59:06 2025 +0200

bin/find-unneeded-includes: add exception for URE header

osl/pipe.hxx, so that these can be removed from per-module yaml files

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 717048bfb16d..3821a4b51164 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -106,6 +106,8 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules, 
noexclude):
 "cppuhelper/interfacecontainer.hxx": "cppuhelper/interfacecontainer.h",
 "osl/file.hxx": "osl/file.h",
 "osl/module.hxx": "osl/module.h",
+"osl/pipe.hxx": "osl/pipe.h",
+"osl/pipe.hxx": "osl/pipe_decl.hxx",
 "osl/socket.hxx": "osl/socket.h",
 "osl/socket.hxx": "osl/socket_decl.hxx",
 "osl/thread.hxx": "osl/thread.h"
diff --git a/io/IwyuFilter_io.yaml b/io/IwyuFilter_io.yaml
index 673a1b3088e2..c852851ba63c 100644
--- a/io/IwyuFilter_io.yaml
+++ b/io/IwyuFilter_io.yaml
@@ -5,5 +5,3 @@ excludelist:
 # Base class needs full type
 - com/sun/star/connection/XConnection.hpp
 - com/sun/star/connection/XConnectionBroadcaster.hpp
-# Don't replace with impl. detail
-- osl/pipe.hxx


core.git: bin/find-unneeded-includes include/IwyuFilter_include.yaml

2025-10-18 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes  |   25 +++---
 include/IwyuFilter_include.yaml |   53 
 2 files changed, 20 insertions(+), 58 deletions(-)

New commits:
commit 38eba85f3aa4b893503e32b81fbe8acf18100cd5
Author: Gabor Kelemen 
AuthorDate: Sat Sep 27 14:33:48 2025 +0200
Commit: Miklos Vajna 
CommitDate: Mon Oct 6 09:05:46 2025 +0200

bin/find-unneeded-includes: Warn about obsolete exclusions

when a header is in the exclusion list, but IWYU no longer
considers it for removal; instead as necessary for the file.

In this case, the exclusion is pointless.

Check include/ for proof of concept.

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index b8695fa8a846..9b5afc6d6634 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -216,11 +216,13 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName, 
noexclude, checknamespa
 inRemove = True
 continue
 
-if checknamespaces:
-match = re.match("The full include-list for " + fileName, line)
-if match:
-inFull = True
-continue
+# Process the full include list to check for
+# - obsolete namespace declarations in --ns mode
+# - obsolete exclusions in the yaml file
+match = re.match("The full include-list for " + fileName, line)
+if match:
+inFull = True
+continue
 
 if inAdd:
 match = re.match('#include ([^ ]+)', line)
@@ -257,6 +259,19 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName, 
noexclude, checknamespa
 continue
 
 if inFull:
+# Check if a formerly excluded header is now considered
+# as necessary for the full include list,
+# thereby making the IWYU exclusion unnecessary
+# This can happen if a newer IWYU no longer gives a false warning
+match = re.match("#include\s+[\"<]([^\">]+)[\">]", line)
+if match and "excludelist" in moduleRules.keys():
+include = match.group(1)
+excludelistRules = moduleRules["excludelist"]
+realFileName = os.path.relpath(fileName, os.getcwd())
+if realFileName in excludelistRules.keys():
+if include in excludelistRules[realFileName]:
+print("WARNING:", include, "excluded header can be 
removed from exclusion list of file:", realFileName)
+
 if checknamespaces:
 # match for all possible URE/UNO namespaces, created with:
 # find udkapi/com/sun/star/ -type d | sort| xargs basename -a 
| tr '
' '|'
diff --git a/include/IwyuFilter_include.yaml b/include/IwyuFilter_include.yaml
index 92b39eb60d7f..71b2a18c1450 100644
--- a/include/IwyuFilter_include.yaml
+++ b/include/IwyuFilter_include.yaml
@@ -155,10 +155,6 @@ excludelist:
 include/comphelper/MasterPropertySetInfo.hxx:
 # base class has to be a complete type
 - com/sun/star/beans/XPropertySetInfo.hpp
-include/comphelper/namedvaluecollection.hxx:
-# Needed for template class
-- com/sun/star/beans/PropertyValue.hpp
-- com/sun/star/beans/NamedValue.hpp
 include/comphelper/numberedcollection.hxx:
 # base class has to be a complete type
 - com/sun/star/frame/XUntitledNumbers.hpp
@@ -196,7 +192,6 @@ excludelist:
 include/basegfx/numeric/ftools.hxx:
 # MSVC does not compile when this is removed
 - math.h
-- cmath
 include/basegfx/utils/unopolypolygon.hxx:
 # base class has to be a complete type
 - com/sun/star/lang/XServiceInfo.hpp
@@ -205,9 +200,6 @@ excludelist:
 include/o3tl/char16_t2wchar_t.hxx:
 # Needed on WIN32
 - string_view
-include/o3tl/intcmp.hxx:
-# Needed for C++20 mode
-- utility
 include/o3tl/make_shared.hxx:
 # Needed for __COVERITY__
 - o3tl/deleter.hxx
@@ -217,9 +209,6 @@ excludelist:
 include/o3tl/unreachable.hxx:
 # Needed for C++23 mode
 - utility
-include/o3tl/vector_pool.hxx:
-# Needed for std::move
-- utility
 include/o3tl/vector_utils.hxx:
 # Needed for std::copy_if
 - algorithm
@@ -273,9 +262,6 @@ excludelist:
 # base class has to be a complete type
 - com/sun/star/lang/XUnoTunnel.hpp
 - com/sun/star/util/XNumberFormatsSupplier.hpp
-include/svl/urihelper.hxx:
-# base class has to be a complete type
-- tools/link.hxx
 include/svl/style.hxx:
 # base class has to be a complete type
 - com/sun/star/style/XStyle.hpp
@@ -286,19 +272,10 @@ excludelist:
 # Needed for macro #define
 - vcl/builder.hxx
 - vcl/vclptr.hxx
-include/vcl/decoview.hxx:
-# Ful

core.git: bin/find-unneeded-includes include/IwyuFilter_include.yaml pyuno/IwyuFilter_pyuno.yaml

2025-10-17 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes  |1 +
 include/IwyuFilter_include.yaml |3 ---
 pyuno/IwyuFilter_pyuno.yaml |2 --
 3 files changed, 1 insertion(+), 5 deletions(-)

New commits:
commit 99324a10c8a89388128423a1cb6dd0fa7fb87bc9
Author: Gabor Kelemen 
AuthorDate: Fri Sep 19 21:45:51 2025 +0200
Commit: Gabor Kelemen 
CommitDate: Fri Sep 26 17:53:37 2025 +0200

bin/find-unneeded-includes: add exception for URE header

osl/file.hxx, so that these can be removed from per-module yaml files

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 6e66fe615056..674d0b45750d 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -104,6 +104,7 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules, 
noexclude):
 "rtl/byteseq.hxx": "rtl/byteseq.h",
 "typelib/typedescription.hxx": "typelib/typedescription.h",
 "cppuhelper/interfacecontainer.hxx": "cppuhelper/interfacecontainer.h",
+"osl/file.hxx": "osl/file.h",
 "osl/module.hxx": "osl/module.h",
 "osl/thread.hxx": "osl/thread.h"
 }
diff --git a/include/IwyuFilter_include.yaml b/include/IwyuFilter_include.yaml
index 05d7ecc3b71f..a0a053d78e78 100644
--- a/include/IwyuFilter_include.yaml
+++ b/include/IwyuFilter_include.yaml
@@ -874,9 +874,6 @@ excludelist:
 include/svx/svdtext.hxx:
 # TODO too many replacements would be needed
 - tools/weakbase.hxx
-include/codemaker/global.hxx:
-# Don't propose hxx -> h change in URE libs
-- osl/file.hxx
 include/comphelper/crashzone.hxx:
 # Needed for sig_atomic_t
 - csignal
diff --git a/pyuno/IwyuFilter_pyuno.yaml b/pyuno/IwyuFilter_pyuno.yaml
index ae6ab49ded9d..80c282dcf460 100644
--- a/pyuno/IwyuFilter_pyuno.yaml
+++ b/pyuno/IwyuFilter_pyuno.yaml
@@ -14,8 +14,6 @@ excludelist:
 - com/sun/star/container/XIndexAccess.hpp
 - cppuhelper/weakref.hxx
 pyuno/source/loader/pyuno_loader.cxx:
-# Don't replace with URE impl. detail
-- osl/file.hxx
 # Needed for direct member access
 - com/sun/star/uno/XComponentContext.hpp
 # Needed on WIN32


core.git: bin/find-unneeded-includes cppuhelper/IwyuFilter_cppuhelper.yaml dbaccess/IwyuFilter_dbaccess.yaml desktop/IwyuFilter_desktop.yaml framework/IwyuFilter_framework.yaml helpcompiler/IwyuFilter

2025-10-17 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes|5 +++--
 cppuhelper/IwyuFilter_cppuhelper.yaml |2 --
 dbaccess/IwyuFilter_dbaccess.yaml |3 ---
 desktop/IwyuFilter_desktop.yaml   |   12 
 framework/IwyuFilter_framework.yaml   |2 --
 helpcompiler/IwyuFilter_helpcompiler.yaml |2 --
 jvmfwk/IwyuFilter_jvmfwk.yaml |8 
 sc/IwyuFilter_sc.yaml |5 -
 svx/IwyuFilter_svx.yaml   |3 ---
 sw/IwyuFilter_sw.yaml |3 ---
 vcl/IwyuFilter_vcl.yaml   |6 --
 xmlsecurity/IwyuFilter_xmlsecurity.yaml   |3 ---
 12 files changed, 3 insertions(+), 51 deletions(-)

New commits:
commit c1cb3276e709710d5f1894090659ee8118c48266
Author: Gabor Kelemen 
AuthorDate: Mon Sep 15 22:33:09 2025 +0200
Commit: Miklos Vajna 
CommitDate: Wed Sep 24 12:09:52 2025 +0200

bin/find-unneeded-includes: add exception for URE headers as well

so that these can be removed from per-module yaml files

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 369a30d80086..fc45b68f7cac 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -94,12 +94,13 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules, 
noexclude):
 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
+# Avoid .hxx to .h proposals in basic css/uno/* and basic URE 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"
+"com/sun/star/uno/Type.hxx": "com/sun/star/uno/Type.h",
+"osl/thread.hxx": "osl/thread.h"
 }
 for k, v in unoapi.items():
 if include == k and v in toAdd:
diff --git a/cppuhelper/IwyuFilter_cppuhelper.yaml 
b/cppuhelper/IwyuFilter_cppuhelper.yaml
index e42f1aa8601c..cbae100fb19d 100644
--- a/cppuhelper/IwyuFilter_cppuhelper.yaml
+++ b/cppuhelper/IwyuFilter_cppuhelper.yaml
@@ -16,8 +16,6 @@ excludelist:
 cppuhelper/source/bootstrap.cxx:
 # Needed on win32
 - o3tl/char16_t2wchar_t.hxx
-# Don't replace hxx -> h in URE API
-- osl/thread.hxx
 cppuhelper/source/defaultbootstrap.cxx:
 # Needed for template specialization
 - com/sun/star/lang/XSingleComponentFactory.hpp
diff --git a/dbaccess/IwyuFilter_dbaccess.yaml 
b/dbaccess/IwyuFilter_dbaccess.yaml
index afd00322e626..f4378245d1d2 100644
--- a/dbaccess/IwyuFilter_dbaccess.yaml
+++ b/dbaccess/IwyuFilter_dbaccess.yaml
@@ -105,9 +105,6 @@ excludelist:
 dbaccess/source/ui/dlg/UserAdmin.cxx:
 # Needed for template
 - com/sun/star/sdbc/XDriver.hpp
-dbaccess/source/ui/dlg/dbfindex.cxx:
-# Keep for osl_getThreadTextEncoding
-- osl/thread.hxx
 dbaccess/source/ui/dlg/odbcconfig.cxx:
 # Needed for HAVE_ODBC_ADMINISTRATION on WIN32
 - config_folders.h
diff --git a/desktop/IwyuFilter_desktop.yaml b/desktop/IwyuFilter_desktop.yaml
index 63740e64360d..adcd3d62552c 100644
--- a/desktop/IwyuFilter_desktop.yaml
+++ b/desktop/IwyuFilter_desktop.yaml
@@ -4,9 +4,6 @@ excludelist:
 desktop/inc/lib/init.hxx:
 # Complete type is needed
 - boost/property_tree/ptree.hpp
-desktop/source/offacc/acceptor.hxx:
-# Don't propose hxx -> h change in URE libs
-- osl/thread.hxx
 desktop/qa/desktop_lib/test_desktop_lib.cxx:
 # Actually used
 - rtl/math.hxx
@@ -29,9 +26,6 @@ excludelist:
 desktop/source/app/crashreport.cxx:
 # Needed on WIN32
 - o3tl/char16_t2wchar_t.hxx
-desktop/source/app/dispatchwatcher.cxx:
-# Don't propose hxx -> h change in URE libs
-- osl/thread.hxx
 desktop/source/app/sofficemain.cxx:
 # Might be needed on WIN32
 - prewin.h
@@ -88,9 +82,3 @@ excludelist:
 desktop/source/deployment/registry/help/dp_help.cxx:
 # Actually used
 - com/sun/star/util/XMacroExpander.hpp
-desktop/source/lib/lokandroid.cxx:
-# Needed for osl_getThreadTextEncoding
-- osl/thread.hxx
-desktop/source/deployment/misc/dp_misc.cxx:
-# Needed for osl_getThreadTextEncoding
-- osl/thread.hxx
diff --git a/framework/IwyuFilter_framework.yaml 
b/framework/IwyuFilter_framework.yaml
index c18fd72cbcf3..317551896c0c 100644
--- a/framework/IwyuFilter_framework.yaml
+++ b/framework/IwyuFilter_framework.yaml
@@ -59,8 +59,6 @@ excludelist:
 - com/sun/star/ui/DockingArea.hpp
 - com/sun/star/ui/XUIElement.hpp
 framework/source/services/substitutepathvars.cxx:
-#  Don't propose hxx -> h change 

core.git: bin/find-unneeded-includes

2025-10-17 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit e985c30dc49ffb8da5cecd5525a49e8cdd4629ea
Author: Gabor Kelemen 
AuthorDate: Mon Sep 22 23:55:35 2025 +0200
Commit: Gabor Kelemen 
CommitDate: Fri Oct 3 16:21:58 2025 +0200

bin/find-unneeded-includes: Catch stale file names without exclusions

As seen in sd/IwyuFilter_sd.yaml, some files may lose all
their exclusions due to refactoring, yet their name is not
removed from the yaml file

Now we give a warning about this situation

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 04db6e5f1cd6..b8695fa8a846 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -631,10 +631,13 @@ def main(argv):
 # check that the excluded files / forward declarations are 
still present
 # to avoid stale exclusion rules lingering forever
 else:
-for exclusion in excludelistRules[pathname]:
-p = subprocess.run(["git", "grep", "-q", "-e", 
"#include <"+exclusion, "-e", exclusion, file])
-if p.returncode == 1 :
-print("WARNING:", exclusion, "is not present 
anymore in", file)
+try:
+for exclusion in excludelistRules[pathname]:
+p = subprocess.run(["git", "grep", "-q", "-e", 
"#include <"+exclusion, "-e", exclusion, file])
+if p.returncode == 1 :
+print("WARNING:", exclusion, "is not present 
anymore in", file)
+except TypeError:
+print("WARNING: no exclusions are defined for:", file)
 sys.exit(0)
 
 tidy(compileCommands, paths=list_of_files, 
dontstop=vars(args)["continue"], noexclude=args.noexclude, 
checknamespaces=args.ns, finderrors=args.finderrors, removefwdd=args.fwdecl)


core.git: bin/find-unneeded-includes slideshow/IwyuFilter_slideshow.yaml

2025-10-14 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes  |2 ++
 slideshow/IwyuFilter_slideshow.yaml |3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

New commits:
commit a103d926434f461f7b273369eea401fc68c0f5de
Author: Gabor Kelemen 
AuthorDate: Fri Oct 3 08:26:43 2025 +0200
Commit: Gabor Kelemen 
CommitDate: Tue Oct 14 11:04:01 2025 +0200

bin/find-unneeded-includes: don't trip on BOX2D_HEADER in --sanitycheck

This is tricky because a header name is defined in a macro
and I had an exclusion for this external libs wrapper header.

But --sanitycheck does not see that, as it looks for presence of
exclusion list items.

Move the exclusion into the script, so that find-unneeded-includes
ignores it when checking the IWYU output and --sanitycheck does not
have to deal with this special rare case

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index d1e7c8ad0d8d..423aa4eae64b 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -131,6 +131,8 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules, 
noexclude):
 return True
 if include == "libetonyek/libetonyek.h" and "libetonyek/EtonyekDocument.h" 
in toAdd:
 return True
+if include == "box2d/box2d.h" and "box2d/b2_world.h" in toAdd:
+return True
 
 noRemove = (
 #  insists on 
not
diff --git a/slideshow/IwyuFilter_slideshow.yaml 
b/slideshow/IwyuFilter_slideshow.yaml
index 6581db9743fb..6fec72c4eb9f 100644
--- a/slideshow/IwyuFilter_slideshow.yaml
+++ b/slideshow/IwyuFilter_slideshow.yaml
@@ -11,9 +11,6 @@ excludelist:
 - config_lgpl.h
 # Wrapper for external lib
 - glm/gtc/type_ptr.hpp
-slideshow/source/engine/box2dtools.cxx:
-# Macro BOX2D_HEADER is resolved to this
-- box2d/box2d.h
 slideshow/source/engine/opengl/Operation.cxx:
 # Wrapper for external lib
 - glm/gtc/matrix_transform.hpp


core.git: bin/find-unneeded-includes

2025-10-14 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 994e4d464d3acc892a48bfc40c0ad694f7046be3
Author: Gabor Kelemen 
AuthorDate: Fri Oct 3 16:02:01 2025 +0200
Commit: Gabor Kelemen 
CommitDate: Tue Oct 14 11:03:22 2025 +0200

bin/find-unneeded-includes: better warning message

about obsolete exclusions in --sanitycheck mode

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 62786fb4fa87..d1e7c8ad0d8d 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -671,11 +671,11 @@ def main(argv):
 classname=c.group(1)
 p = subprocess.run(["git", "grep", "-q", "-e", 
"#include <"+exclusion, "-e", exclusion, "-e", classname, file])
 if p.returncode == 1 :
-print("WARNING:", exclusion, "is not 
present anymore in", file)
+print("WARNING:", file, ":", exclusion, 
"line is not present anymore, remove it from:", rulePath)
 else:
 p = subprocess.run(["git", "grep", "-q", "-e", 
"#include <"+exclusion, "-e", exclusion, file])
 if p.returncode == 1 :
-print("WARNING:", exclusion, "is not 
present anymore in", file)
+print("WARNING:", file, ":", exclusion, 
"line is not present anymore, remove it from:", rulePath)
 except TypeError:
 print("WARNING: no exclusions are defined for:", file)
 sys.exit(0)


core.git: bin/find-unneeded-includes sc/IwyuFilter_sc.yaml sw/IwyuFilter_sw.yaml

2025-10-07 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |9 +
 sc/IwyuFilter_sc.yaml  |   15 ++-
 sw/IwyuFilter_sw.yaml  |   13 +
 3 files changed, 20 insertions(+), 17 deletions(-)

New commits:
commit 12fa2f3cc407450970095900338f730b6a86a938
Author: Gabor Kelemen 
AuthorDate: Wed Oct 1 23:38:14 2025 +0200
Commit: Miklos Vajna 
CommitDate: Tue Oct 7 11:00:22 2025 +0200

bin/find-unneeded-includes: extend --sanitycheck for duplicate entries

If a filename appears twice in the exclusions list
then the exclusion mechanics won't work upon the next normal check

So report this situation in --sanitycheck mode

Clean sw and sc as proof of concept

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index d2874a84a1e0..76daaabb67c2 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -636,6 +636,15 @@ def main(argv):
 moduleRules = {}
 if os.path.exists(rulePath):
 moduleRules = yaml.full_load(open(rulePath))
+# Check for duplicate file name entries in the yaml file
+p1 = subprocess.Popen(['git', 'grep', '-h', ':$', rulePath ], 
stdout=subprocess.PIPE)
+p2 = subprocess.Popen(['sort'], stdin=p1.stdout, 
stdout=subprocess.PIPE)
+p3 = subprocess.Popen(['uniq', '-d'], stdin=p2.stdout, 
stdout=subprocess.PIPE)
+p1.stdout.close()
+p2.stdout.close()
+output, _ = p3.communicate()
+if output:
+print("WARNING: The following files have duplicate entries - 
Please merge them - in:", rulePath, "
", re.sub(r'[: ]+', '', output.decode()).strip())
 if "excludelist" in moduleRules.keys():
 excludelistRules = moduleRules["excludelist"]
 for pathname in excludelistRules.keys():
diff --git a/sc/IwyuFilter_sc.yaml b/sc/IwyuFilter_sc.yaml
index e0819eb76e66..ec49f2b22f0d 100644
--- a/sc/IwyuFilter_sc.yaml
+++ b/sc/IwyuFilter_sc.yaml
@@ -637,6 +637,8 @@ excludelist:
 sc/source/ui/vba/vbarange.cxx:
 # Needed for linker visibility of range::serviceDecl
 - service.hxx
+# Actually used
+- com/sun/star/uno/XComponentContext.hpp
 sc/source/ui/vba/vbasheetobjects.hxx:
 # base class has to be a complete type
 - ooo/vba/excel/XGraphicObjects.hpp
@@ -662,12 +664,16 @@ excludelist:
 sc/source/ui/vba/vbaworkbooks.cxx:
 # Needed for linker visibility of worksheet::serviceDecl
 - service.hxx
+# Actually used
+- com/sun/star/uno/XComponentContext.hpp
 sc/source/ui/vba/vbaworksheet.hxx:
 # base class has to be a complete type
 - ooo/vba/excel/XWorksheet.hpp
 sc/source/ui/vba/vbaworksheet.cxx:
 # Needed for linker visibility of workbook::serviceDecl
 - service.hxx
+# Actually used
+- com/sun/star/beans/XIntrospectionAccess.hpp
 sc/source/ui/vba/vbaworksheets.hxx:
 # base class has to be a complete type
 - ooo/vba/excel/XWorksheets.hpp
@@ -1068,18 +1074,9 @@ excludelist:
 sc/source/ui/vba/vbapagebreaks.cxx:
 # Actually used
 - com/sun/star/uno/XComponentContext.hpp
-sc/source/ui/vba/vbaworkbooks.cxx:
-# Actually used
-- com/sun/star/uno/XComponentContext.hpp
 sc/source/ui/vba/vbawsfunction.cxx:
 # Actually used
 - com/sun/star/beans/XIntrospectionAccess.hpp
-sc/source/ui/vba/vbarange.cxx:
-# Actually used
-- com/sun/star/uno/XComponentContext.hpp
-sc/source/ui/vba/vbaworksheet.cxx:
-# Actually used
-- com/sun/star/beans/XIntrospectionAccess.hpp
 sc/source/ui/view/viewfun4.cxx:
 # Needed for direct member access
 - refundo.hxx
diff --git a/sw/IwyuFilter_sw.yaml b/sw/IwyuFilter_sw.yaml
index 0b7671bd5e43..10a8b2b62499 100644
--- a/sw/IwyuFilter_sw.yaml
+++ b/sw/IwyuFilter_sw.yaml
@@ -400,6 +400,8 @@ excludelist:
 # Needed for direct member access
 - com/sun/star/graphic/XGraphic.hpp
 - com/sun/star/text/TableColumnSeparator.hpp
+# Required in C++20 mode.
+- o3tl/cppunittraitshelper.hxx
 sw/qa/extras/ooxmlexport/ooxmlexport2.cxx:
 # Needed for direct member access
 - com/sun/star/awt/XBitmap.hpp
@@ -434,6 +436,8 @@ excludelist:
 sw/qa/extras/uiwriter/uiwriter.cxx:
 # Needed for for-loop range
 - PostItMgr.hxx
+# Required in C++20 mode.
+- o3tl/cppunittraitshelper.hxx
 sw/qa/extras/uiwriter/uiwriter4.cxx:
 # Needed in C++20 mode
 - o3tl/cppunittraitshelper.hxx
@@ -562,6 +566,7 @@ excludelist:
 sw/source/filter/ww8/docxtablestyleexport.cxx:
 # Actually used
 - com/sun/star/beans/PropertyValue.hpp
+- com/sun/star/frame/XModel.hpp
 sw/source/filter/ww8/docxexport.cxx:
 # Actually used
 - com/sun/star/drawing/XShape.hpp
@@ -813,8 +818,6 @@ excludelist:
 - com/sun/

core.git: bin/find-unneeded-includes

2025-10-02 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |   42 +++---
 1 file changed, 23 insertions(+), 19 deletions(-)

New commits:
commit 1d1c6693a64a69d0165c476d2c48962b6f9278c0
Author: Gabor Kelemen 
AuthorDate: Sun Sep 21 17:05:23 2025 +0200
Commit: Gabor Kelemen 
CommitDate: Thu Oct 2 10:11:40 2025 +0200

bin/find-unneeded-includes: Hide sanity checking of yaml files

behind a new --sanitycheck option

As this is now a somewhat expensive operation to run every time

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 4aab4183afd6..04db6e5f1cd6 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -571,6 +571,8 @@ def main(argv):
 'Use only for debugging this script!')
 parser.add_argument('--fwdecl', action='store_true',
 help='Suggest removal of obsolete forward declarations')
+parser.add_argument('--sanitycheck', action='store_true',
+help='Sanity check of IwyuFilter_foo.yaml of a module')
 
 args = parser.parse_args()
 
@@ -613,25 +615,27 @@ def main(argv):
 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 = {}
-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)
-# If the file mentioned in the IwyuFilter file exists,
-# check that the excluded files / forward declarations are still 
present
-# to avoid stale exclusion rules lingering forever
-else:
-for exclusion in excludelistRules[pathname]:
-p = subprocess.run(["git", "grep", "-q", "-e", "#include 
<"+exclusion, "-e", exclusion, file])
-if p.returncode == 1 :
-print("WARNING:", exclusion, "is not present anymore 
in", file)
+if args.sanitycheck:
+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)
+# If the file mentioned in the IwyuFilter file exists,
+# check that the excluded files / forward declarations are 
still present
+# to avoid stale exclusion rules lingering forever
+else:
+for exclusion in excludelistRules[pathname]:
+p = subprocess.run(["git", "grep", "-q", "-e", 
"#include <"+exclusion, "-e", exclusion, file])
+if p.returncode == 1 :
+print("WARNING:", exclusion, "is not present 
anymore in", file)
+sys.exit(0)
 
 tidy(compileCommands, paths=list_of_files, 
dontstop=vars(args)["continue"], noexclude=args.noexclude, 
checknamespaces=args.ns, finderrors=args.finderrors, removefwdd=args.fwdecl)
 


core.git: bin/find-unneeded-includes io/IwyuFilter_io.yaml vcl/IwyuFilter_vcl.yaml

2025-09-26 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |2 ++
 io/IwyuFilter_io.yaml  |1 -
 vcl/IwyuFilter_vcl.yaml|3 ---
 3 files changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 6a5a55c9ce0699ea135c2b98eb6410a92e3182b7
Author: Gabor Kelemen 
AuthorDate: Fri Sep 19 21:49:33 2025 +0200
Commit: Gabor Kelemen 
CommitDate: Fri Sep 26 19:17:54 2025 +0200

bin/find-unneeded-includes: add exception for URE header

osl/socket.hxx, so that these can be removed from per-module yaml files

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 674d0b45750d..717048bfb16d 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -106,6 +106,8 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules, 
noexclude):
 "cppuhelper/interfacecontainer.hxx": "cppuhelper/interfacecontainer.h",
 "osl/file.hxx": "osl/file.h",
 "osl/module.hxx": "osl/module.h",
+"osl/socket.hxx": "osl/socket.h",
+"osl/socket.hxx": "osl/socket_decl.hxx",
 "osl/thread.hxx": "osl/thread.h"
 }
 for k, v in unoapi.items():
diff --git a/io/IwyuFilter_io.yaml b/io/IwyuFilter_io.yaml
index 0f99498fc73e..673a1b3088e2 100644
--- a/io/IwyuFilter_io.yaml
+++ b/io/IwyuFilter_io.yaml
@@ -6,5 +6,4 @@ excludelist:
 - com/sun/star/connection/XConnection.hpp
 - com/sun/star/connection/XConnectionBroadcaster.hpp
 # Don't replace with impl. detail
-- osl/socket.hxx
 - osl/pipe.hxx
diff --git a/vcl/IwyuFilter_vcl.yaml b/vcl/IwyuFilter_vcl.yaml
index 918a18505ef9..ab5c1949ad87 100644
--- a/vcl/IwyuFilter_vcl.yaml
+++ b/vcl/IwyuFilter_vcl.yaml
@@ -1,9 +1,6 @@
 ---
 assumeFilename: vcl/source/app/svapp.cxx
 excludelist:
-vcl/inc/unx/gendata.hxx:
-# Don't propose hxx -> h change in URE libs
-- osl/socket.hxx
 vcl/inc/unx/saldisp.hxx:
 # Don't replace with generated header
 - epoxy/glx.h


core.git: bin/find-unneeded-includes i18npool/IwyuFilter_i18npool.yaml jvmfwk/IwyuFilter_jvmfwk.yaml sfx2/IwyuFilter_sfx2.yaml

2025-09-26 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes|1 +
 i18npool/IwyuFilter_i18npool.yaml |5 -
 jvmfwk/IwyuFilter_jvmfwk.yaml |2 --
 sfx2/IwyuFilter_sfx2.yaml |2 --
 4 files changed, 1 insertion(+), 9 deletions(-)

New commits:
commit a789ea255437401403ca6ac591692a0be1fe9500
Author: Gabor Kelemen 
AuthorDate: Fri Sep 19 21:35:12 2025 +0200
Commit: Gabor Kelemen 
CommitDate: Fri Sep 26 09:39:57 2025 +0200

bin/find-unneeded-includes: add exception for URE header

osl/module.hxx, so that these can be removed from per-module yaml files

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index bbe792961a55..6e66fe615056 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -104,6 +104,7 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules, 
noexclude):
 "rtl/byteseq.hxx": "rtl/byteseq.h",
 "typelib/typedescription.hxx": "typelib/typedescription.h",
 "cppuhelper/interfacecontainer.hxx": "cppuhelper/interfacecontainer.h",
+"osl/module.hxx": "osl/module.h",
 "osl/thread.hxx": "osl/thread.h"
 }
 for k, v in unoapi.items():
diff --git a/i18npool/IwyuFilter_i18npool.yaml 
b/i18npool/IwyuFilter_i18npool.yaml
index 66874f511493..8b91f492db66 100644
--- a/i18npool/IwyuFilter_i18npool.yaml
+++ b/i18npool/IwyuFilter_i18npool.yaml
@@ -51,8 +51,6 @@ excludelist:
 # Base class needs complete type
 - com/sun/star/i18n/XLocaleData5.hpp
 - com/sun/star/lang/XServiceInfo.hpp
-# Don't propose hxx -> h change in URE libs
-- osl/module.hxx
 i18npool/inc/numberformatcode.hxx:
 # Base class needs complete type
 - com/sun/star/i18n/XNumberFormatCode.hpp
@@ -65,9 +63,6 @@ excludelist:
 # Base class needs complete type
 - com/sun/star/i18n/XExtendedTextConversion.hpp
 - com/sun/star/lang/XServiceInfo.hpp
-i18npool/inc/textToPronounce_zh.hxx:
-# Don't propose hxx -> h change in URE libs
-- osl/module.hxx
 i18npool/inc/transliterationImpl.hxx:
 # Base class needs complete type
 - com/sun/star/i18n/XExtendedTransliteration.hpp
diff --git a/jvmfwk/IwyuFilter_jvmfwk.yaml b/jvmfwk/IwyuFilter_jvmfwk.yaml
index 7cdc92a50cee..bbdfe0b9c247 100644
--- a/jvmfwk/IwyuFilter_jvmfwk.yaml
+++ b/jvmfwk/IwyuFilter_jvmfwk.yaml
@@ -16,5 +16,3 @@ excludelist:
 jvmfwk/plugins/sunmajor/pluginlib/util.cxx:
 # Needed on MACOSX
 - config_folders.h
-# Don't replace with URE impl. detail
-- osl/module.hxx
diff --git a/sfx2/IwyuFilter_sfx2.yaml b/sfx2/IwyuFilter_sfx2.yaml
index 8e884bc29cb3..0daa2d57b17d 100644
--- a/sfx2/IwyuFilter_sfx2.yaml
+++ b/sfx2/IwyuFilter_sfx2.yaml
@@ -72,8 +72,6 @@ excludelist:
 # Needed on WIN32
 - sfx2/sfxresid.hxx
 - sfx2/strings.hrc
-# Don't propose hxx -> h change in URE libs
-- osl/module.hxx
 sfx2/source/bastyp/fltfnc.cxx:
 # Needed for UnoType to work
 - com/sun/star/task/XInteractionHandler.hpp


core.git: bin/find-unneeded-includes bridges/IwyuFilter_bridges.yaml

2025-09-25 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes  |1 +
 bridges/IwyuFilter_bridges.yaml |6 --
 2 files changed, 1 insertion(+), 6 deletions(-)

New commits:
commit 49a16629a4d4399057ec1e14b3947df2e2251258
Author: Gabor Kelemen 
AuthorDate: Fri Sep 19 21:13:14 2025 +0200
Commit: Gabor Kelemen 
CommitDate: Thu Sep 25 12:40:41 2025 +0200

bin/find-unneeded-includes: add exception for URE header

typelib/typedescription.hxx, so that these can be removed from per-module 
yaml files

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 5340bdfdf0f9..bbe792961a55 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -102,6 +102,7 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules, 
noexclude):
 "com/sun/star/uno/Type.hxx": "com/sun/star/uno/Type.h",
 "rtl/bootstrap.hxx": "rtl/bootstrap.h",
 "rtl/byteseq.hxx": "rtl/byteseq.h",
+"typelib/typedescription.hxx": "typelib/typedescription.h",
 "cppuhelper/interfacecontainer.hxx": "cppuhelper/interfacecontainer.h",
 "osl/thread.hxx": "osl/thread.h"
 }
diff --git a/bridges/IwyuFilter_bridges.yaml b/bridges/IwyuFilter_bridges.yaml
index 92bb94d9a1e4..265e5c381213 100644
--- a/bridges/IwyuFilter_bridges.yaml
+++ b/bridges/IwyuFilter_bridges.yaml
@@ -1,15 +1,9 @@
 ---
 assumeFilename: bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx
 excludelist:
-bridges/source/cpp_uno/gcc3_linux_x86-64/abi.hxx:
-# No .hxx -> .h replacement in URE headers
-- typelib/typedescription.hxx
 bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx:
 # Actually needed to not crash in fuzzing
 - cxxabi.h
-bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx:
-# No .hxx -> .h replacement in URE headers
-- typelib/typedescription.hxx
 bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx:
 # Actually needed for ifdefs to work in all cases
 - share.hxx


core.git: bin/find-unneeded-includes pyuno/IwyuFilter_pyuno.yaml

2025-09-25 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes  |1 +
 pyuno/IwyuFilter_pyuno.yaml |2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 93d74ca5749f6194c87e8ca9732ce7d931222a6a
Author: Gabor Kelemen 
AuthorDate: Fri Sep 19 11:28:04 2025 +0200
Commit: Gabor Kelemen 
CommitDate: Thu Sep 25 09:38:45 2025 +0200

bin/find-unneeded-includes: add exception for URE header

rtl/bootstrap.hxx, so that these can be removed from per-module yaml files

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 7c19119088b2..5340bdfdf0f9 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -100,6 +100,7 @@ def ignoreRemoval(include, toAdd, absFileName, moduleRules, 
noexclude):
 "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",
+"rtl/bootstrap.hxx": "rtl/bootstrap.h",
 "rtl/byteseq.hxx": "rtl/byteseq.h",
 "cppuhelper/interfacecontainer.hxx": "cppuhelper/interfacecontainer.h",
 "osl/thread.hxx": "osl/thread.h"
diff --git a/pyuno/IwyuFilter_pyuno.yaml b/pyuno/IwyuFilter_pyuno.yaml
index 6e3a5df38bbe..ae6ab49ded9d 100644
--- a/pyuno/IwyuFilter_pyuno.yaml
+++ b/pyuno/IwyuFilter_pyuno.yaml
@@ -23,8 +23,6 @@ excludelist:
 pyuno/source/module/pyuno_module.cxx:
 # Needed on MACOSX
 - config_folders.h
-# Don't replace with URE impl. detail
-- rtl/bootstrap.hxx
 pyuno/source/module/pyuno_runtime.cxx:
 # Needed on MACOSX
 - config_folders.h


core.git: bin/find-unneeded-includes

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

New commits:
commit 1524c08a52b6284c8d855030bff304f09b664984
Author: Gabor Kelemen 
AuthorDate: Mon Jun 16 10:30:49 2025 +0200
Commit: Miklos Vajna 
CommitDate: Tue Jun 17 14:47:02 2025 +0200

bin/find-unneeded-includes: fix "SyntaxWarning: invalid escape sequence"

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index fc1473ccf0e8..369a30d80086 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -253,7 +253,7 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName, 
noexclude, checknamespa
 # and ooo::vba namespaces
 # plus a few popular ones about other modules
 ns = re.compile(
-'.*for\ ('
+'.*for\ ('
 # URE namespaces
 'beans|'
 'bridge|oleautomation|'


core.git: bin/find-unneeded-includes vcl/inc vcl/IwyuFilter_vcl.yaml vcl/qt5

2025-06-02 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes|8 
 vcl/IwyuFilter_vcl.yaml   |   19 ---
 vcl/inc/qt5/QtX11Support.hxx  |2 +-
 vcl/qt5/QtAccessibleEventListener.cxx |1 -
 vcl/qt5/QtAccessibleWidget.cxx|2 --
 vcl/qt5/QtBitmap.cxx  |3 ---
 vcl/qt5/QtBuilder.cxx |4 +---
 vcl/qt5/QtClipboard.cxx   |2 --
 vcl/qt5/QtCustomStyle.cxx |3 ++-
 vcl/qt5/QtData.cxx|1 -
 vcl/qt5/QtDragAndDrop.cxx |4 
 vcl/qt5/QtFilePicker.cxx  |7 ---
 vcl/qt5/QtFont.cxx|1 -
 vcl/qt5/QtFontFace.cxx|4 
 vcl/qt5/QtFrame.cxx   |5 -
 vcl/qt5/QtGraphics_Controls.cxx   |1 -
 vcl/qt5/QtGraphics_GDI.cxx|3 ---
 vcl/qt5/QtInstance.cxx|2 --
 vcl/qt5/QtInstanceEntryTreeView.cxx   |2 --
 vcl/qt5/QtInstanceLabel.cxx   |2 --
 vcl/qt5/QtInstanceLevelBar.cxx|2 --
 vcl/qt5/QtInstanceMenu.cxx|1 -
 vcl/qt5/QtInstanceWidget.cxx  |1 -
 vcl/qt5/QtInstance_Print.cxx  |5 -
 vcl/qt5/QtMenu.cxx|1 -
 vcl/qt5/QtObject.cxx  |1 -
 vcl/qt5/QtSvpGraphics.cxx |3 ---
 vcl/qt5/QtSvpSurface.cxx  |3 ---
 vcl/qt5/QtTimer.cxx   |1 -
 vcl/qt5/QtTransferable.cxx|2 --
 vcl/qt5/QtWidget.cxx  |6 +-
 vcl/qt5/QtX11Support.cxx  |3 ---
 vcl/qt5/QtXAccessible.cxx |7 ---
 33 files changed, 25 insertions(+), 87 deletions(-)

New commits:
commit 6cf20bff7284f3c72fa74c3427115c61edecbe08
Author: Gabor Kelemen 
AuthorDate: Sun Jun 1 12:41:44 2025 +0200
Commit: Gabor Kelemen 
CommitDate: Mon Jun 2 15:37:47 2025 +0200

find-unneeded-includes: handle IWYU warnings about Qt headers

Second try after https://gerrit.libreoffice.org/c/core/+/179708

Skip all QT headers in the form of QtLib/QClass, clean the
vcl/qt5 dir from LO-internal headers

Change-Id: Icf9edd1f617adc06dcb6ba6bcc4aa0debc275ab1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186107
Reviewed-by: Gabor Kelemen 
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 100ee38c6672..fc1473ccf0e8 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -105,6 +105,14 @@ def ignoreRemoval(include, toAdd, absFileName, 
moduleRules, noexclude):
 if include == k and v in toAdd:
 return True
 
+# Most Qt headers are used as  and IWYU suggests
+# them to be replaced with QtLib/qclass.h, these could be skipped
+# BUT: Several Qt 6 minor versions are supported,
+# making testing of false positives over-expensive
+# so just skip all those headers for now
+if include.startswith("Qt") and '/' in include:
+return True
+
 # 3rd-party, non-self-contained headers.
 if include == "libepubgen/libepubgen.h" and 
"libepubgen/libepubgen-decls.h" in toAdd:
 return True
diff --git a/vcl/IwyuFilter_vcl.yaml b/vcl/IwyuFilter_vcl.yaml
index 28f96567caf8..dd85fbbe767a 100644
--- a/vcl/IwyuFilter_vcl.yaml
+++ b/vcl/IwyuFilter_vcl.yaml
@@ -100,13 +100,6 @@ excludelist:
 # Actually these are used
 - KWindowSystem
 - KFileWidget
-- QtCore/QDebug
-- QtCore/QUrl
-- QtWidgets/QCheckBox
-- QtWidgets/QFileDialog
-- QtWidgets/QGridLayout
-- QtWidgets/QWidget
-- QtWidgets/QApplication
 vcl/unx/gtk3_kde5/kde5_lo_filepicker_main.cxx:
 # Actually these are used
 - QApplication
@@ -119,3 +112,15 @@ excludelist:
 vcl/qa/cppunit/filter/ipdf/ipdf.cxx:
 - prewin.h
 - postwin.h
+vcl/qt5/QtAccessibleWidget.cxx:
+# Needed for QT 6.9
+- com/sun/star/accessibility/XAccessibleContext2.hpp
+# Needed for QT 6.8
+- com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp
+# Actually used
+- com/sun/star/accessibility/XAccessibleContext.hpp
+vcl/qt5/QtInstance.cxx:
+# Needed for EMSCRIPTEN build
+- o3tl/temporary.hxx
+- o3tl/unreachable.hxx
+- comphelper/emscriptenthreading.hxx
diff --git a/vcl/inc/qt5/QtX11Support.hxx b/vcl/inc/qt5/QtX11Support.hxx
index d96c26a2eec4..e07ec7666f0b 100644
--- a/vcl/inc/qt5/QtX11Support.hxx
+++ b/vcl/inc/qt5/QtX11Support.hxx
@@ -11,7 +11,7 @@
 
 #include 
 
-#include 
+#include 
 
 class QtX11Support final
 {
diff --git a/vcl/qt5/QtAccessibleEventListener.cxx 
b/vcl/qt5/QtAccessibleEventListener.cxx
index b160b47e3093..dea9cd35401f 100644
--- a/vcl/qt5/QtAccessibleEventListener.cxx
+++ b/vcl/qt5/QtAccessibleEventListener.cxx
@@ -19,7 +19,6 @@
 
 #include 
 #include 
-#include 
 
 #include 
 
diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx
index 835b1ad7f883.

core.git: bin/find-unneeded-includes

2025-04-09 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit bd135e5f294ac58bda8007d1553202ae6f9b621f
Author: Gabor Kelemen 
AuthorDate: Fri Jan 3 22:53:49 2025 +0100
Commit: Miklos Vajna 
CommitDate: Wed Apr 9 13:31:37 2025 +0200

find-unneeded-includes: work around iwyu bug seen in --fwdecl mode

it suggests an empty string to remove, skip that
so that find-unneeded-includes does not crash

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index ec0a620c9090..100ee38c6672 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -226,6 +226,9 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName, 
noexclude, checknamespa
 match = re.match("- (.*;(?: })*)*  // lines (.*)-.*", line)
 if match:
 fwdDecl = match.group(1)
+# Bug: IWYU 0.23 gives "-   // lines 76-76" on 
basctl/source/inc/layout.hxx in --fwdecl mode
+if fwdDecl is None:
+continue
 if fwdDecl.endswith(";"):
 # Remove trailing semicolon.
 fwdDecl = fwdDecl[:-1]


core.git: bin/find-unneeded-includes

2025-01-01 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |   78 -
 1 file changed, 56 insertions(+), 22 deletions(-)

New commits:
commit cff2f182e4b30055661ef202e08f30a0c0af29ec
Author: Gabor Kelemen 
AuthorDate: Sun Dec 15 15:37:06 2024 +0100
Commit: Miklos Vajna 
CommitDate: Thu Jan 2 08:23:09 2025 +0100

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

This reverts commit cee2e455605bbb921e1e32201cc27af973cb775c.

Improve the forward declaration removal algorithm:
run IWYU without --no_fwd_decls but ignore the header removal suggestions

This way only the obsolete forward declarations are listed

Previously we did not have a way for telling apart needed and
unneeded forward declarations, now these can be cleaned out too

Put this mode behind a new command line switch: --fwdecl

Change-Id: I1b5659fd44253627adbaa7866178ddc000b1b5eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178966
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
Reviewed-by: Thorsten Behrens 

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index aa1d6301ecce..e93d62f38b8b 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -153,7 +153,7 @@ def unwrapInclude(include):
 return include[1:-1]
 
 
-def processIWYUOutput(iwyuOutput, moduleRules, fileName, noexclude, 
checknamespaces, finderrors):
+def processIWYUOutput(iwyuOutput, moduleRules, fileName, noexclude, 
checknamespaces, finderrors, removefwdd):
 inAdd = False
 toAdd = []
 inRemove = False
@@ -213,15 +213,26 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName, 
noexclude, checknamespa
 toAdd.append(line)
 
 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
-# 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, noexclude):
-toRemove.append("%s:%s: %s" % (currentFileName, lineno, 
include))
+if not removefwdd:
+match = re.match("- #include (.*)  // lines (.*)-.*", line)
+if match:
+include = unwrapInclude(match.group(1))
+lineno = match.group(2)
+if not ignoreRemoval(include, toAdd, currentFileName, 
moduleRules, noexclude):
+toRemove.append("%s:%s: %s" % (currentFileName, 
lineno, include))
+continue
+else:
+# Search for obsolete forward declarations, but not header -> 
fwdecl replacements
+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, noexclude):
+toRemove.append("%s:%s: %s" % (currentFileName, 
lineno, fwdDecl))
+continue
 
 if inFull:
 if checknamespaces:
@@ -398,25 +409,32 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName, 
noexclude, checknamespa
 # Get the row number, normal IWYU output does not contain 
this info
 subprocess.run(["git", "grep", "-n", 
"namespace.*[^a-zA-Z]"+nameSpace+" *;", fileName])
 
-for remove in sorted(toRemove):
-print("ERROR: %s: remove not needed include" % remove)
+if removefwdd:
+for remove in sorted(toRemove):
+print("ERROR: %s: remove not needed forward declaration" % remove)
+else:
+for remove in sorted(toRemove):
+print("ERROR: %s: remove not needed include" % remove)
 return len(toRemove)
 
 
-def run_tool(task_queue, failed_files, dontstop, noexclude, checknamespaces, 
finderrors):
+def run_tool(task_queue, failed_files, dontstop, noexclude, checknamespaces, 
finderrors, removefwdd):
 while True:
 invocation, moduleRules = task_queue.get()
 if not len(failed_files):
 print("[IWYU] " + invocation.split(' ')[-1])
 p = subprocess.Popen(invocation, shell=True, 
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
-retcode = 
processIWYUOutput(p.communicate()[0].decode('utf-8').splitlines(), moduleRules, 
invocation.split(' ')[-1], noexclude, checknamespaces, finderrors)
+retcode = 
proce

core.git: bin/find-unneeded-includes

2024-10-28 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 49f2b76f962c5cdbfb33f6f8fa08210676067af2
Author: Gabor Kelemen 
AuthorDate: Tue Oct 22 14:57:19 2024 +0200
Commit: Gabor Kelemen 
CommitDate: Mon Oct 28 10:39:41 2024 +0100

find-unneeded-includes: nicer output with --finderror option

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 93b71f5247bc..aa1d6301ecce 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -412,7 +412,7 @@ def run_tool(task_queue, failed_files, dontstop, noexclude, 
checknamespaces, fin
 retcode = 
processIWYUOutput(p.communicate()[0].decode('utf-8').splitlines(), moduleRules, 
invocation.split(' ')[-1], noexclude, checknamespaces, finderrors)
 if finderrors:
 if p.returncode == 1:
-print("Running the IWYU process returned error code:
",invocation)
+print("Running the IWYU process returned error code:
" + invocation)
 if retcode == -1 and not checknamespaces:
 print("ERROR: A file is probably not self contained, check 
this commands output:
" + invocation)
 elif retcode > 0:


core.git: bin/find-unneeded-includes

2024-10-17 Thread Gabor Kelemen (via logerrit)
 bin/find-unneeded-includes |   22 --
 1 file changed, 16 insertions(+), 6 deletions(-)

New commits:
commit 511d5a487dac2b815242035c10adbeb190ad0392
Author: Gabor Kelemen 
AuthorDate: Thu Oct 17 15:16:29 2024 +0200
Commit: Miklos Vajna 
CommitDate: Fri Oct 18 08:30:41 2024 +0200

find-unneeded-includes: add option to detect IWYU failures

In some cases IWYU may fail to run and give back -1 status
- A file does not have any headers included, such as
sw/source/ui/vba/vbawordbasic.hxx
- A header includes itself such as
sw/source/ui/vba/vbaformfielddropdownlistentries.hxx
- Checking headers is not called with correct -I switches
such as with sw/source/writerfilter/dmapper/*hxx misses
-I/home/gabor/core/sw/source/writerfilter/inc

Such cases were not handled/reported separately so far, so add a
debug-like option to detect similar errors.

Solving such issues is still down the road.

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

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 718ee67a2561..93b71f5247bc 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -153,7 +153,7 @@ def unwrapInclude(include):
 return include[1:-1]
 
 
-def processIWYUOutput(iwyuOutput, moduleRules, fileName, noexclude, 
checknamespaces):
+def processIWYUOutput(iwyuOutput, moduleRules, fileName, noexclude, 
checknamespaces, finderrors):
 inAdd = False
 toAdd = []
 inRemove = False
@@ -168,6 +168,10 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName, 
noexclude, checknamespa
 if re.match ("(.*): error: (.*)", line):
 return -1
 
+# Bail out if we are in finderrors mode
+if finderrors:
+return -2
+
 if len(line) == 0:
 if inRemove:
 inRemove = False
@@ -399,13 +403,16 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName, 
noexclude, checknamespa
 return len(toRemove)
 
 
-def run_tool(task_queue, failed_files, dontstop, noexclude, checknamespaces):
+def run_tool(task_queue, failed_files, dontstop, noexclude, checknamespaces, 
finderrors):
 while True:
 invocation, moduleRules = task_queue.get()
 if not len(failed_files):
 print("[IWYU] " + invocation.split(' ')[-1])
 p = subprocess.Popen(invocation, shell=True, 
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
-retcode = 
processIWYUOutput(p.communicate()[0].decode('utf-8').splitlines(), moduleRules, 
invocation.split(' ')[-1], noexclude, checknamespaces)
+retcode = 
processIWYUOutput(p.communicate()[0].decode('utf-8').splitlines(), moduleRules, 
invocation.split(' ')[-1], noexclude, checknamespaces, finderrors)
+if finderrors:
+if p.returncode == 1:
+print("Running the IWYU process returned error code:
",invocation)
 if retcode == -1 and not checknamespaces:
 print("ERROR: A file is probably not self contained, check 
this commands output:
" + invocation)
 elif retcode > 0:
@@ -431,7 +438,7 @@ def isInUnoIncludeFile(path):
 or path.startswith("include/uno/")
 
 
-def tidy(compileCommands, paths, dontstop, noexclude,checknamespaces):
+def tidy(compileCommands, paths, dontstop, noexclude, checknamespaces, 
finderrors):
 return_code = 0
 
 try:
@@ -439,7 +446,7 @@ def tidy(compileCommands, paths, dontstop, 
noexclude,checknamespaces):
 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, noexclude,checknamespaces))
+t = threading.Thread(target=run_tool, args=(task_queue, 
failed_files, dontstop, noexclude, checknamespaces, finderrors))
 t.daemon = True
 t.start()
 
@@ -511,6 +518,9 @@ def main(argv):
 help='Warn about unused "using namespace" statements. '
  'Removing these may uncover more removable headers '
  'in a subsequent normal run')
+parser.add_argument('--finderrors', action='store_true',
+   help='Report IWYU failures when it returns with -1 error 
code. '
+'Use only for debugging this script!')
 
 args = parser.parse_args()
 
@@ -559,7 +569,7 @@ def main(argv):
 if not file.exists():
 print("WARNING: File listed in " + rulePath + " no longer 
exists: " + pathname)
 
-tidy(compileCommands, paths=list_of_files, 
dontstop=vars(args)["continue"], noexclude=args.noexclude, 
checknamespaces=args.ns)
+tidy(compileCommands, paths=list_of_files, 
dontstop=vars(args)["continue"], noexclude=args.noexclude, 
c

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-18 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-24 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, dontstop=vars(args)["continue"

[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 28782147fb9e..f4530e2a139

[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
[email protected]
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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-06-27 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
[email protected]
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
[email protected]
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 getPathSegment(i

[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
[email protected]
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
[email protected]
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
[email protected]
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; }
 sd/source/ui/framework/factories/ChildWindowPan

[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
[email protected]
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
[email protected]
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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-06-16 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
[email protected]
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
[email protected]
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
[email protected]
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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-05-30 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
[email protected]
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
[email protected]
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
[email protected]
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
[email protected]
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
[email protected]
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
[email protected]
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
[email protected]
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
[email protected]
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
[email protected]
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
[email protected]
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
[email protected]
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
+++ b/sc

[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
[email protected]
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
[email protected]
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
[email protected]
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
[email protected]
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
[email protected]
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
[email protected]
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
[email protected]
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
[email protected]
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
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -115,6 +115,7 @@ namespace o3tl

[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
[email protected]
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
+
+if inAdd:
+match = re.match('#include ([^ ]+)'