The Go Programming Language

Text file src/quietgcc.bash

     1	#!/usr/bin/env bash
     2	# Copyright 2009 The Go Authors. All rights reserved.
     3	# Use of this source code is governed by a BSD-style
     4	# license that can be found in the LICENSE file.
     5	
     6	# The master for this file is $GOROOT/src/quietgcc.bash
     7	# Changes made to $GOBIN/quietgcc will be overwritten.
     8	
     9	# Gcc output that we don't care to see.
    10	ignore=': error: .Each undeclared identifier'
    11	ignore=$ignore'|: error: for each function it appears'
    12	ignore=$ignore'|is dangerous, better use'
    13	ignore=$ignore'|is almost always misused'
    14	ignore=$ignore'|: In function '
    15	ignore=$ignore'|: At top level: '
    16	ignore=$ignore'|In file included from'
    17	ignore=$ignore'|        from'
    18	
    19	# Figure out which cc to run; this is set by make.bash.
    20	gcc="@CC@"
    21	if test "$gcc" = "@C""C@"; then
    22	  gcc=gcc
    23	fi
    24	
    25	# Build 64-bit binaries on 64-bit systems, unless GOHOSTARCH=386.
    26	case "$(uname -m -p)-$GOHOSTARCH" in
    27	*x86_64*-386 | *amd64*-386)
    28		gcc="$gcc -m32"
    29		;;
    30	*x86_64* | *amd64*)
    31		gcc="$gcc -m64"
    32	esac
    33	
    34	# Run gcc, save error status, redisplay output without noise, exit with gcc status.
    35	tmp="${TMPDIR:-/tmp}/quietgcc.$$.$USER.out"
    36	$gcc -Wall -Wno-sign-compare -Wno-missing-braces \
    37		-Wno-parentheses -Wno-unknown-pragmas -Wno-switch -Wno-comment \
    38		-Werror \
    39		"$@" >"$tmp" 2>&1
    40	status=$?
    41	egrep -v "$ignore" "$tmp" | uniq | tee "$tmp.1"
    42	
    43	rm -f "$tmp" "$tmp.1"
    44	exit $status

release.r60.3. Except as noted, this content is licensed under a Creative Commons Attribution 3.0 License.