mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
9c, 9l: allow CC9=clang
R=rsc CC=codebot http://codereview.appspot.com/217045
This commit is contained in:
parent
c4da64274d
commit
0c6074b692
3 changed files with 58 additions and 19 deletions
|
@ -17,6 +17,7 @@ Mathieu Lonjaret <lejatorn@gmail.com>
|
||||||
Mathieu Lonjaret <mathieu.lonjaret@gmail.com>
|
Mathieu Lonjaret <mathieu.lonjaret@gmail.com>
|
||||||
Michael Teichgräber <mt4swm@googlemail.com>
|
Michael Teichgräber <mt4swm@googlemail.com>
|
||||||
Michael Teichgräber <mt@ib.wmipf.de>
|
Michael Teichgräber <mt@ib.wmipf.de>
|
||||||
|
Nikolai Saoukh <nikolai.saoukh@gmail.com>
|
||||||
Russ Cox <rsc@swtch.com>
|
Russ Cox <rsc@swtch.com>
|
||||||
Tim Newsham <tim.newsham@gmail.com>
|
Tim Newsham <tim.newsham@gmail.com>
|
||||||
Tony Lainson <t.lainson@gmail.com>
|
Tony Lainson <t.lainson@gmail.com>
|
||||||
|
|
64
bin/9c
64
bin/9c
|
@ -3,7 +3,7 @@
|
||||||
test -f $PLAN9/config && . $PLAN9/config
|
test -f $PLAN9/config && . $PLAN9/config
|
||||||
usegcc()
|
usegcc()
|
||||||
{
|
{
|
||||||
cc=gcc
|
cc=${CC9:-gcc}
|
||||||
ngflags=" \
|
ngflags=" \
|
||||||
-O2 \
|
-O2 \
|
||||||
-c \
|
-c \
|
||||||
|
@ -21,12 +21,58 @@ usegcc()
|
||||||
cflags="$ngflags -ggdb"
|
cflags="$ngflags -ggdb"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quiet()
|
||||||
|
{
|
||||||
|
# The uniq at the end is for gcc's strcmp/etc. built-in nonsense,
|
||||||
|
# which multiplies single errors as a result of its expansion.
|
||||||
|
# The "Cursor. is deprecated" kills off warnings from Apple
|
||||||
|
# about using SetCursor/InitCursor. (Okay, they're deprecated,
|
||||||
|
# but you could at least tell us what to use instead, Apple!)
|
||||||
|
|
||||||
|
ignore=': error: .Each undeclared identifier'
|
||||||
|
ignore=$ignore'|: error: for each function it appears'
|
||||||
|
ignore=$ignore'|is dangerous, better use'
|
||||||
|
ignore=$ignore'|is almost always misused'
|
||||||
|
ignore=$ignore'|: In function '
|
||||||
|
ignore=$ignore'|: At top level:'
|
||||||
|
ignore=$ignore'|support .long long.'
|
||||||
|
ignore=$ignore'|In file included from'
|
||||||
|
ignore=$ignore'| from'
|
||||||
|
ignore=$ignore'|use of C99 long long'
|
||||||
|
ignore=$ignore'|ISO C forbids conversion'
|
||||||
|
ignore=$ignore'|is deprecated'
|
||||||
|
ignore=$ignore'|warn_unused_result'
|
||||||
|
|
||||||
|
grep -v '__p9l_autolib_' $1 |
|
||||||
|
egrep -v "$ignore" |
|
||||||
|
sed 's/ .first use in this function.$//; s/\"\([^\"][^\"]*\)\", line \([0-9][0-9]*\)/\1:\2/g' |
|
||||||
|
uniq 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
useclang()
|
||||||
|
{
|
||||||
|
cc=${CC9:-clang}
|
||||||
|
ngflags=" \
|
||||||
|
-O2 \
|
||||||
|
-c \
|
||||||
|
-Wall \
|
||||||
|
-Wno-comment \
|
||||||
|
-Wno-empty-body \
|
||||||
|
-Wno-parentheses \
|
||||||
|
-Wno-unknown-pragmas \
|
||||||
|
-Wno-unused-value \
|
||||||
|
"
|
||||||
|
cflags="$ngflags -g"
|
||||||
|
}
|
||||||
|
|
||||||
tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}-${CC9:-cc}"
|
tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}-${CC9:-cc}"
|
||||||
case "$tag" in
|
case "$tag" in
|
||||||
|
*FreeBSD*gcc*) usegcc ;;
|
||||||
|
*FreeBSD*clang*) useclang ;;
|
||||||
*BSD*) usegcc ;;
|
*BSD*) usegcc ;;
|
||||||
*Darwin*) usegcc
|
*Darwin*) usegcc
|
||||||
cflags="$ngflags -g3 -no-cpp-precomp -m32" ;;
|
cflags="$ngflags -g3 -no-cpp-precomp -m32" ;;
|
||||||
*HP-UX*) cc=cc; cflags="-g -O -c -Ae" ;;
|
*HP-UX*) cc=${CC9:-cc}; cflags="-g -O -c -Ae" ;;
|
||||||
*Linux*) usegcc
|
*Linux*) usegcc
|
||||||
case "${CC9:-gcc}" in
|
case "${CC9:-gcc}" in
|
||||||
tcc)
|
tcc)
|
||||||
|
@ -43,7 +89,7 @@ case "$tag" in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
*OSF1*) cc=cc; cflags="-g -O -c" ;;
|
*OSF1*) cc=${CC9:-cc}; cflags="-g -O -c" ;;
|
||||||
*SunOS*-cc) cc=cc;
|
*SunOS*-cc) cc=cc;
|
||||||
cflags="-mt -g -O -c -xCC -D__sun__"
|
cflags="-mt -g -O -c -xCC -D__sun__"
|
||||||
u=`uname`
|
u=`uname`
|
||||||
|
@ -67,17 +113,9 @@ case "$tag" in
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# N.B. Must use temp file to avoid pipe; pipe loses status.
|
# N.B. Must use temp file to avoid pipe; pipe loses status.
|
||||||
# The uniq at the end is for gcc's strcmp/etc. built-in nonsense,
|
|
||||||
# which multiplies single errors as a result of its expansion.
|
|
||||||
# The "Cursor. is deprecated" kills off warnings from Apple
|
|
||||||
# about using SetCursor/InitCursor. (Okay, they're deprecated,
|
|
||||||
# but you could at least tell us what to use instead, Apple!)
|
|
||||||
xtmp=/tmp/9c.$$.$USER.out
|
xtmp=/tmp/9c.$$.$USER.out
|
||||||
$cc -DPLAN9PORT -I$PLAN9/include $cflags "$@" 2>$xtmp
|
$cc -DPLAN9PORT -I$PLAN9/include $cflags "$@" 2>$xtmp
|
||||||
status=$?
|
status=$?
|
||||||
grep -v '__p9l_autolib_' $xtmp |
|
quiet $xtmp
|
||||||
egrep -v ': error: .Each undeclared identifier|: error: for each function it appears|is dangerous, better use|is almost always misused|: In function |: At top level:|support .long long.|In file included from| from|use of C99 long long|ISO C forbids conversion|is deprecated|warn_unused_result' |
|
rm -f $xtmp
|
||||||
sed 's/ .first use in this function.$//; s/\"\([^\"][^\"]*\)\", line \([0-9][0-9]*\)/\1:\2/g' |
|
|
||||||
uniq 1>&2
|
|
||||||
rm -f $xtmp $xtmp.status
|
|
||||||
exit $status
|
exit $status
|
||||||
|
|
12
bin/9l
12
bin/9l
|
@ -12,7 +12,7 @@ extralibs="-lm"
|
||||||
tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}"
|
tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}"
|
||||||
case "$tag" in
|
case "$tag" in
|
||||||
*FreeBSD*)
|
*FreeBSD*)
|
||||||
ld=gcc
|
ld=${CC9:-gcc}
|
||||||
userpath=true
|
userpath=true
|
||||||
extralibs="$extralibs -lutil"
|
extralibs="$extralibs -lutil"
|
||||||
case "`uname -r`" in
|
case "`uname -r`" in
|
||||||
|
@ -25,18 +25,18 @@ case "$tag" in
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
*BSD*)
|
*BSD*)
|
||||||
ld=gcc
|
ld=${CC9:-gcc}
|
||||||
userpath=true
|
userpath=true
|
||||||
extralibs="$extralibs -lutil"
|
extralibs="$extralibs -lutil"
|
||||||
;;
|
;;
|
||||||
*OSF1*)
|
*OSF1*)
|
||||||
ld=cc
|
ld=${CC9:-cc}
|
||||||
userpath=true
|
userpath=true
|
||||||
extralibs="$extralibs -lutil"
|
extralibs="$extralibs -lutil"
|
||||||
nmflags="-B"
|
nmflags="-B"
|
||||||
;;
|
;;
|
||||||
*Linux*)
|
*Linux*)
|
||||||
ld=gcc
|
ld=${CC9:-gcc}
|
||||||
userpath=true
|
userpath=true
|
||||||
extralibs="$extralibs -lutil"
|
extralibs="$extralibs -lutil"
|
||||||
case "${SYSVERSION:-`uname -r`}" in
|
case "${SYSVERSION:-`uname -r`}" in
|
||||||
|
@ -46,7 +46,7 @@ case "$tag" in
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
*Darwin*)
|
*Darwin*)
|
||||||
ld="gcc -m32"
|
ld="${CC9:-gcc} -m32"
|
||||||
;;
|
;;
|
||||||
*SunOS*)
|
*SunOS*)
|
||||||
ld="${CC9:-cc} -g"
|
ld="${CC9:-cc} -g"
|
||||||
|
@ -76,7 +76,7 @@ case "$tag" in
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
*AIX*)
|
*AIX*)
|
||||||
ld=gcc
|
ld=${CC9:-gcc}
|
||||||
nmflags="-B"
|
nmflags="-B"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
Loading…
Reference in a new issue