From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 15E6D39858B8 for ; Tue, 28 Apr 2020 21:47:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 15E6D39858B8 X-ASG-Debug-ID: 1588110422-0c856e18f3114d0a0001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id 5tSBFB4sT6ycBCjz (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 28 Apr 2020 17:47:02 -0400 (EDT) X-Barracuda-Envelope-From: simon.marchi@efficios.com X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from localhost.localdomain (unknown [192.222.164.54]) by smtp.ebox.ca (Postfix) with ESMTP id 68D26441D67; Tue, 28 Apr 2020 17:47:02 -0400 (EDT) From: Simon Marchi X-Barracuda-Effective-Source-IP: 192-222-164-54.qc.cable.ebox.net[192.222.164.54] X-Barracuda-Apparent-Source-IP: 192.222.164.54 X-Barracuda-RBL-IP: 192.222.164.54 To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 4/7] gdb: fix shellcheck warnings SC2166 (&& and !! instead of -a and -o) in gdbarch.sh Date: Tue, 28 Apr 2020 17:46:52 -0400 X-ASG-Orig-Subj: [PATCH 4/7] gdb: fix shellcheck warnings SC2166 (&& and !! instead of -a and -o) in gdbarch.sh Message-Id: <20200428214655.3255454-5-simon.marchi@efficios.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200428214655.3255454-1-simon.marchi@efficios.com> References: <20200428214655.3255454-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1588110422 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 2528 X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.81496 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Spam-Status: No, score=-40.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Tue, 28 Apr 2020 21:47:05 -0000 Fix all warnings of this type: In gdbarch.sh line 1238: if [ "x${invalid_p}" = "x0" -a -n "${postdefault}" ] ^-- SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. See the rationale here [1]. [1] https://github.com/koalaman/shellcheck/wiki/SC2166 gdb/ChangeLog: * gdbarch.sh: Use shell operators && and || instead of -a and -o. --- gdb/gdbarch.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 0e89bd1900b3..f1b9276775e3 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -156,8 +156,8 @@ EOF fallback_default_p () { - [ -n "${postdefault}" -a "x${invalid_p}" != "x0" ] \ - || [ -n "${predefault}" -a "x${invalid_p}" = "x0" ] + ( [ -n "${postdefault}" ] && [ "x${invalid_p}" != "x0" ] ) \ + || ( [ -n "${predefault}" ] && [ "x${invalid_p}" = "x0" ] ) } class_is_variable_p () @@ -1235,7 +1235,7 @@ EOF kill $$ exit 1 fi - if [ "x${invalid_p}" = "x0" -a -n "${postdefault}" ] + if [ "x${invalid_p}" = "x0" ] && [ -n "${postdefault}" ] then echo "Error: postdefault is useless when invalid_p=0" 1>&2 kill $$ @@ -1921,7 +1921,7 @@ function_list | while do_read do if class_is_function_p || class_is_variable_p then - if [ -n "${predefault}" -a "x${predefault}" != "x0" ] + if [ -n "${predefault}" ] && [ "x${predefault}" != "x0" ] then printf " gdbarch->%s = %s;\n" "$function" "$predefault" fi @@ -2001,11 +2001,11 @@ do then printf " /* Skip verify of %s, has predicate. */\n" "$function" # FIXME: See do_read for potential simplification - elif [ -n "${invalid_p}" -a -n "${postdefault}" ] + elif [ -n "${invalid_p}" ] && [ -n "${postdefault}" ] then printf " if (%s)\n" "$invalid_p" printf " gdbarch->%s = %s;\n" "$function" "$postdefault" - elif [ -n "${predefault}" -a -n "${postdefault}" ] + elif [ -n "${predefault}" ] && [ -n "${postdefault}" ] then printf " if (gdbarch->%s == %s)\n" "$function" "$predefault" printf " gdbarch->%s = %s;\n" "$function" "$postdefault" @@ -2136,7 +2136,7 @@ do fi printf " if (gdbarch_debug >= 2)\n" printf " fprintf_unfiltered (gdb_stdlog, \"gdbarch_%s called\\\\n\");\n" "$function" - if [ "x${actual}" = "x-" -o "x${actual}" = "x" ] + if [ "x${actual}" = "x-" ] || [ "x${actual}" = "x" ] then if class_is_multiarch_p then -- 2.26.2