File: ExtraQualFixer.sh

package info (click to toggle)
spring 98.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 41,928 kB
  • ctags: 60,665
  • sloc: cpp: 356,167; ansic: 39,434; python: 12,228; java: 12,203; awk: 5,856; sh: 1,719; xml: 997; perl: 405; php: 253; objc: 194; makefile: 72; 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"