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 <[email protected]>
AuthorDate: Wed Oct 1 23:38:14 2025 +0200
Commit:     Miklos Vajna <[email protected]>
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 <[email protected]>

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/star/beans/XPropertySet.hpp
     sw/source/filter/rtf/swparrtf.cxx:
     - com/sun/star/frame/XModel.hpp
-    sw/source/filter/ww8/docxtablestyleexport.cxx:
-    - com/sun/star/frame/XModel.hpp
     sw/source/filter/ww8/rtfexport.cxx:
     - com/sun/star/frame/XModel.hpp
     sw/source/filter/docx/swdocxreader.cxx:
@@ -830,15 +833,9 @@ excludelist:
     sw/qa/extras/ooxmlimport/ooxmlimport.cxx:
     # Required in C++20 mode.
     - o3tl/cppunittraitshelper.hxx
-    sw/qa/extras/ooxmlexport/ooxmlexport.cxx:
-    # Required in C++20 mode.
-    - o3tl/cppunittraitshelper.hxx
     sw/qa/extras/ooxmlexport/ooxmlexport5.cxx:
     # Required in C++20 mode.
     - o3tl/cppunittraitshelper.hxx
-    sw/qa/extras/uiwriter/uiwriter.cxx:
-    # Required in C++20 mode.
-    - o3tl/cppunittraitshelper.hxx
     sw/qa/extras/rtfexport/rtfexport4.cxx:
     # Required in C++20 mode.
     - o3tl/cppunittraitshelper.hxx

Reply via email to