9l: refactor the warning-silencing mechanics to match that of 9c

This commit is contained in:
Igor Burago 2023-12-18 15:12:48 +08:00 committed by Dan Cross
parent 984c2824e3
commit 0bc1ff0fa0
2 changed files with 26 additions and 21 deletions

12
bin/9c
View file

@ -1,6 +1,6 @@
#!/bin/sh
test -f $PLAN9/config && . $PLAN9/config
test -f "$PLAN9/config" && . "$PLAN9/config"
usegcc()
{
cc=${CC9:-gcc}
@ -52,7 +52,7 @@ quiet()
ignore=$ignore'|warn_unused_result'
ignore=$ignore'|expanded from macro'
grep -v '__p9l_autolib_' $1 |
grep -v '__p9l_autolib_' "$1" |
egrep -v "$ignore" |
sed 's/ .first use in this function.$//; s/\"\([^\"][^\"]*\)\", line \([0-9][0-9]*\)/\1:\2/g' |
$(which uniq) 1>&2 # avoid built-in uniq on SunOS
@ -143,10 +143,10 @@ case "$tag" in
exit 1
esac
# N.B. Must use temp file to avoid pipe; pipe loses status.
# Must use temp file to avoid pipe; pipe loses status.
xtmp=${TMPDIR-/tmp}/9c.$$.$USER.out
$cc -DPLAN9PORT -I$PLAN9/include $cflags "$@" 2>$xtmp
$cc -DPLAN9PORT -I"$PLAN9/include" $cflags "$@" 2>"$xtmp"
status=$?
quiet $xtmp
rm -f $xtmp
quiet "$xtmp"
rm -f "$xtmp"
exit $status