File: ExtraQualFixer.sh

package info (click to toggle)
spring 106.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 55,316 kB
  • sloc: cpp: 543,954; ansic: 44,800; python: 12,575; java: 12,201; awk: 5,889; sh: 1,796; asm: 1,546; xml: 655; perl: 405; php: 211; objc: 194; makefile: 76; sed: 2
file content (27 lines) | stat: -rwxr-xr-x 902 bytes parent folder | download | duplicates (7)
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
#!/bin/sh
# Author: Tobi Vollebregt

# Use to fix errors like these (occuring with gcc >= 4.1):
# error: extra qualification 'CSpotFinder::' on member 'GetBestCachePoint'
# Pipe output of build process into it, ie.
#	buildtool -k | ./ExtraQualFixer.sh
# Use -k to keep build going on errors.
# This way all extra qualification errors are fixed in one pass.
# Replace buildtool with scons, make, whatever you use.

tmp=.ExtraQualFixer.tmp
grep 'error: extra qualification ' | sort | uniq > "$tmp"

IFS='
'
for line in $(cat "$tmp");
do
	# figure out symbol name, with and without extra qualification
	symbolwq=$(echo "$line" | awk -F \' '{print $2 $4}')
	symbolwoq=$(echo "$symbolwq" | sed 's/.*:://g')
	# figure out the filename
	file=$(echo "$line" | awk -F ':' '{print $1}')
	# replace symbol with extra qual. with symbol without extra qual.
	sed -i "s/$symbolwq/$symbolwoq/g" "$file"
done
rm "$tmp"