2009-11-14 16:29:09 -07:00
|
|
|
#!/usr/bin/env bash
|
2008-11-19 13:54:44 -07:00
|
|
|
# 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
|
2011-05-25 11:20:50 -06:00
|
|
|
# Changes made to $GOBIN/quietgcc will be overwritten.
|
2008-11-19 13:54:44 -07:00
|
|
|
|
|
|
|
# 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'
|
|
|
|
|
2009-11-01 17:13:37 -07:00
|
|
|
# Figure out which cc to run; this is set by make.bash.
|
2009-11-01 17:29:33 -07:00
|
|
|
gcc="@CC@"
|
2009-11-01 17:13:37 -07:00
|
|
|
if test "$gcc" = "@C""C@"; then
|
|
|
|
gcc=gcc
|
|
|
|
fi
|
2008-11-19 13:54:44 -07:00
|
|
|
|
2010-10-08 01:52:28 -06:00
|
|
|
# Build 64-bit binaries on 64-bit systems, unless GOHOSTARCH=386.
|
|
|
|
case "$(uname -m -p)-$GOHOSTARCH" in
|
|
|
|
*x86_64*-386 | *amd64*-386)
|
|
|
|
gcc="$gcc -m32"
|
|
|
|
;;
|
2009-07-29 12:47:11 -06:00
|
|
|
*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.
|
2011-05-25 11:20:50 -06:00
|
|
|
tmp=${TMPDIR:-/tmp}/quietgcc.$$.$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 \
|
2011-04-13 14:18:09 -06:00
|
|
|
-Werror \
|
2008-11-19 13:54:44 -07:00
|
|
|
"$@" >$tmp 2>&1
|
|
|
|
status=$?
|
2009-09-09 17:45:23 -06:00
|
|
|
egrep -v "$ignore" $tmp | uniq | tee $tmp.1
|
|
|
|
|
|
|
|
rm -f $tmp $tmp.1
|
2008-11-19 13:54:44 -07:00
|
|
|
exit $status
|