2008-11-19 13:54:44 -07:00
|
|
|
#!/bin/bash
|
|
|
|
# Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style
|
|
|
|
# license that can be found in the LICENSE file.
|
2009-07-29 12:47:11 -06:00
|
|
|
|
2008-11-19 13:54:44 -07:00
|
|
|
# The master for this file is $GOROOT/src/quietgcc.bash
|
|
|
|
# Changes made to $HOME/bin/quietgcc will be overridden.
|
|
|
|
|
|
|
|
# Gcc output that we don't care to see.
|
|
|
|
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'|In file included from'
|
|
|
|
ignore=$ignore'| from'
|
|
|
|
|
|
|
|
# Figure out which cc to run.
|
|
|
|
# Can use plain cc on real 64-bit machines
|
|
|
|
# and on OS X, but have to use crosstool on
|
|
|
|
# mixed64-32 machines like thresher.
|
|
|
|
gcc=gcc
|
|
|
|
case "`uname -a`" in
|
|
|
|
*mixed64-32*)
|
|
|
|
gcc=/usr/crosstool/v10/gcc-4.2.1-glibc-2.3.2/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/bin/gcc
|
|
|
|
esac
|
|
|
|
|
2009-07-29 12:47:11 -06:00
|
|
|
# If this is a 64-bit machine, compile 64-bit versions of
|
|
|
|
# the host tools, to match the native ptrace.
|
|
|
|
case "`uname -m -p`" in
|
|
|
|
*x86_64* | *amd64*)
|
|
|
|
gcc="$gcc -m64"
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
2008-11-19 13:54:44 -07:00
|
|
|
# Run gcc, save error status, redisplay output without noise, exit with gcc status.
|
|
|
|
tmp=/tmp/qcc.$$.$USER.out
|
2009-07-29 12:47:11 -06:00
|
|
|
$gcc -Wall -Wno-sign-compare -Wno-missing-braces \
|
2008-11-19 13:54:44 -07:00
|
|
|
-Wno-parentheses -Wno-unknown-pragmas -Wno-switch -Wno-comment \
|
|
|
|
"$@" >$tmp 2>&1
|
|
|
|
status=$?
|
|
|
|
egrep -v "$ignore" $tmp | uniq
|
|
|
|
rm -f $tmp
|
|
|
|
exit $status
|