public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Lancelot SIX <lsix@lancelotsix.com>
To: gdb-patches@sourceware.org
Cc: Lancelot SIX <lsix@lancelotsix.com>
Subject: [PATCH] gdb-add-index.sh: Remove use of non posix 'local'
Date: Fri, 26 Mar 2021 17:14:54 +0000	[thread overview]
Message-ID: <20210326171454.2795-1-lsix@lancelotsix.com> (raw)

While working on gdb-add-index.sh, it appeared that it uses the non
POSIX 'local' keyword.  Instead of using local to allow variable
shadowing, I rename the local one to avoid name conflicts altogether.

gdb/ChangeLog:

	* contrib/gdb-add-index.sh: Avoid variable shadowing and get
	rid of 'local'.
---
 gdb/contrib/gdb-add-index.sh | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh
index 48a85136a4c..dfefc507001 100755
--- a/gdb/contrib/gdb-add-index.sh
+++ b/gdb/contrib/gdb-add-index.sh
@@ -73,13 +73,13 @@ fi
 
 set_files ()
 {
-    local file="$1"
+    fpath="$1"
 
-    index4="${file}.gdb-index"
-    index5="${file}.debug_names"
-    debugstr="${file}.debug_str"
-    debugstrmerge="${file}.debug_str.merge"
-    debugstrerr="${file}.debug_str.err"
+    index4="${fpath}.gdb-index"
+    index5="${fpath}.debug_names"
+    debugstr="${fpath}.debug_str"
+    debugstrmerge="${fpath}.debug_str.merge"
+    debugstrerr="${fpath}.debug_str.err"
 }
 
 tmp_files=
@@ -112,13 +112,12 @@ status=0
 
 handle_file ()
 {
-    local file
-    file="$1"
+    fpath="$1"
 
-    set_files "$file"
+    set_files "$fpath"
 
     if test -f "$index4" -a -f "$index5"; then
-	echo "$myname: Both index types were created for $file" 1>&2
+	echo "$myname: Both index types were created for $fpath" 1>&2
 	status=1
     elif test -f "$index4" -o -f "$index5"; then
 	if test -f "$index4"; then
@@ -131,7 +130,7 @@ handle_file ()
 	debugstradd=false
 	debugstrupdate=false
 	if test -s "$debugstr"; then
-	    if ! $OBJCOPY --dump-section .debug_str="$debugstrmerge" "$file" \
+	    if ! $OBJCOPY --dump-section .debug_str="$debugstrmerge" "$fpath" \
 		 /dev/null 2>$debugstrerr; then
 		cat >&2 $debugstrerr
 		exit 1
@@ -155,11 +154,11 @@ handle_file ()
 		   if $debugstrupdate; then \
 		       echo --update-section .debug_str="$debugstrmerge"; \
 		   fi) \
-		 "$file" "$file"
+		 "$fpath" "$fpath"
 
 	status=$?
     else
-	echo "$myname: No index was created for $file" 1>&2
+	echo "$myname: No index was created for $fpath" 1>&2
 	echo "$myname: [Was there no debuginfo? Was there already an index?]" \
 	     1>&2
     fi
-- 
2.30.1


             reply	other threads:[~2021-03-26 17:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-26 17:14 Lancelot SIX [this message]
2021-03-26 18:39 ` Simon Marchi
2021-03-26 23:56   ` Lancelot SIX

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=20210326171454.2795-1-lsix@lancelotsix.com \
    --to=lsix@lancelotsix.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).