~mcf/cproc

silence ShellCheck warnings v1 PROPOSED

Diogo Santos: 1
 silence ShellCheck warnings

 2 files changed, 14 insertions(+), 14 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~mcf/cproc/patches/53103/mbox | git am -3
Learn more about email & git

[PATCH] silence ShellCheck warnings Export this patch

Warnings addressed: SC1010, SC2086, and SC2223.
---
 configure | 22 +++++++++++-----------
 runtests  |  6 +++---
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/configure b/configure
index dab1bf3..51572ac 100755
--- a/configure
+++ b/configure
@@ -30,7 +30,7 @@ for arg ; do
	esac
done

: ${CC:=cc}
: "${CC:=cc}"

printf 'checking host system type... '
test -n "$host" || host=$($CC -dumpmachine 2>/dev/null) || fail "could not determine host"
@@ -78,7 +78,7 @@ case "$target" in
	linkflags='"-L", "'$gcclibdir'",'
	;;
*-*freebsd*)
	: ${DEFAULT_DYNAMIC_LINKER:=/libexec/ld-elf.so.1}
	: "${DEFAULT_DYNAMIC_LINKER:=/libexec/ld-elf.so.1}"
	startfiles='"-l", ":crt1.o", "-l", ":crti.o"'
	endfiles='"-l", "c", "-l", ":crtn.o"'
	linkflags='"-L", "/usr/lib",'
@@ -104,8 +104,8 @@ case "$target" in
'
	;;
*-*openbsd*)
	: ${DEFAULT_DYNAMIC_LINKER:=/usr/libexec/ld.so}
	test "$host" = "$target" && : ${DEFAULT_PREPROCESSOR:=/usr/libexec/cpp}
	: "${DEFAULT_DYNAMIC_LINKER:=/usr/libexec/ld.so}"
	test "$host" = "$target" && : "${DEFAULT_PREPROCESSOR:=/usr/libexec/cpp}"
	startfiles='"-l", ":crt0.o", "-l", ":crtbegin.o"'
	endfiles='"-l", "c", "-l", ":crtend.o"'
	linkflags='"-L", "/usr/lib", "-nopie",'
@@ -118,7 +118,7 @@ case "$target" in
'
	;;
*-*netbsd*)
	: ${DEFAULT_DYNAMIC_LINKER:=/usr/libexec/ld.elf_so}
	: "${DEFAULT_DYNAMIC_LINKER:=/usr/libexec/ld.elf_so}"
	startfiles='"-l", ":crt0.o", "-l", ":crti.o"'
	endfiles='"-l", "c", "-l", ":crtn.o"'
	defines='"-D", "__builtin_stdarg_start(ap, last)=__builtin_va_start(ap, last)"'
@@ -127,10 +127,10 @@ case "$target" in
	fail "unknown target '$target', please create config.h manually"
esac

: ${DEFAULT_PREPROCESSOR:=${toolprefix}cpp}
: ${DEFAULT_QBE:=qbe}
: ${DEFAULT_ASSEMBLER:=${toolprefix}as}
: ${DEFAULT_LINKER:=${toolprefix}ld}
: "${DEFAULT_PREPROCESSOR:=${toolprefix}cpp}"
: "${DEFAULT_QBE:=qbe}"
: "${DEFAULT_ASSEMBLER:=${toolprefix}as}"
: "${DEFAULT_LINKER:=${toolprefix}ld}"

test "$DEFAULT_DYNAMIC_LINKER" && linkflags=$linkflags' "--dynamic-linker", "'$DEFAULT_DYNAMIC_LINKER'"'

@@ -161,7 +161,7 @@ static const char *const codegencmd[]    = {"$DEFAULT_QBE"};
static const char *const assemblecmd[]   = {"$DEFAULT_ASSEMBLER"};
static const char *const linkcmd[]       = {"$DEFAULT_LINKER", $linkflags};
EOF
echo done
echo 'done'

printf "creating config.mk... "
cat >config.mk <<EOF
@@ -171,4 +171,4 @@ CC=${CC:-cc}
CFLAGS=${CFLAGS:--std=c99 -Wall -Wpedantic -Wno-parentheses -Wno-switch -g -pipe}
LDFLAGS=$LDFLAGS
EOF
echo done
echo 'done'
diff --git a/runtests b/runtests
index f1ffa3a..6ffa6ca 100755
--- a/runtests
+++ b/runtests
@@ -1,6 +1,6 @@
#!/bin/sh

: ${CCQBE:=./cproc-qbe}
: "${CCQBE:=./cproc-qbe}"

if [ $# = 0 ] ; then
	set -- test/*.c
@@ -21,10 +21,10 @@ for test ; do
	esac
	if [ -f "$name.qbe" ] ; then
		want=$name.qbe
		set -- $CCQBE -t $arch -o "$got" "$test"
		set -- "$CCQBE" -t "$arch" -o "$got" "$test"
	elif [ -f "$name.pp" ] ; then
		want=$name.pp
		set -- $CCQBE -t $arch -E -o "$got" "$test"
		set -- "$CCQBE" -t "$arch" -E -o "$got" "$test"
	else
		echo "invalid test '$test'" >&2
		set -- false
-- 
2.45.1