From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id /0LfA5kWXmDRSAAAWB0awg (envelope-from ) for ; Fri, 26 Mar 2021 13:15:05 -0400 Received: by simark.ca (Postfix, from userid 112) id EEB531EF7C; Fri, 26 Mar 2021 13:15:04 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 1E9501E793 for ; Fri, 26 Mar 2021 13:15:04 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4CFE83857C44; Fri, 26 Mar 2021 17:15:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4CFE83857C44 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1616778903; bh=2rbXUT2LYM7kM5r2TSMy2enIXRwPB0IwUhhp3OS4EaQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=vtTU8Qkrao9pUjDOfGnVgmSC5ZsSi8usxS+C0bLhF/Di0x8rxpbFlTQSHP3SHw+js /2LAnD5eB1qxFqSzaiFYybxQTSaW2OTJV7XxOG9MvwEnxLj0qiwOeoCT5+6D9oeYbz s9HjILUWRLioy9PdJ7dr4vQlv/PS/EEBfUm2e1XE= Received: from lndn.lancelotsix.com (lndn.lancelotsix.com [51.195.220.111]) by sourceware.org (Postfix) with ESMTPS id 8868C3857C44 for ; Fri, 26 Mar 2021 17:15:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8868C3857C44 Received: from Plymouth.lan (unknown [IPv6:2a02:390:9086:0:b82c:5cfa:3593:8ad9]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id A165D818C3; Fri, 26 Mar 2021 17:14:58 +0000 (UTC) To: gdb-patches@sourceware.org Subject: [PATCH] gdb-add-index.sh: Remove use of non posix 'local' Date: Fri, 26 Mar 2021 17:14:54 +0000 Message-Id: <20210326171454.2795-1-lsix@lancelotsix.com> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.11 (lndn.lancelotsix.com [0.0.0.0]); Fri, 26 Mar 2021 17:14:58 +0000 (UTC) X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Lancelot SIX via Gdb-patches Reply-To: Lancelot SIX Cc: Lancelot SIX Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" 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