Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH v2 1/3] [gdb] Re-indent regformats/regdat.sh
Date: Sun, 30 Aug 2026 21:53:13 +0200	[thread overview]
Message-ID: <20260830195315.1497894-2-tdevries@suse.de> (raw)
In-Reply-To: <20260830195315.1497894-1-tdevries@suse.de>

The script gdb/regformats/regdat.sh has inconsistent indentation: both 2 and 4
spaces.

Standardize to 4 spaces (as specified by .editorconfig), and document this
explicitly using a Local Variables setting, copied from
gdb/contrib/expect-read1.sh.
---
 gdb/regformats/regdat.sh | 122 ++++++++++++++++++++-------------------
 1 file changed, 64 insertions(+), 58 deletions(-)

diff --git a/gdb/regformats/regdat.sh b/gdb/regformats/regdat.sh
index f93270ba0ca..2f48c165fc8 100755
--- a/gdb/regformats/regdat.sh
+++ b/gdb/regformats/regdat.sh
@@ -73,13 +73,13 @@ EOF
 }
 
 if test ! -r "$1"; then
-  echo "$0: Could not open $1." 1>&2
-  exit 1
+    echo "$0: Could not open $1." 1>&2
+    exit 1
 fi
 
 copyright ()
 {
-cat <<EOF
+    cat <<EOF
 /* *INDENT-OFF* */ /* THIS FILE IS GENERATED */
 
 /* A register protocol for GDB, the GNU debugger.
@@ -123,49 +123,49 @@ osabi=unknown
 exec < "$1"
 while do_read
 do
-  if test "${type}" = "name"; then
-    name="${entry}"
-
-    echo "const_target_desc_up tdesc_${name};"
-    echo ""
-
-    # This is necessary for -Wmissing-declarations.
-    echo "void init_registers_${name} (void);"
-
-    echo "void"
-    echo "init_registers_${name} (void)"
-    echo "{"
-    echo "  target_desc_up result = allocate_target_description ();"
-    echo "  struct tdesc_feature *feature = tdesc_create_feature (result.get (), \"${name}\");"
-    continue
-  elif test "${type}" = "xmltarget"; then
-    xmltarget="${entry}"
-    continue
-  elif test "${type}" = "xmlarch"; then
-    xmlarch="${entry}"
-    continue
-  elif test "${type}" = "xmlosabi"; then
-    xmlosabi="${entry}"
-    continue
-  elif test "${type}" = "expedite"; then
-    expedite="${entry}"
-    continue
-  elif test "${type}" = "feature"; then
-    feature="${entry}"
-    continue
-  elif test "${type}" = "osabi"; then
-    osabi="${entry}"
-    continue
-  elif test "${name}" = x; then
-    echo "$0: $1 does not specify \`\`name''." 1>&2
-    exit 1
-  else
-    echo "  tdesc_create_reg (feature, \"${entry}\","
-    echo "  0, 0, NULL, ${type}, NULL);"
+    if test "${type}" = "name"; then
+	name="${entry}"
+
+	echo "const_target_desc_up tdesc_${name};"
+	echo ""
+
+	# This is necessary for -Wmissing-declarations.
+	echo "void init_registers_${name} (void);"
+
+	echo "void"
+	echo "init_registers_${name} (void)"
+	echo "{"
+	echo "  target_desc_up result = allocate_target_description ();"
+	echo "  struct tdesc_feature *feature = tdesc_create_feature (result.get (), \"${name}\");"
+	continue
+    elif test "${type}" = "xmltarget"; then
+	xmltarget="${entry}"
+	continue
+    elif test "${type}" = "xmlarch"; then
+	xmlarch="${entry}"
+	continue
+    elif test "${type}" = "xmlosabi"; then
+	xmlosabi="${entry}"
+	continue
+    elif test "${type}" = "expedite"; then
+	expedite="${entry}"
+	continue
+    elif test "${type}" = "feature"; then
+	feature="${entry}"
+	continue
+    elif test "${type}" = "osabi"; then
+	osabi="${entry}"
+	continue
+    elif test "${name}" = x; then
+	echo "$0: $1 does not specify \`\`name''." 1>&2
+	exit 1
+    else
+	echo "  tdesc_create_reg (feature, \"${entry}\","
+	echo "  0, 0, NULL, ${type}, NULL);"
 
-    offset=$((offset + type))
-    i=$((i + 1))
-  fi
+	offset=$((offset + type))
+	i=$((i + 1))
+    fi
 done
 
 echo
@@ -173,22 +173,22 @@ echo "static const char *expedite_regs_${name}[] = { \"$(echo "${expedite}" | se
 
 echo "#ifndef IN_PROCESS_AGENT"
 if test "${feature}" != x; then
-  echo "static const char *xmltarget_${name} = 0;"
-elif test "${xmltarget}" = x; then
-  if test "${xmlarch}" = x && test "${xmlosabi}" = x; then
     echo "static const char *xmltarget_${name} = 0;"
-  else
-    echo "static const char *xmltarget_${name} = \"@<target>\\"
-    if test "${xmlarch}" != x; then
-      echo "<architecture>${xmlarch}</architecture>\\"
-    fi
-    if test "${xmlosabi}" != x; then
-      echo "<osabi>${xmlosabi}</osabi>\\"
+elif test "${xmltarget}" = x; then
+    if test "${xmlarch}" = x && test "${xmlosabi}" = x; then
+	echo "static const char *xmltarget_${name} = 0;"
+    else
+	echo "static const char *xmltarget_${name} = \"@<target>\\"
+	if test "${xmlarch}" != x; then
+	    echo "<architecture>${xmlarch}</architecture>\\"
+	fi
+	if test "${xmlosabi}" != x; then
+	    echo "<osabi>${xmlosabi}</osabi>\\"
+	fi
+	echo "</target>\";"
     fi
-    echo "</target>\";"
-  fi
 else
-  echo "static const char *xmltarget_${name} = \"${xmltarget}\";"
+    echo "static const char *xmltarget_${name} = \"${xmltarget}\";"
 fi
 echo
 
@@ -207,3 +207,9 @@ EOF
 # close things off
 exec 1>&2
 mv -- "new-$3" "$3"
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:4
+# End:
+# vi:sw=4
-- 
2.51.0


  reply	other threads:[~2026-08-30 19:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-30 19:53 [PATCH v2 0/3] [gdb] Reformat regformats/regdat.sh Tom de Vries
2026-08-30 19:53 ` Tom de Vries [this message]
2026-08-31 20:09   ` [PATCH v2 1/3] [gdb] Re-indent regformats/regdat.sh Simon Marchi
2026-09-01  9:21     ` Tom de Vries
2026-08-30 19:53 ` [PATCH v2 2/3] [gdb] Use shfmt on regformats/regdat.sh Tom de Vries
2026-08-31 20:13   ` Simon Marchi
2026-09-02 13:21     ` Tom de Vries
2026-08-30 19:53 ` [PATCH v2 3/3] [gdb] Use shfmt --simplify " Tom de Vries
2026-08-31 20:14   ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260830195315.1497894-2-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox