mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
9l: refactor the warning-silencing mechanics to match that of 9c
This commit is contained in:
parent
984c2824e3
commit
0bc1ff0fa0
2 changed files with 26 additions and 21 deletions
12
bin/9c
12
bin/9c
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test -f $PLAN9/config && . $PLAN9/config
|
test -f "$PLAN9/config" && . "$PLAN9/config"
|
||||||
usegcc()
|
usegcc()
|
||||||
{
|
{
|
||||||
cc=${CC9:-gcc}
|
cc=${CC9:-gcc}
|
||||||
|
@ -52,7 +52,7 @@ quiet()
|
||||||
ignore=$ignore'|warn_unused_result'
|
ignore=$ignore'|warn_unused_result'
|
||||||
ignore=$ignore'|expanded from macro'
|
ignore=$ignore'|expanded from macro'
|
||||||
|
|
||||||
grep -v '__p9l_autolib_' $1 |
|
grep -v '__p9l_autolib_' "$1" |
|
||||||
egrep -v "$ignore" |
|
egrep -v "$ignore" |
|
||||||
sed 's/ .first use in this function.$//; s/\"\([^\"][^\"]*\)\", line \([0-9][0-9]*\)/\1:\2/g' |
|
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
|
$(which uniq) 1>&2 # avoid built-in uniq on SunOS
|
||||||
|
@ -143,10 +143,10 @@ case "$tag" in
|
||||||
exit 1
|
exit 1
|
||||||
esac
|
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
|
xtmp=${TMPDIR-/tmp}/9c.$$.$USER.out
|
||||||
$cc -DPLAN9PORT -I$PLAN9/include $cflags "$@" 2>$xtmp
|
$cc -DPLAN9PORT -I"$PLAN9/include" $cflags "$@" 2>"$xtmp"
|
||||||
status=$?
|
status=$?
|
||||||
quiet $xtmp
|
quiet "$xtmp"
|
||||||
rm -f $xtmp
|
rm -f "$xtmp"
|
||||||
exit $status
|
exit $status
|
||||||
|
|
35
bin/9l
35
bin/9l
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[ "$1" = "" ] && exit 1
|
[ "$1" = "" ] && exit 1
|
||||||
|
|
||||||
test -f $PLAN9/config && . $PLAN9/config
|
test -f "$PLAN9/config" && . "$PLAN9/config"
|
||||||
libsl=""
|
libsl=""
|
||||||
frameworks=""
|
frameworks=""
|
||||||
doautolib=true
|
doautolib=true
|
||||||
|
@ -324,23 +324,28 @@ esac
|
||||||
|
|
||||||
if $verbose
|
if $verbose
|
||||||
then
|
then
|
||||||
echo $ld -L$PLAN9/lib "$@" $libsl $extralibs $frameworks
|
echo $ld -L"$PLAN9/lib" "$@" $libsl $extralibs $frameworks
|
||||||
fi
|
fi
|
||||||
|
|
||||||
xtmp="${TMPDIR-/tmp}/9l.$$.$USER.out"
|
quiet()
|
||||||
xxout() {
|
{
|
||||||
sed 's/.*: In function `[^:]*: *//' $xtmp | egrep . |
|
ignore='^$'
|
||||||
egrep -v 'is (often|almost always) misused|is dangerous, better use|text-based stub'
|
ignore=$ignore'|is (often|almost always) misused'
|
||||||
rm -f $xtmp
|
ignore=$ignore'|is dangerous, better use'
|
||||||
|
ignore=$ignore'|text-based stub'
|
||||||
|
|
||||||
|
sed 's/.*: In function `[^:]*: *//' "$1" |
|
||||||
|
egrep -v "$ignore"
|
||||||
}
|
}
|
||||||
|
|
||||||
if $ld -L$PLAN9/lib "$@" $libsl $extralibs $frameworks >$xtmp 2>&1
|
# Must use temp file to avoid pipe; pipe loses status.
|
||||||
|
xtmp=${TMPDIR-/tmp}/9l.$$.$USER.out
|
||||||
|
$ld -L"$PLAN9/lib" "$@" $libsl $extralibs $frameworks >"$xtmp" 2>&1
|
||||||
|
status=$?
|
||||||
|
quiet "$xtmp"
|
||||||
|
rm -f "$xtmp"
|
||||||
|
if [ "$status" -ne 0 ]
|
||||||
then
|
then
|
||||||
xxout
|
rm -f "$target"
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
xxout
|
|
||||||
rm -f $target
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
exit $status
|
||||||
|
|
Loading…
Reference in a new issue