Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [pushed] [gdb] Fix whitespace in shell scripts
@ 2026-09-03  6:16 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2026-09-03  6:16 UTC (permalink / raw)
  To: gdb-patches

I found out that there are no whitespace rules for script files in
.gitattributes.

Add these, and fix the fallout using the usual:
...
$ git rm -f $(find gdb* -name "*.sh")
$ git rm -f gdb/gcore-1.in
$ git commit -a -m tmp
$ git revert HEAD
$ git rebase --whitespace=fix HEAD^
$ git reset --soft HEAD^
$ git commit --amend
...
---
 gdb/.gitattributes             |  5 ++++
 gdb/config/djgpp/djcheck.sh    |  6 ++---
 gdb/config/djgpp/djconfig.sh   |  8 +++----
 gdb/contrib/gdb-add-index.sh   |  2 +-
 gdb/contrib/words.sh           |  2 +-
 gdb/gcore-1.in                 | 42 +++++++++++++++++-----------------
 gdb/syscalls/update-freebsd.sh |  2 +-
 gdb/syscalls/update-netbsd.sh  |  2 +-
 gdb/testsuite/.gitattributes   |  4 ++++
 9 files changed, 41 insertions(+), 32 deletions(-)

diff --git a/gdb/.gitattributes b/gdb/.gitattributes
index 5d22d1a040c..1c28f4b1517 100644
--- a/gdb/.gitattributes
+++ b/gdb/.gitattributes
@@ -20,7 +20,12 @@ aclocal.m4  -whitespace
 
 *.[ly]	whitespace=space-before-tab,indent-with-non-tab,trailing-space
 *.def	whitespace=space-before-tab,indent-with-non-tab,trailing-space
+*.sh    whitespace=space-before-tab,indent-with-non-tab,trailing-space
 po/gdbtext  whitespace=space-before-tab,indent-with-non-tab,trailing-space
+gcore-1.in  whitespace=space-before-tab,indent-with-non-tab,trailing-space
+gstack-1.in whitespace=space-before-tab,indent-with-non-tab,trailing-space
+make-init-c whitespace=space-before-tab,indent-with-non-tab,trailing-space
+testsuite/lib/notty-wrap whitespace=space-before-tab,indent-with-non-tab,trailing-space
 
 # Imported files.
 exc_request.defs -whitespace
diff --git a/gdb/config/djgpp/djcheck.sh b/gdb/config/djgpp/djcheck.sh
index e7e03315301..35e6e765dc6 100644
--- a/gdb/config/djgpp/djcheck.sh
+++ b/gdb/config/djgpp/djcheck.sh
@@ -36,9 +36,9 @@ do
     fi
     $GDB ${options} < "${base}.in" 2>&1 \
       | sed -e '/GNU gdb /s/ [.0-9][.0-9]*//' \
-            -e '/^Copyright/s/[12][0-9][0-9][0-9]/XYZZY/g' \
-            -e '/Starting program: /s|[A-z]:/.*/||' \
-            -e '/main (/s/=0x[0-9a-f][0-9a-f]*/=XYZ/g' \
+	    -e '/^Copyright/s/[12][0-9][0-9][0-9]/XYZZY/g' \
+	    -e '/Starting program: /s|[A-z]:/.*/||' \
+	    -e '/main (/s/=0x[0-9a-f][0-9a-f]*/=XYZ/g' \
       > "${base}.tst"
     if diff --binary -u "${base}.out" "${base}.tst" ; then
       rm -f "${base}.tst"
diff --git a/gdb/config/djgpp/djconfig.sh b/gdb/config/djgpp/djconfig.sh
index 27fea185cae..e5ca023561f 100644
--- a/gdb/config/djgpp/djconfig.sh
+++ b/gdb/config/djgpp/djconfig.sh
@@ -60,11 +60,11 @@ if ! test -f "${srcdir}/bfd/ChangeLog.0203"      || \
       notfound="${srcdir}/gdb/ChangeLog.002"
     else
       if ! test -f "${srcdir}/readline/config.h-in"; then
-        notfound="${srcdir}/readline/config.h-in"
+	notfound="${srcdir}/readline/config.h-in"
       else
-        if ! test -f "${srcdir}/opcodes/ChangeLog.0203"; then
-          notfound="${srcdir}/opcodes/ChangeLog.0203"
-        fi
+	if ! test -f "${srcdir}/opcodes/ChangeLog.0203"; then
+	  notfound="${srcdir}/opcodes/ChangeLog.0203"
+	fi
       fi
     fi
   fi
diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh
index 49f50a20e3e..4a30c5c5536 100755
--- a/gdb/contrib/gdb-add-index.sh
+++ b/gdb/contrib/gdb-add-index.sh
@@ -212,7 +212,7 @@ handle_file ()
 		$OBJCOPY --add-section $section="$index" \
 			 --set-section-flags $section=readonly \
 			 --add-section .debug_str="$debugstrmerge" \
-		         --set-section-flags .debug_str=readonly \
+			 --set-section-flags .debug_str=readonly \
 			 "$fpath" "$fpath"
 	    else
 		$OBJCOPY --add-section $section="$index" \
diff --git a/gdb/contrib/words.sh b/gdb/contrib/words.sh
index a96142a3232..9324f7648e3 100755
--- a/gdb/contrib/words.sh
+++ b/gdb/contrib/words.sh
@@ -138,7 +138,7 @@ fi \
     | sort \
     | uniq -c \
     | awk "{ if (($minfreq == 0 || $minfreq <= \$1) \
-                 && ($maxfreq == 0 || \$1 <= $maxfreq)) { print \$0; } }" \
+		 && ($maxfreq == 0 || \$1 <= $maxfreq)) { print \$0; } }" \
     | awk '{ print length($0) " " $0; }' \
     | sort -n -r \
     | cut -d ' ' -f 2-
diff --git a/gdb/gcore-1.in b/gdb/gcore-1.in
index 2d3071d0ec5..22c7e1f81b8 100755
--- a/gdb/gcore-1.in
+++ b/gdb/gcore-1.in
@@ -77,23 +77,23 @@ while getopts vhao:g:d:-: OPT; do
     fi
 
     case "$OPT" in
-        a)
-            case "$(uname -s)" in
-                Linux)
-                    use_coredump_filter="off"
-                    dump_excluded_mappings="on"
-                    ;;
-            esac
-            ;;
-        o)
-            prefix=$OPTARG
-            ;;
-        g)
-            gdb_binary="$OPTARG"
-            ;;
-        d)
-            data_directory="$OPTARG"
-            ;;
+	a)
+	    case "$(uname -s)" in
+		Linux)
+		    use_coredump_filter="off"
+		    dump_excluded_mappings="on"
+		    ;;
+	    esac
+	    ;;
+	o)
+	    prefix=$OPTARG
+	    ;;
+	g)
+	    gdb_binary="$OPTARG"
+	    ;;
+	d)
+	    data_directory="$OPTARG"
+	    ;;
 	h | help)
 	    print_help
 	    exit 0
@@ -107,14 +107,14 @@ while getopts vhao:g:d:-: OPT; do
 	    print_try_help 1>&2
 	    exit 2
 	    ;;
-        *)
+	*)
 	    # Unknown single character options are handled by the \?
 	    # case above.  This is formatted to match the error
 	    # getopts gives for an unknown single character option.
 	    echo "$0: illegal option -- $OPT" 1>&2
 	    print_try_help 1>&2
 	    exit 2
-            ;;
+	    ;;
     esac
 done
 
@@ -175,10 +175,10 @@ do
 	# `</dev/null' to avoid touching interactive terminal if it is
 	# available but not accessible as GDB would get stopped on SIGTTIN.
 	"$gdb_binary" </dev/null \
-            ${data_directory:+--data-directory "$data_directory"} \
+	    ${data_directory:+--data-directory "$data_directory"} \
 	    --nx --batch --readnever -iex 'set debuginfod enabled off' \
 	    -ex "set pagination off" -ex "set height 0" -ex "set width 0" \
-            ${use_coredump_filter:+-ex "set use-coredump-filter ${use_coredump_filter}"} \
+	    ${use_coredump_filter:+-ex "set use-coredump-filter ${use_coredump_filter}"} \
 	    ${dump_excluded_mappings:+-ex "set dump-excluded-mappings ${dump_excluded_mappings}"} \
 	    -ex "attach $pid" -ex "gcore $prefix.$pid" -ex detach -ex quit
 
diff --git a/gdb/syscalls/update-freebsd.sh b/gdb/syscalls/update-freebsd.sh
index e91817cf9f3..b0713978473 100755
--- a/gdb/syscalls/update-freebsd.sh
+++ b/gdb/syscalls/update-freebsd.sh
@@ -63,7 +63,7 @@ awk '
     sub(/^SYS_/,"",$2);
     printf "  <syscall name=\"%s\" number=\"%s\"", $2, $3
     if (sub(/^freebsd[0-9]*_/,"",$2) != 0)
-        printf " alias=\"%s\"", $2
+	printf " alias=\"%s\"", $2
     printf "/>\n"
 }
 /\/\* [0-9]* is obsolete [a-z_]* \*\// {
diff --git a/gdb/syscalls/update-netbsd.sh b/gdb/syscalls/update-netbsd.sh
index 1769bc80193..48defbfa13f 100755
--- a/gdb/syscalls/update-netbsd.sh
+++ b/gdb/syscalls/update-netbsd.sh
@@ -61,7 +61,7 @@ awk '
     sub(/^SYS_/,"",$2);
     printf "  <syscall name=\"%s\" number=\"%s\"", $2, $3
     if (sub(/^netbsd[0-9]*_/,"",$2) != 0)
-        printf " alias=\"%s\"", $2
+	printf " alias=\"%s\"", $2
     printf "/>\n"
 }
 /\/\* [0-9]* is obsolete [a-z_]* \*\// {
diff --git a/gdb/testsuite/.gitattributes b/gdb/testsuite/.gitattributes
index 97a376c1938..57c47ae28e7 100644
--- a/gdb/testsuite/.gitattributes
+++ b/gdb/testsuite/.gitattributes
@@ -2,3 +2,7 @@
 
 # Binary format.
 *.bz2  binary
+
+# Tab-indented files.
+
+lib/notty-wrap whitespace=space-before-tab,indent-with-non-tab,trailing-space

base-commit: dada369bcff46b469de997d52d6f3d456070c405
-- 
2.51.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-03  6:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-03  6:16 [pushed] [gdb] Fix whitespace in shell scripts Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox