find-unneeded-includes: improve grepping for namespaces

for example this was not found:

extensions/source/update/check/updatecheck.cxx:58:namespace frame = com::sun::frame ;

due to the missing using and the space before the semicolon
but IWYU correctly detected it as unused

Change-Id: I404c93d41aec1a571c9ac49db7b7c7e8da824bf6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165698
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
This commit is contained in:
Gabor Kelemen 2024-04-01 10:41:39 +02:00
parent a919a0aa4c
commit 6f10dc1101

View file

@ -392,7 +392,7 @@ def processIWYUOutput(iwyuOutput, moduleRules, fileName, noexclude, checknamespa
print("WARNING:", fileName, "This 'using namespace' is likely unnecessary:", nameSpace)
# Get the row number, normal IWYU output does not contain this info
subprocess.run(["git", "grep", "-n", "using namespace.*"+nameSpace+";", fileName])
subprocess.run(["git", "grep", "-n", "namespace.*[^a-zA-Z]"+nameSpace+" *;", fileName])
for remove in sorted(toRemove):
print("ERROR: %s: remove not needed include" % remove)