[PATCH 5/7] gdb: fix shellcheck warnings SC2034 (unused variable) in gdbarch.sh

Simon Marchi
2020-04-28T21:47:05Z

shellcheck reports:

In gdbarch.sh line 139:
fallbackdefault="0"
^-------------^ SC2034: fallbackdefault appears unused. Verify use (or export if used externally).

Indeed, the `fallbackdefault` variable appears to be unused, remove the
code that sets it.

gdb/ChangeLog:

* gdbarch.sh: Remove code that sets fallbackdefault.
---
gdb/gdbarch.sh | 21 ++-------------------
1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index f1b9276775e3..4e4cc827b895 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -122,23 +122,6 @@ EOF
esac
esac

- # PREDEFAULT is a valid fallback definition of MEMBER when
- # multi-arch is not enabled. This ensures that the
- # default value, when multi-arch is the same as the
- # default value when not multi-arch. POSTDEFAULT is
- # always a valid definition of MEMBER as this again
- # ensures consistency.
-
- if [ -n "${postdefault}" ]
- then
- fallbackdefault="${postdefault}"
- elif [ -n "${predefault}" ]
- then
- fallbackdefault="${predefault}"
- else
- fallbackdefault="0"
- fi
-
#NOT YET: See gdbarch.log for basic verification of
# database

@@ -156,8 +139,8 @@ EOF

fallback_default_p ()
{
- ( [ -n "${postdefault}" ] && [ "x${invalid_p}" != "x0" ] ) \
- || ( [ -n "${predefault}" ] && [ "x${invalid_p}" = "x0" ] )
+ { [ -n "${postdefault}" ] && [ "x${invalid_p}" != "x0" ]; } \
+ || { [ -n "${predefault}" ] && [ "x${invalid_p}" = "x0" ]; }
}

class_is_variable_p ()
--
2.26.2