[binutils-gdb] [gdb] Increase clean range in check-whitespace-pre-commit.py

Tom de Vries via Gdb-cvs <[email protected]> Thu, 18 Jun 2026 20:07:04 +0000 (GMT)
Newsgroups gmane.comp.gdb.cvs
Message-ID <20260618200704.C3EDF4BA799B__8192.76212002791$1781813238$gmane$org@sourceware.org>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8bdf820be61c65ac3e439e68349a60660cdf8397

commit 8bdf820be61c65ac3e439e68349a60660cdf8397
Author: Tom de Vries <[email protected]>
Date:   Thu Jun 18 22:06:50 2026 +0200

    [gdb] Increase clean range in check-whitespace-pre-commit.py
    
    The list of files completely checked by check-whitespace-pre-commit.py is
    determined by this regexp:
    ...
    re_clean = re.compile(
        "(^(gdb/testsuite/|gdbsupport/|gdbserver/)|[.](m4|ac|def|[chly])$|NEWS)"
    )
    ...
    
    Turn this around, and add a todo list of files not completely whitespace clean
    yet, enabling complete checking for all other files.
    
    Approved-By: Tom Tromey <[email protected]>

Diff:
---
 .pre-commit-config.yaml                    |  1 +
 gdb/contrib/check-whitespace-pre-commit.py | 32 ++++++++++++++++++++++++++----
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 141451501ed..9910bbb82f2 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -117,6 +117,7 @@ repos:
       language: unsupported_script
       entry: gdb/contrib/check-whitespace-pre-commit.py
       files: '^(gdb(support|server)?)/.*$'
+      types: ['text']
     - id: &id3 pre-commit-setup
       name: *id3
       language: python
diff --git a/gdb/contrib/check-whitespace-pre-commit.py b/gdb/contrib/check-whitespace-pre-commit.py
index 128727d2ca6..fb4e4b8f537 100755
--- a/gdb/contrib/check-whitespace-pre-commit.py
+++ b/gdb/contrib/check-whitespace-pre-commit.py
@@ -18,15 +18,39 @@ import re
 import subprocess
 import sys
 
-re_clean = re.compile(
-    "(^(gdb/testsuite/|gdbsupport/|gdbserver/)|[.](m4|ac|def|[chly])$|NEWS)"
-)
+# Files to completely ignore.
+re_ignore = re.compile("ChangeLog")
+
+# Files that are not clean, so they're only checked when changes.
+todo_list = [
+    "gdb/config/djgpp/fnchange.lst",
+    "gdb/contrib/ari/create-web-ari-in-src.sh",
+    "gdb/gdb-gdb.gdb.in",
+    "gdb/config/djgpp/djcheck.sh",
+    "gdb/contrib/ari/gdb_ari.sh",
+    "gdb/features/sparc/sparc64-cp0.xml",
+    "gdb/features/sparc/sparc64-fpu.xml",
+    "gdb/configure.tgt",
+    "gdb/doc/annotate.texinfo",
+    "gdb/features/aarch64-pauth.xml",
+    "gdb/features/sparc/sparc32-fpu.xml",
+    "gdb/features/s390-core64.xml",
+    "gdb/features/sparc/sparc32-cp0.xml",
+    "gdb/config/djgpp/README",
+    "gdb/exc_request.defs",
+    "gdb/doc/refcard.tex",
+    "gdb/doc/stack_frame.txt",
+    "gdb/features/library-list-aix.dtd",
+]
 
 clean = []
 other = []
 for f in sys.argv[1:]:
-    m = re_clean.search(f)
+    m = re_ignore.search(f)
     if m:
+        continue
+
+    if f not in todo_list:
         clean.append(f)
     else:
         other.append(f)