File: compile

package info (click to toggle)
libixp 0.6~20121202%2Bhg148-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 968 kB
  • ctags: 1,619
  • sloc: ansic: 4,907; sh: 142; perl: 121; makefile: 110
file content (70 lines) | stat: -rwxr-xr-x 1,566 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh -f

CC=$1
CFLAGS=$2; shift 2

outfile="$1"; shift
bin="$(echo $0 | sed 's,/[^/]*$,,')"

# Derived from Russ Cox's 9c in plan9port.

xtmp=/tmp/cc.$$.$USER.out

echo CC $($bin/cleanname ${BASE}$outfile)
[ -n "$noisycc" ] && echo $CC -o $outfile $CFLAGS $@
eval '$CC -o $outfile '"$CFLAGS"' $@ >$xtmp 2>&1'
status=$?
[ $status -eq 0 ] || echo $CC -o $outfile $CFLAGS $@ >&2

base=$(echo $BASE | sed 's/,/\\,/g')
re='\([^[:space:]/][^[:space:]]*\..:[0-9]\)'

undup() { # GCC is crap.
	awk '
	function shift() {
		for(n=1; n<=3; n++)
			if(2*n <= nl)
			for(i=1; i<=n; i++) {
				if(l[i] != l[i+n])
					break;
				if(i == n) {
					for(i=1; i<=n; i++)
						print l[i]
					nl -= 2*n;
					for(i=1; i<=nl; i++)
						l[i] = l[i+2*n];
					return;
				}
			}
		if(nl == 0)
			return
		print l[1]
		for(i=1; i<nl; i++)
			l[i] = l[i+1]
		nl--
	}
	BEGIN{
		nl=0
		maxl=6
	}
	{
		if(nl == maxl)
			shift()
		l[++nl] = $0
	}
	END{
		while(nl > 0)
			shift();
	}'
}

cat $xtmp | sed "s,^$re,$base&,g; s,\([[:space:]]\)$re,\1$base\2,g" |
	egrep -iv ': (error|note): .?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.|use of C99 long long|ISO C forbids conversion|warning:.*warn_unused_result' |
	sed 's/ .first use in this function.$//; s/\"\([^\"][^\"]*\)\", line \([0-9][0-9]*\)/\1:\2/g' |
	awk '$1 == "warning:"{t=$2" "$1; sub(/^[^ ]+ [^ ]+ /, ""); $0 = t" "$0}; //' |
	awk '{sub(/\[/, ": [", $1); print}' |
	undup 1>&2

rm -f $xtmp
exit $status