[PATCH 7/7] gdb: silence shellcheck warning SC2162 (use read -r) in gdbarch.sh

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

shellcheck reports:

In gdbarch.sh line 53:
while IFS='' read line
^--^ SC2162: read without -r will mangle backslashes.

See the rationale at [1]. In our case, we actually want the backslashes
to be interpreted and removed. Silence the warning using a directive.

[1] https://github.com/koalaman/shellcheck/wiki/SC2162

gdb/ChangeLog:

* gdbarch.sh (do_read): Add shellcheck disable directive for
warning SC2162.
---
gdb/gdbarch.sh | 1 +
1 file changed, 1 insertion(+)

diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 24f8cdfe90b0..13775078c25a 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -50,6 +50,7 @@ do_read ()
# On some SH's, 'read' trims leading and trailing whitespace by
# default (e.g., bash), while on others (e.g., dash), it doesn't.
# Set IFS to empty to disable the trimming everywhere.
+ # shellcheck disable=SC2162
while IFS='' read line
do
if test "${line}" = ""
--
2.26.2